feat(postfx): toggle F6 per activar/desactivar el postprocessat
This commit is contained in:
@@ -425,10 +425,10 @@ namespace Rendering::GPU {
|
||||
render_pass_ = nullptr;
|
||||
}
|
||||
|
||||
// Si el bloom està desactivat, fem clear a negre sobre bloom_b perquè
|
||||
// el composite el samplegi com a "sense bloom" sense haver de tenir un
|
||||
// path alternatiu al shader.
|
||||
const bool BLOOM_ON = postfx_params_.bloom_enabled;
|
||||
// Si el bloom està desactivat (per config o per l'interruptor mestre
|
||||
// F6), fem clear a negre sobre bloom_b perquè el composite el samplegi
|
||||
// com a "sense bloom" sense haver de tenir un path alternatiu al shader.
|
||||
const bool BLOOM_ON = postfx_enabled_ && postfx_params_.bloom_enabled;
|
||||
const float TEXEL_X = 1.0F / render_w_;
|
||||
const float TEXEL_Y = 1.0F / render_h_;
|
||||
const float SIGMA = postfx_params_.bloom_sigma_px;
|
||||
@@ -561,18 +561,20 @@ namespace Rendering::GPU {
|
||||
// Uniforms del postpro. Si una sección está desactivada, anulamos sus
|
||||
// contribuciones (intensidad / amplitud / max=min) en lugar de tener
|
||||
// un branch en el shader.
|
||||
const float BLOOM_INTENSITY = postfx_params_.bloom_enabled
|
||||
? postfx_params_.bloom_intensity
|
||||
: 0.0F;
|
||||
const float FLICKER_AMPLITUDE = postfx_params_.flicker_enabled
|
||||
? postfx_params_.flicker_amplitude
|
||||
: 0.0F;
|
||||
const float BG_MIN_R = postfx_params_.background_enabled ? postfx_params_.background_min_r : 0.0F;
|
||||
const float BG_MIN_G = postfx_params_.background_enabled ? postfx_params_.background_min_g : 0.0F;
|
||||
const float BG_MIN_B = postfx_params_.background_enabled ? postfx_params_.background_min_b : 0.0F;
|
||||
const float BG_MAX_R = postfx_params_.background_enabled ? postfx_params_.background_max_r : 0.0F;
|
||||
const float BG_MAX_G = postfx_params_.background_enabled ? postfx_params_.background_max_g : 0.0F;
|
||||
const float BG_MAX_B = postfx_params_.background_enabled ? postfx_params_.background_max_b : 0.0F;
|
||||
// L'interruptor mestre (postfx_enabled_) gateja totes les seccions: si
|
||||
// està OFF (F6), tot queda anul·lat i el composite és passthrough de
|
||||
// l'escena offscreen.
|
||||
const bool BLOOM_ON = postfx_enabled_ && postfx_params_.bloom_enabled;
|
||||
const bool FLICKER_ON = postfx_enabled_ && postfx_params_.flicker_enabled;
|
||||
const bool BG_ON = postfx_enabled_ && postfx_params_.background_enabled;
|
||||
const float BLOOM_INTENSITY = BLOOM_ON ? postfx_params_.bloom_intensity : 0.0F;
|
||||
const float FLICKER_AMPLITUDE = FLICKER_ON ? postfx_params_.flicker_amplitude : 0.0F;
|
||||
const float BG_MIN_R = BG_ON ? postfx_params_.background_min_r : 0.0F;
|
||||
const float BG_MIN_G = BG_ON ? postfx_params_.background_min_g : 0.0F;
|
||||
const float BG_MIN_B = BG_ON ? postfx_params_.background_min_b : 0.0F;
|
||||
const float BG_MAX_R = BG_ON ? postfx_params_.background_max_r : 0.0F;
|
||||
const float BG_MAX_G = BG_ON ? postfx_params_.background_max_g : 0.0F;
|
||||
const float BG_MAX_B = BG_ON ? postfx_params_.background_max_b : 0.0F;
|
||||
|
||||
// Tiempo en segundos desde el inicio de SDL (wall-clock real, robusto a FPS variables).
|
||||
const float TIME_SECONDS = static_cast<float>(SDL_GetTicks()) / 1000.0F;
|
||||
|
||||
@@ -118,6 +118,12 @@ namespace Rendering::GPU {
|
||||
void setPostFx(const PostFxParams& params) { postfx_params_ = params; }
|
||||
[[nodiscard]] auto postfx() const -> const PostFxParams& { return postfx_params_; }
|
||||
|
||||
// Interruptor mestre del postpro (F6). Quan està OFF, ni bloom ni
|
||||
// flicker ni background pulse afecten el frame — l'escena offscreen
|
||||
// surt tal com s'ha renderitzat (passthrough). Útil per A/B testing.
|
||||
void setPostFxEnabled(bool enabled) { postfx_enabled_ = enabled; }
|
||||
[[nodiscard]] auto isPostFxEnabled() const -> bool { return postfx_enabled_; }
|
||||
|
||||
// Acceso a internals.
|
||||
[[nodiscard]] auto device() -> GpuDevice& { return device_; }
|
||||
[[nodiscard]] auto isInsideFrame() const -> bool { return cmd_buffer_ != nullptr; }
|
||||
@@ -173,6 +179,10 @@ namespace Rendering::GPU {
|
||||
// Estat de l'antialias geomètric a les línies (toggle F5).
|
||||
bool antialias_enabled_{true};
|
||||
|
||||
// Interruptor mestre del postpro (toggle F6). Quan és false, bloom +
|
||||
// flicker + background pulse queden anul·lats (passthrough de l'escena).
|
||||
bool postfx_enabled_{true};
|
||||
|
||||
// Helpers internos.
|
||||
[[nodiscard]] auto createOffscreen() -> bool;
|
||||
void destroyOffscreen();
|
||||
|
||||
Reference in New Issue
Block a user