summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-11-04 18:46:46 +0100
committersalmonik <salmonik@tuta.io>2026-11-04 18:46:46 +0100
commitbfd2f7fac43069d29436d4ecf3767b2c57f59c3a (patch)
tree859bd2fba7403a059e1adb058f3d8309c64e7e3c
parentChams: preload style materials outside the model draw (diff)
downloadhl2h-bfd2f7fac43069d29436d4ecf3767b2c57f59c3a.tar.gz
hl2h-bfd2f7fac43069d29436d4ecf3767b2c57f59c3a.zip
Chams: use the loaded VGUI whites for flat and additive
models/debug/debugwhite is EP2-only and additivevertexcolorvertexalpha is not loadable in the base game. Preload vgui/white for Flat and vgui/white_additive for Additive; the other debug styles were already found. The viewmodel keeps the solid model shader.
-rw-r--r--CONTEXT.md14
-rw-r--r--src/studio.cpp4
2 files changed, 10 insertions, 8 deletions
diff --git a/CONTEXT.md b/CONTEXT.md
index 72559ac..e323588 100644
--- a/CONTEXT.md
+++ b/CONTEXT.md
@@ -296,12 +296,14 @@ vocabulary / decisions.
296 vars (IMaterialVar slot 11, SetVecValue 3-float slot 11), because some forced 296 vars (IMaterialVar slot 11, SetVecValue 3-float slot 11), because some forced
297 materials ignore ColorModulate. The shared material's flag and colour are 297 materials ignore ColorModulate. The shared material's flag and colour are
298 restored to (false, white) after the draw. 298 restored to (false, white) after the draw.
299- The base game does not have the other debug VMTs resident and `FindMaterial` 299- The base game does not mount `models/debug/debugwhite` (EP2-only) or
300 does not make them available reliably, so all styles use the resident 300 `debug/additivevertexcolorvertexalpha`; the style material is preloaded from
301 `debug/debugtranslucentsinglecolor` and differ by material flags: 301 `outer_draw` (throttled) and cached. Styles: 0 Flat (`vgui/white`),
302 0 Flat (`FLAT`), 1 Wireframe (`WIREFRAME`), 2 Additive (`ADDITIVE`), 302 1 Wireframe (`debug/debugwireframe`), 2 Additive (`vgui/white_additive`),
303 3 Solid (none), 4 White (colour forced to white), 5 Fullbright 303 3 Solid (`debug/debugtranslucentsinglecolor`), 4 White
304 (`FLAT|SELFILLUM`). Flags are reset after the draw. 304 (`debug/debugtranslucentvertexcolor`), 5 Fullbright
305 (`debug/debugmrmfullbright2`). A missing style falls back to the solid one;
306 the render hook never calls FindMaterial itself.
305- `Viewmodel (hands/weapon)` applies the override to entities whose class 307- `Viewmodel (hands/weapon)` applies the override to entities whose class
306 contains `viewmodel` or whose model path is `.../v_...`. Viewmodels always 308 contains `viewmodel` or whose model path is `.../v_...`. Viewmodels always
307 use the solid style (no style flags) with the selected colour; VGUI/white 309 use the solid style (no style flags) with the selected colour; VGUI/white
diff --git a/src/studio.cpp b/src/studio.cpp
index 44d1bb4..f815c16 100644
--- a/src/studio.cpp
+++ b/src/studio.cpp
@@ -204,11 +204,11 @@ void *viewmodel_material();
204const char *chams_material_name(int idx) { 204const char *chams_material_name(int idx) {
205 switch (idx) { 205 switch (idx) {
206 case 1: return "debug/debugwireframe"; 206 case 1: return "debug/debugwireframe";
207 case 2: return "debug/additivevertexcolorvertexalpha"; 207 case 2: return "vgui/white_additive";
208 case 3: return "debug/debugtranslucentsinglecolor"; 208 case 3: return "debug/debugtranslucentsinglecolor";
209 case 4: return "debug/debugtranslucentvertexcolor"; 209 case 4: return "debug/debugtranslucentvertexcolor";
210 case 5: return "debug/debugmrmfullbright2"; 210 case 5: return "debug/debugmrmfullbright2";
211 default: return "models/debug/debugwhite"; 211 default: return "vgui/white"; // models/debug/debugwhite is EP2-only
212 } 212 }
213} 213}
214 214