feat(postfx): redisseny sistema PostFX (X/F5/F6, --postfx CLI)

- X cicla 4 efectes (Vinyeta/Scanlines/Cromàtica/Complet), sempre activa PostFX
- F5 fa toggle PostFX on/off mantenint l'efecte seleccionat
- F6 hereta el toggle d'integer scaling (abans F5)
- Arrencada per defecte sense postprocés (tot a 0)
- --postfx <vinyeta|scanlines|cromatica|complet> per activar des de CLI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-20 09:06:24 +01:00
parent d2e7f2ff86
commit a51072db32
4 changed files with 77 additions and 13 deletions

View File

@@ -1013,23 +1013,52 @@ void Engine::toggleRealFullscreen() {
}
}
void Engine::applyPostFXPreset(int mode) {
static constexpr float presets[4][3] = {
{1.5f, 0.0f, 0.0f}, // 0: Vinyeta
{1.5f, 0.0f, 0.8f}, // 1: Scanlines
{1.5f, 1.0f, 0.0f}, // 2: Cromàtica
{1.5f, 1.0f, 0.8f}, // 3: Complet
};
postfx_uniforms_.vignette_strength = presets[mode][0];
postfx_uniforms_.chroma_strength = presets[mode][1];
postfx_uniforms_.scanline_strength = presets[mode][2];
}
void Engine::handlePostFXCycle() {
static constexpr float presets[5][3] = {
{1.5f, 0.0f, 0.0f}, {1.5f, 0.0f, 0.8f},
{1.5f, 1.0f, 0.0f}, {1.5f, 1.0f, 0.8f},
{0.0f, 0.0f, 0.0f}
};
static constexpr const char* names[5] = {
static constexpr const char* names[4] = {
"PostFX: Vinyeta", "PostFX: Scanlines",
"PostFX: Cromàtica", "PostFX: Complet", "PostFX: Desactivat"
"PostFX: Cromàtica", "PostFX: Complet"
};
postfx_effect_mode_ = (postfx_effect_mode_ + 1) % 5;
postfx_uniforms_.vignette_strength = presets[postfx_effect_mode_][0];
postfx_uniforms_.chroma_strength = presets[postfx_effect_mode_][1];
postfx_uniforms_.scanline_strength = presets[postfx_effect_mode_][2];
postfx_effect_mode_ = (postfx_effect_mode_ + 1) % 4;
postfx_enabled_ = true;
applyPostFXPreset(postfx_effect_mode_);
showNotificationForAction(names[postfx_effect_mode_]);
}
void Engine::handlePostFXToggle() {
static constexpr const char* names[4] = {
"PostFX: Vinyeta", "PostFX: Scanlines",
"PostFX: Cromàtica", "PostFX: Complet"
};
postfx_enabled_ = !postfx_enabled_;
if (postfx_enabled_) {
applyPostFXPreset(postfx_effect_mode_);
showNotificationForAction(names[postfx_effect_mode_]);
} else {
postfx_uniforms_.vignette_strength = 0.0f;
postfx_uniforms_.chroma_strength = 0.0f;
postfx_uniforms_.scanline_strength = 0.0f;
showNotificationForAction("PostFX: Desactivat");
}
}
void Engine::setInitialPostFX(int mode) {
postfx_effect_mode_ = mode;
postfx_enabled_ = true;
applyPostFXPreset(mode);
}
void Engine::toggleIntegerScaling() {
// Solo permitir cambio si estamos en modo fullscreen normal (F3)
if (!fullscreen_enabled_) {