summaryrefslogtreecommitdiffstats
path: root/src/gui.cpp
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-03 23:21:13 +0100
committersalmonik <salmonik@tuta.io>2026-11-03 23:21:13 +0100
commit1f7c91905f69baba0aca8265c84deaba2ddac98a (patch)
tree9014a7e63e5531a05ff96c80a07ecccda927a533 /src/gui.cpp
parentRemove temporary crash-stage markers (diff)
downloadhl2h-1f7c91905f69baba0aca8265c84deaba2ddac98a.tar.gz
hl2h-1f7c91905f69baba0aca8265c84deaba2ddac98a.zip
World: add world/sky material colour modulation
Port Amalgam's modulation approach: obtain IMaterialSystem from the already loaded materialsystem.so (VMaterialSystem080) and walk materials with FirstMaterial/NextMaterial/GetMaterial. ColorModulate the "World textures" group (sky names excluded) and the "SkyBox textures"/sky-named group. The walk runs only when the enabled groups or colours change, restores white when disabled, and re-applies after level changes. Before touching materials, GetNumMaterials() and the first material's name/group are sanity-checked so a wrong vtable slot logs and aborts instead of walking garbage. GUI: "World tint" card with world/sky toggles and RGB sliders; config section [worldtint].
Diffstat (limited to '')
-rw-r--r--src/gui.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui.cpp b/src/gui.cpp
index 3f1651d..9d27a09 100644
--- a/src/gui.cpp
+++ b/src/gui.cpp
@@ -375,6 +375,26 @@ static void build_cards() {
375 add_card(2, &g_fullbright, "Fullbright", 375 add_card(2, &g_fullbright, "Fullbright",
376 "Ignore world lighting so dark areas are visible.", true); 376 "Ignore world lighting so dark areas are visible.", true);
377 377
378 int tint = add_card(2, &g_world_tint, "World tint",
379 "Multiply world and skybox material colour. "
380 "Independent of Fullbright lighting.", true);
381 add_toggle(tint, "World brushes",
382 "Tint world textures (sky and water excluded from this part).",
383 &g_tint_world_on);
384 add_slider(tint, "World red", "Red channel of the world tint (0-255).", 0,
385 255, &g_tint_world_rgb[0]);
386 add_slider(tint, "World green", "Green channel of the world tint (0-255).", 0,
387 255, &g_tint_world_rgb[1]);
388 add_slider(tint, "World blue", "Blue channel of the world tint (0-255).", 0,
389 255, &g_tint_world_rgb[2]);
390 add_toggle(tint, "Skybox", "Tint the skybox textures.", &g_tint_sky_on);
391 add_slider(tint, "Sky red", "Red channel of the sky tint (0-255).", 0, 255,
392 &g_tint_sky_rgb[0]);
393 add_slider(tint, "Sky green", "Green channel of the sky tint (0-255).", 0,
394 255, &g_tint_sky_rgb[1]);
395 add_slider(tint, "Sky blue", "Blue channel of the sky tint (0-255).", 0, 255,
396 &g_tint_sky_rgb[2]);
397
378 int spread = add_card(3, &g_spread, "Spread control", 398 int spread = add_card(3, &g_spread, "Spread control",
379 "Choose a server shot seed that tightens the cone.", 399 "Choose a server shot seed that tightens the cone.",
380 true); 400 true);