From 1f7c91905f69baba0aca8265c84deaba2ddac98a Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 3 Nov 2026 23:21:13 +0100 Subject: 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]. --- src/gui.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/gui.cpp') 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() { add_card(2, &g_fullbright, "Fullbright", "Ignore world lighting so dark areas are visible.", true); + int tint = add_card(2, &g_world_tint, "World tint", + "Multiply world and skybox material colour. " + "Independent of Fullbright lighting.", true); + add_toggle(tint, "World brushes", + "Tint world textures (sky and water excluded from this part).", + &g_tint_world_on); + add_slider(tint, "World red", "Red channel of the world tint (0-255).", 0, + 255, &g_tint_world_rgb[0]); + add_slider(tint, "World green", "Green channel of the world tint (0-255).", 0, + 255, &g_tint_world_rgb[1]); + add_slider(tint, "World blue", "Blue channel of the world tint (0-255).", 0, + 255, &g_tint_world_rgb[2]); + add_toggle(tint, "Skybox", "Tint the skybox textures.", &g_tint_sky_on); + add_slider(tint, "Sky red", "Red channel of the sky tint (0-255).", 0, 255, + &g_tint_sky_rgb[0]); + add_slider(tint, "Sky green", "Green channel of the sky tint (0-255).", 0, + 255, &g_tint_sky_rgb[1]); + add_slider(tint, "Sky blue", "Blue channel of the sky tint (0-255).", 0, 255, + &g_tint_sky_rgb[2]); + int spread = add_card(3, &g_spread, "Spread control", "Choose a server shot seed that tightens the cone.", true); -- cgit v1.2.3