diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-04 18:48:52 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-04 18:48:52 +0100 |
| commit | f1642be0e40af9c3c474add2714b898318cfa796 (patch) | |
| tree | 98cbd9488c920e491532e2e5330dc459f0d2d3f0 | |
| parent | Chams: use the loaded VGUI whites for flat and additive (diff) | |
| download | hl2h-f1642be0e40af9c3c474add2714b898318cfa796.tar.gz hl2h-f1642be0e40af9c3c474add2714b898318cfa796.zip | |
Chams: apply model-safe styles to the viewmodel
The viewmodel was always solid. Use the selected style material for the
model-debug styles (wireframe/solid/white/fullbright); Flat and Additive use
the solid model shader with the same flags because their VGUI materials do not
draw skinned models.
| -rw-r--r-- | src/studio.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/studio.cpp b/src/studio.cpp index f815c16..b428a26 100644 --- a/src/studio.cpp +++ b/src/studio.cpp | |||
| @@ -285,12 +285,18 @@ void hkdModelExecute(void *self, const void *state, const void *info, | |||
| 285 | bool is_npc = esp_is_npc_index(idx); | 285 | bool is_npc = esp_is_npc_index(idx); |
| 286 | bool is_vm = g_chams_viewmodel && esp_is_viewmodel_index(idx); | 286 | bool is_vm = g_chams_viewmodel && esp_is_viewmodel_index(idx); |
| 287 | if (is_npc || is_vm) { | 287 | if (is_npc || is_vm) { |
| 288 | void *mat = is_vm ? viewmodel_material() : chams_material(); | 288 | int style = g_chams_mat_index; |
| 289 | if (style < 0) style = 0; | ||
| 290 | if (style > 5) style = 5; | ||
| 291 | // VGUI materials do not draw skinned models: use the solid model | ||
| 292 | // shader for the viewmodel with the same flags (flat/additive). | ||
| 293 | bool vgui_style = (style == 0 || style == 2); | ||
| 294 | void *mat = (is_vm && vgui_style) ? viewmodel_material() | ||
| 295 | : chams_material(); | ||
| 296 | if (!mat) | ||
| 297 | mat = viewmodel_material(); | ||
| 289 | if (mat) { | 298 | if (mat) { |
| 290 | int style = is_vm ? 3 : g_chams_mat_index; | 299 | bool white = style == 4; |
| 291 | if (style < 0) style = 0; | ||
| 292 | if (style > 5) style = 5; | ||
| 293 | bool white = !is_vm && style == 4; | ||
| 294 | if (g_chams_walls && !is_vm) { | 300 | if (g_chams_walls && !is_vm) { |
| 295 | chams_apply(mat, true, style, white); | 301 | chams_apply(mat, true, style, white); |
| 296 | g_force_override(self, mat, 0 /* OVERRIDE_NORMAL */); | 302 | g_force_override(self, mat, 0 /* OVERRIDE_NORMAL */); |
