From f1642be0e40af9c3c474add2714b898318cfa796 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 18:48:52 +0100 Subject: 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. --- src/studio.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') 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, bool is_npc = esp_is_npc_index(idx); bool is_vm = g_chams_viewmodel && esp_is_viewmodel_index(idx); if (is_npc || is_vm) { - void *mat = is_vm ? viewmodel_material() : chams_material(); + int style = g_chams_mat_index; + if (style < 0) style = 0; + if (style > 5) style = 5; + // VGUI materials do not draw skinned models: use the solid model + // shader for the viewmodel with the same flags (flat/additive). + bool vgui_style = (style == 0 || style == 2); + void *mat = (is_vm && vgui_style) ? viewmodel_material() + : chams_material(); + if (!mat) + mat = viewmodel_material(); if (mat) { - int style = is_vm ? 3 : g_chams_mat_index; - if (style < 0) style = 0; - if (style > 5) style = 5; - bool white = !is_vm && style == 4; + bool white = style == 4; if (g_chams_walls && !is_vm) { chams_apply(mat, true, style, white); g_force_override(self, mat, 0 /* OVERRIDE_NORMAL */); -- cgit v1.2.3