From 200672756cfde1271b9f4b22914e6e3e8e5a89b7 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 20 Mar 2026 18:36:45 +0100 Subject: [PATCH] refactor: separar F5 (toggle) y X (ciclo modos) en PostFX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - X ya no incluye OFF en el ciclo; si PostFX está desactivado, no hace nada - cycleShader() cicla solo entre los 4 modos usando postfx_effect_mode_ - Eliminar postfx_cycle_idx_ (redundante, causaba desincronización) - postfx_effect_mode_ por defecto = 3 (completo) para que F5 active completo sin --postfx Co-Authored-By: Claude Sonnet 4.6 --- source/engine.cpp | 28 +++++++++++----------------- source/engine.hpp | 5 +---- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/source/engine.cpp b/source/engine.cpp index 442f6cd..cca3df7 100644 --- a/source/engine.cpp +++ b/source/engine.cpp @@ -1102,24 +1102,18 @@ void Engine::setPostFXParamOverrides(float vignette, float chroma) { } void Engine::cycleShader() { - static const char* names[5] = { - "PostFX desactivado", "PostFX viñeta", "PostFX scanlines", - "PostFX cromática", "PostFX completo" - }; - postfx_cycle_idx_ = (postfx_cycle_idx_ + 1) % 5; - int cycle = postfx_cycle_idx_; + // X no hace nada si PostFX está desactivado + if (!postfx_enabled_) return; - if (cycle == 0) { - postfx_enabled_ = false; - postfx_uniforms_.vignette_strength = 0.0f; - postfx_uniforms_.chroma_strength = 0.0f; - postfx_uniforms_.scanline_strength = 0.0f; - } else { - postfx_enabled_ = true; - postfx_effect_mode_ = cycle - 1; - applyPostFXPreset(postfx_effect_mode_); - } - showNotificationForAction(names[cycle]); + // Cicla solo entre los 4 modos (sin OFF) + postfx_effect_mode_ = (postfx_effect_mode_ + 1) % 4; + applyPostFXPreset(postfx_effect_mode_); + + static constexpr const char* names[4] = { + "PostFX viñeta", "PostFX scanlines", + "PostFX cromática", "PostFX completo" + }; + showNotificationForAction(names[postfx_effect_mode_]); } void Engine::toggleIntegerScaling() { diff --git a/source/engine.hpp b/source/engine.hpp index f2822a2..390256d 100644 --- a/source/engine.hpp +++ b/source/engine.hpp @@ -182,14 +182,11 @@ class Engine { // PostFX uniforms (passed to GPU each frame) PostFXUniforms postfx_uniforms_ = {0.0f, 0.0f, 0.0f, 0.0f}; - int postfx_effect_mode_ = 0; + int postfx_effect_mode_ = 3; bool postfx_enabled_ = false; float postfx_override_vignette_ = -1.f; // -1 = sin override float postfx_override_chroma_ = -1.f; - // Cicle PostFX natiu (0=OFF, 1=Vinyeta, 2=Scanlines, 3=Cromàtica, 4=Complet) - int postfx_cycle_idx_ = 0; - // Sistema de zoom dinámico int current_window_zoom_ = DEFAULT_WINDOW_ZOOM;