comandos i tecles per a manejar el nou disseny de shaders
This commit is contained in:
@@ -66,13 +66,21 @@ void RenderInfo::render() const {
|
||||
}
|
||||
line += " | " + zoom_str + "x";
|
||||
|
||||
// PostFX: muestra preset y supersampling, o nada si está desactivado
|
||||
// PostFX: muestra shader + preset y supersampling, o nada si está desactivado
|
||||
if (Options::video.postfx) {
|
||||
const bool IS_CRTPI = (Options::current_shader == Rendering::ShaderType::CRTPI);
|
||||
const std::string SHADER_NAME = IS_CRTPI ? "crtpi" : "postfx";
|
||||
std::string preset_name = "-";
|
||||
if (!Options::postfx_presets.empty()) {
|
||||
preset_name = Options::postfx_presets[static_cast<size_t>(Options::current_postfx_preset)].name;
|
||||
if (IS_CRTPI) {
|
||||
if (!Options::crtpi_presets.empty()) {
|
||||
preset_name = Options::crtpi_presets[static_cast<size_t>(Options::current_crtpi_preset)].name;
|
||||
}
|
||||
} else {
|
||||
if (!Options::postfx_presets.empty()) {
|
||||
preset_name = Options::postfx_presets[static_cast<size_t>(Options::current_postfx_preset)].name;
|
||||
}
|
||||
}
|
||||
line += " | " + preset_name + (Options::video.supersampling ? " (ss)" : "");
|
||||
line += " | " + SHADER_NAME + " " + preset_name + (Options::video.supersampling ? " (ss)" : "");
|
||||
}
|
||||
|
||||
// Todo en lowercase
|
||||
|
||||
@@ -226,14 +226,21 @@ void Screen::renderNotifications() const {
|
||||
}
|
||||
}
|
||||
|
||||
// Cambia el estado del PostFX
|
||||
void Screen::togglePostFX() {
|
||||
// Activa/desactiva todos los shaders respetando el shader actualmente seleccionado
|
||||
void Screen::toggleShaders() {
|
||||
Options::video.postfx = !Options::video.postfx;
|
||||
if (shader_backend_ && shader_backend_->isHardwareAccelerated()) {
|
||||
if (Options::video.postfx) {
|
||||
applyCurrentPostFXPreset();
|
||||
// Activar: usar el shader actualmente seleccionado
|
||||
if (Options::current_shader == Rendering::ShaderType::CRTPI) {
|
||||
shader_backend_->setActiveShader(Rendering::ShaderType::CRTPI);
|
||||
applyCurrentCrtPiPreset();
|
||||
} else {
|
||||
applyCurrentPostFXPreset();
|
||||
}
|
||||
} else {
|
||||
// Pass-through: efectos a 0, el shader copia la textura sin modificar
|
||||
// Desactivar: pass-through con POSTFX (pipeline sin efecto)
|
||||
shader_backend_->setActiveShader(Rendering::ShaderType::POSTFX);
|
||||
shader_backend_->setPostFXParams(Rendering::PostFXParams{});
|
||||
}
|
||||
} else {
|
||||
@@ -252,6 +259,12 @@ void Screen::reloadPostFX() {
|
||||
}
|
||||
}
|
||||
|
||||
// Recarga el shader CrtPi del preset actual sin toggle
|
||||
void Screen::reloadCrtPi() {
|
||||
if (!shader_backend_) { return; }
|
||||
applyCurrentCrtPiPreset();
|
||||
}
|
||||
|
||||
// Actualiza la lógica de la clase (versión nueva con delta_time para escenas migradas)
|
||||
void Screen::update(float delta_time) {
|
||||
fps_.calculate(SDL_GetTicks());
|
||||
@@ -583,15 +596,17 @@ void Screen::applyCurrentCrtPiPreset() { // NOLINT(readability-convert-member-f
|
||||
void Screen::setActiveShader(Rendering::ShaderType type) {
|
||||
Options::current_shader = type;
|
||||
if (!shader_backend_) { return; }
|
||||
if (!Options::video.postfx) {
|
||||
// Shaders desactivados: guardar preferencia pero mantener pass-through
|
||||
shader_backend_->setActiveShader(Rendering::ShaderType::POSTFX);
|
||||
shader_backend_->setPostFXParams(Rendering::PostFXParams{});
|
||||
return;
|
||||
}
|
||||
shader_backend_->setActiveShader(type);
|
||||
if (type == Rendering::ShaderType::CRTPI) {
|
||||
applyCurrentCrtPiPreset();
|
||||
} else {
|
||||
if (Options::video.postfx) {
|
||||
applyCurrentPostFXPreset();
|
||||
} else {
|
||||
shader_backend_->setPostFXParams(Rendering::PostFXParams{});
|
||||
}
|
||||
applyCurrentPostFXPreset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,10 @@ class Screen {
|
||||
void nextPalette(); // Cambia a la siguiente paleta
|
||||
void previousPalette(); // Cambia a la paleta anterior
|
||||
void setPalete(); // Establece la paleta actual
|
||||
void togglePostFX(); // Cambia el estado del PostFX
|
||||
void toggleShaders(); // Activa/desactiva todos los shaders respetando current_shader
|
||||
void toggleSupersampling(); // Activa/desactiva el supersampling global
|
||||
void reloadPostFX(); // Recarga el shader del preset actual sin toggle
|
||||
void reloadCrtPi(); // Recarga el shader CrtPi del preset actual sin toggle
|
||||
void setLinearUpscale(bool linear); // Upscale NEAREST (false) o LINEAR (true) en el paso SS
|
||||
void setDownscaleAlgo(int algo); // 0=bilinear legacy, 1=Lanczos2, 2=Lanczos3
|
||||
void setActiveShader(Rendering::ShaderType type); // Cambia el shader de post-procesado activo
|
||||
|
||||
Reference in New Issue
Block a user