feat(postfx): debug HUD mostra PostFX, overrides persistents al ciclar, --postfx sense valor
- HUD (F1) afegeix línia PostFX: OFF o PostFX: <preset> [V:x.xx C:x.xx S:x.xx] - applyPostFXPreset reaaplica overrides de CLI per preservar-los en ciclar amb X - setPostFXParamOverrides guarda els valors en membres privats per persistència - --postfx sense valor ja no dona error i utilitza complet (preset 3) per defecte Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1053,6 +1053,9 @@ void Engine::applyPostFXPreset(int mode) {
|
|||||||
postfx_uniforms_.vignette_strength = presets[mode][0];
|
postfx_uniforms_.vignette_strength = presets[mode][0];
|
||||||
postfx_uniforms_.chroma_strength = presets[mode][1];
|
postfx_uniforms_.chroma_strength = presets[mode][1];
|
||||||
postfx_uniforms_.scanline_strength = presets[mode][2];
|
postfx_uniforms_.scanline_strength = presets[mode][2];
|
||||||
|
// Reaplicar overrides de CLI si están activos
|
||||||
|
if (postfx_override_vignette_ >= 0.f) postfx_uniforms_.vignette_strength = postfx_override_vignette_;
|
||||||
|
if (postfx_override_chroma_ >= 0.f) postfx_uniforms_.chroma_strength = postfx_override_chroma_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::handlePostFXCycle() {
|
void Engine::handlePostFXCycle() {
|
||||||
@@ -1089,6 +1092,15 @@ void Engine::setInitialPostFX(int mode) {
|
|||||||
applyPostFXPreset(mode);
|
applyPostFXPreset(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Engine::setPostFXParamOverrides(float vignette, float chroma) {
|
||||||
|
postfx_override_vignette_ = vignette;
|
||||||
|
postfx_override_chroma_ = chroma;
|
||||||
|
postfx_enabled_ = true;
|
||||||
|
// Aplicar inmediatamente sobre el preset activo
|
||||||
|
if (vignette >= 0.f) postfx_uniforms_.vignette_strength = vignette;
|
||||||
|
if (chroma >= 0.f) postfx_uniforms_.chroma_strength = chroma;
|
||||||
|
}
|
||||||
|
|
||||||
void Engine::toggleIntegerScaling() {
|
void Engine::toggleIntegerScaling() {
|
||||||
// Ciclar entre los 3 modos: INTEGER → LETTERBOX → STRETCH → INTEGER
|
// Ciclar entre los 3 modos: INTEGER → LETTERBOX → STRETCH → INTEGER
|
||||||
switch (current_scaling_mode_) {
|
switch (current_scaling_mode_) {
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ class Engine {
|
|||||||
void handlePostFXCycle();
|
void handlePostFXCycle();
|
||||||
void handlePostFXToggle();
|
void handlePostFXToggle();
|
||||||
void setInitialPostFX(int mode);
|
void setInitialPostFX(int mode);
|
||||||
|
void setPostFXParamOverrides(float vignette, float chroma);
|
||||||
|
|
||||||
// Modo kiosko
|
// Modo kiosko
|
||||||
void setKioskMode(bool enabled) { kiosk_mode_ = enabled; }
|
void setKioskMode(bool enabled) { kiosk_mode_ = enabled; }
|
||||||
@@ -124,6 +125,11 @@ class Engine {
|
|||||||
int getBaseScreenHeight() const { return base_screen_height_; }
|
int getBaseScreenHeight() const { return base_screen_height_; }
|
||||||
int getMaxAutoScenario() const { return max_auto_scenario_; }
|
int getMaxAutoScenario() const { return max_auto_scenario_; }
|
||||||
size_t getCurrentTextureIndex() const { return current_texture_index_; }
|
size_t getCurrentTextureIndex() const { return current_texture_index_; }
|
||||||
|
bool isPostFXEnabled() const { return postfx_enabled_; }
|
||||||
|
int getPostFXMode() const { return postfx_effect_mode_; }
|
||||||
|
float getPostFXVignette() const { return postfx_uniforms_.vignette_strength; }
|
||||||
|
float getPostFXChroma() const { return postfx_uniforms_.chroma_strength; }
|
||||||
|
float getPostFXScanline() const { return postfx_uniforms_.scanline_strength; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// === Componentes del sistema (Composición) ===
|
// === Componentes del sistema (Composición) ===
|
||||||
@@ -175,6 +181,8 @@ class Engine {
|
|||||||
PostFXUniforms postfx_uniforms_ = {0.0f, 0.0f, 0.0f, 0.0f};
|
PostFXUniforms postfx_uniforms_ = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||||
int postfx_effect_mode_ = 0;
|
int postfx_effect_mode_ = 0;
|
||||||
bool postfx_enabled_ = false;
|
bool postfx_enabled_ = false;
|
||||||
|
float postfx_override_vignette_ = -1.f; // -1 = sin override
|
||||||
|
float postfx_override_chroma_ = -1.f;
|
||||||
|
|
||||||
// Sistema de zoom dinámico
|
// Sistema de zoom dinámico
|
||||||
int current_window_zoom_ = DEFAULT_WINDOW_ZOOM;
|
int current_window_zoom_ = DEFAULT_WINDOW_ZOOM;
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ void printHelp() {
|
|||||||
std::cout << " --custom-balls <n> Activa escenario custom (tecla 9) con N pelotas\n";
|
std::cout << " --custom-balls <n> Activa escenario custom (tecla 9) con N pelotas\n";
|
||||||
std::cout << " --skip-benchmark Salta el benchmark y usa el máximo de bolas (50000)\n";
|
std::cout << " --skip-benchmark Salta el benchmark y usa el máximo de bolas (50000)\n";
|
||||||
std::cout << " --max-balls <n> Limita el máximo de bolas en modos DEMO/DEMO_LITE\n";
|
std::cout << " --max-balls <n> Limita el máximo de bolas en modos DEMO/DEMO_LITE\n";
|
||||||
std::cout << " --postfx <efecto> Arrancar con PostFX activo: vinyeta, scanlines, cromatica, complet\n";
|
std::cout << " --postfx [efecto] Arrancar con PostFX activo (default: complet): vinyeta, scanlines, cromatica, complet\n";
|
||||||
|
std::cout << " --vignette <float> Sobreescribir vignette_strength (activa PostFX si no hay --postfx)\n";
|
||||||
|
std::cout << " --chroma <float> Sobreescribir chroma_strength (activa PostFX si no hay --postfx)\n";
|
||||||
std::cout << " --help Mostrar esta ayuda\n\n";
|
std::cout << " --help Mostrar esta ayuda\n\n";
|
||||||
std::cout << "Ejemplos:\n";
|
std::cout << "Ejemplos:\n";
|
||||||
std::cout << " vibe3_physics # 320x240 zoom 3 (ventana 960x720)\n";
|
std::cout << " vibe3_physics # 320x240 zoom 3 (ventana 960x720)\n";
|
||||||
@@ -47,6 +49,8 @@ int main(int argc, char* argv[]) {
|
|||||||
bool skip_benchmark = false;
|
bool skip_benchmark = false;
|
||||||
int max_balls_override = 0;
|
int max_balls_override = 0;
|
||||||
int initial_postfx = -1;
|
int initial_postfx = -1;
|
||||||
|
float override_vignette = -1.f;
|
||||||
|
float override_chroma = -1.f;
|
||||||
AppMode initial_mode = AppMode::SANDBOX; // Modo inicial (default: SANDBOX)
|
AppMode initial_mode = AppMode::SANDBOX; // Modo inicial (default: SANDBOX)
|
||||||
|
|
||||||
// Parsear argumentos
|
// Parsear argumentos
|
||||||
@@ -127,7 +131,8 @@ int main(int argc, char* argv[]) {
|
|||||||
} else if (strcmp(argv[i], "--skip-benchmark") == 0) {
|
} else if (strcmp(argv[i], "--skip-benchmark") == 0) {
|
||||||
skip_benchmark = true;
|
skip_benchmark = true;
|
||||||
} else if (strcmp(argv[i], "--postfx") == 0) {
|
} else if (strcmp(argv[i], "--postfx") == 0) {
|
||||||
if (i + 1 < argc) {
|
// Si no hay valor o el siguiente arg es otra opción, defaultear a complet
|
||||||
|
if (i + 1 < argc && argv[i + 1][0] != '-') {
|
||||||
std::string fx = argv[++i];
|
std::string fx = argv[++i];
|
||||||
if (fx == "vinyeta") {
|
if (fx == "vinyeta") {
|
||||||
initial_postfx = 0;
|
initial_postfx = 0;
|
||||||
@@ -142,7 +147,20 @@ int main(int argc, char* argv[]) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Error: --postfx requiere un valor\n";
|
initial_postfx = 3; // default: complet
|
||||||
|
}
|
||||||
|
} else if (strcmp(argv[i], "--vignette") == 0) {
|
||||||
|
if (i + 1 < argc) {
|
||||||
|
override_vignette = (float)atof(argv[++i]);
|
||||||
|
} else {
|
||||||
|
std::cerr << "Error: --vignette requiere un valor\n";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else if (strcmp(argv[i], "--chroma") == 0) {
|
||||||
|
if (i + 1 < argc) {
|
||||||
|
override_chroma = (float)atof(argv[++i]);
|
||||||
|
} else {
|
||||||
|
std::cerr << "Error: --chroma requiere un valor\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if (strcmp(argv[i], "--max-balls") == 0) {
|
} else if (strcmp(argv[i], "--max-balls") == 0) {
|
||||||
@@ -182,6 +200,12 @@ int main(int argc, char* argv[]) {
|
|||||||
if (initial_postfx >= 0)
|
if (initial_postfx >= 0)
|
||||||
engine.setInitialPostFX(initial_postfx);
|
engine.setInitialPostFX(initial_postfx);
|
||||||
|
|
||||||
|
if (override_vignette >= 0.f || override_chroma >= 0.f) {
|
||||||
|
if (initial_postfx < 0)
|
||||||
|
engine.setInitialPostFX(0);
|
||||||
|
engine.setPostFXParamOverrides(override_vignette, override_chroma);
|
||||||
|
}
|
||||||
|
|
||||||
if (!engine.initialize(width, height, zoom, fullscreen, initial_mode)) {
|
if (!engine.initialize(width, height, zoom, fullscreen, initial_mode)) {
|
||||||
std::cout << "¡Error al inicializar el engine!" << std::endl;
|
std::cout << "¡Error al inicializar el engine!" << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -335,6 +335,23 @@ void UIManager::renderDebugHUD(const Engine* engine,
|
|||||||
lines.push_back(logic_res_text);
|
lines.push_back(logic_res_text);
|
||||||
lines.push_back(refresh_text);
|
lines.push_back(refresh_text);
|
||||||
lines.push_back(theme_text);
|
lines.push_back(theme_text);
|
||||||
|
std::string postfx_text;
|
||||||
|
if (!engine->isPostFXEnabled()) {
|
||||||
|
postfx_text = "PostFX: OFF";
|
||||||
|
} else {
|
||||||
|
static constexpr const char* preset_names[4] = {
|
||||||
|
"Vinyeta", "Scanlines", "Cromatica", "Complet"
|
||||||
|
};
|
||||||
|
int mode = engine->getPostFXMode();
|
||||||
|
char buf[64];
|
||||||
|
SDL_snprintf(buf, sizeof(buf), "PostFX: %s [V:%.2f C:%.2f S:%.2f]",
|
||||||
|
preset_names[mode],
|
||||||
|
engine->getPostFXVignette(),
|
||||||
|
engine->getPostFXChroma(),
|
||||||
|
engine->getPostFXScanline());
|
||||||
|
postfx_text = buf;
|
||||||
|
}
|
||||||
|
lines.push_back(postfx_text);
|
||||||
lines.push_back(elapsed_text);
|
lines.push_back(elapsed_text);
|
||||||
|
|
||||||
const Ball* first_ball = scene_manager->getFirstBall();
|
const Ball* first_ball = scene_manager->getFirstBall();
|
||||||
|
|||||||
Reference in New Issue
Block a user