millores en els presets

This commit is contained in:
2026-03-21 14:12:11 +01:00
parent 6996b3a82a
commit 23863c02a6
11 changed files with 125 additions and 48 deletions

View File

@@ -681,11 +681,14 @@ auto loadPostFXFromFile() -> bool {
if (p.contains("name")) {
preset.name = p["name"].get_value<std::string>();
}
if (p.contains("vertex")) {
preset.vertex = p["vertex"].get_value<std::string>();
if (p.contains("vignette")) {
try { preset.vignette = p["vignette"].get_value<float>(); } catch (...) {}
}
if (p.contains("fragment")) {
preset.fragment = p["fragment"].get_value<std::string>();
if (p.contains("scanlines")) {
try { preset.scanlines = p["scanlines"].get_value<float>(); } catch (...) {}
}
if (p.contains("chroma")) {
try { preset.chroma = p["chroma"].get_value<float>(); } catch (...) {}
}
postfx_presets.push_back(preset);
}
@@ -720,13 +723,24 @@ auto savePostFXToFile() -> bool {
}
file << "# JailDoctor's Dilemma - PostFX Presets\n";
file << "# Add or modify presets to customize post-processing effects.\n";
file << "# vertex and fragment reference shader filenames from the shaders directory.\n";
file << "# Each preset defines the intensity of post-processing effects (0.0 to 1.0).\n";
file << "# vignette: screen darkening at the edges\n";
file << "# scanlines: horizontal scanline effect\n";
file << "# chroma: chromatic aberration (RGB color fringing)\n";
file << "\n";
file << "presets:\n";
file << " - name: \"CRT\"\n";
file << " vertex: \"crtpi_vertex.glsl\"\n";
file << " fragment: \"crtpi_fragment.glsl\"\n";
file << " vignette: 0.6\n";
file << " scanlines: 0.7\n";
file << " chroma: 0.15\n";
file << " - name: \"SCANLINES\"\n";
file << " vignette: 0.0\n";
file << " scanlines: 0.8\n";
file << " chroma: 0.0\n";
file << " - name: \"SUBTLE\"\n";
file << " vignette: 0.3\n";
file << " scanlines: 0.4\n";
file << " chroma: 0.05\n";
file.close();
@@ -736,7 +750,9 @@ auto savePostFXToFile() -> bool {
// Cargar los presets recién creados
postfx_presets.clear();
postfx_presets.push_back({"CRT", "crtpi_vertex.glsl", "crtpi_fragment.glsl"});
postfx_presets.push_back({"CRT", 0.6F, 0.7F, 0.15F});
postfx_presets.push_back({"SCANLINES", 0.0F, 0.8F, 0.0F});
postfx_presets.push_back({"SUBTLE", 0.3F, 0.4F, 0.05F});
current_postfx_preset = 0;
return true;

View File

@@ -116,9 +116,10 @@ struct Game {
// Estructura para un preset de PostFX
struct PostFXPreset {
std::string name; // Nombre del preset
std::string vertex; // Nombre del fichero vertex shader
std::string fragment; // Nombre del fichero fragment shader
std::string name; // Nombre del preset
float vignette{0.6F}; // Intensidad de la viñeta (0.0 = ninguna, 1.0 = máxima)
float scanlines{0.7F}; // Intensidad de las scanlines (0.0 = desactivadas, 1.0 = máximas)
float chroma{0.15F}; // Intensidad de la aberración cromática (0.0 = ninguna, 1.0 = máxima)
};
// --- Variables globales ---