summaryrefslogtreecommitdiffstats
path: root/CONTEXT.md
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 /CONTEXT.md
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--CONTEXT.md25
1 files changed, 22 insertions, 3 deletions
diff --git a/CONTEXT.md b/CONTEXT.md
index fb97636..ce4a02e 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -295,14 +295,33 @@ vocabulary / decisions.
295 295
296- Visuals card with the usual Active + Bind. Unbound and Active means always 296- Visuals card with the usual Active + Bind. Unbound and Active means always
297 on; a bind makes it a hold-to-brighten key. 297 on; a bind makes it a hold-to-brighten key.
298- Applies the client `mat_fullbright` cvar to 1/0 through `VEngineCvar004` 298- Applies the client `mat_fullbright` cvar to 1/0 through
299 (`FindVar` slot 12, `ConVar::SetValue(int)` slot 11), which bypasses the 299 `IVEngineClient::ClientCmd` (slot 7), which bypasses the console cheat gate
300 console cheat gate. No server-side writes. 300 and avoids the crashing direct `ConVar` vtable path. No server-side writes.
301- Re-applied after map loads/respawns (`fullbright_invalidate` on local entity 301- Re-applied after map loads/respawns (`fullbright_invalidate` on local entity
302 change) and saved as `[fullbright] active/bind`. 302 change) and saved as `[fullbright] active/bind`.
303- `fullbright: on/off` is logged; a missing cvar interface raises an error 303- `fullbright: on/off` is logged; a missing cvar interface raises an error
304 toast instead of failing silently. 304 toast instead of failing silently.
305 305
306### World tint (material colour modulation)
307
308- Same idea as Amalgam's world modulation: find `IMaterialSystem` in the
309 already-loaded `materialsystem.so` and walk every material with
310 `FirstMaterial` / `NextMaterial` / `GetMaterial`.
311- `IMaterial::ColorModulate(r,g,b)` is applied to materials whose
312 `GetTextureGroupName()` is `World textures` (sky names excluded) and to
313 `SkyBox textures` (or names containing `sky`). Lightmaps are not touched.
314- Slot map (2013 SDK layout, registered under `VMaterialSystem080`):
315 `IMaterialSystem` 73/74/75/76/77 = First/Next/Invalid/Get/GetNumMaterials;
316 `IMaterial` 0/1/28 = GetName/GetTextureGroupName/ColorModulate.
317- `src/world.cpp`; the walk runs only when the enabled groups or colours
318 change, and re-applies after level changes via `world_tint_invalidate()`.
319 Disabling restores white, so no reload is needed.
320- Validation before any walk: `GetNumMaterials()` must return 1..200000; the
321 first material's name/group must be printable strings. A mismatch logs and
322 toasts instead of poking garbage.
323- Saved as `[worldtint] active/bind/world/sky/wr..wb/sr..sb`.
324
306## Logging 325## Logging
307 326
308- `/tmp/hl2hake.log` is opened once at startup with `"w"` (so it only contains 327- `/tmp/hl2hake.log` is opened once at startup with `"w"` (so it only contains