From 23c860ab9910d089fc3ef8fbb48f786697ec7f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Wed, 17 Apr 2024 22:35:46 +0200 Subject: [PATCH] new: MODEL_CULLFACE --- bind/v4k.lua | 1 + engine/joint/v4k.h | 6 +++++- engine/split/v4k_render.c | 5 ++++- engine/split/v4k_render.h | 1 + engine/v4k.c | 5 ++++- engine/v4k.h | 1 + 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bind/v4k.lua b/bind/v4k.lua index 746072b..6eaefa0 100644 --- a/bind/v4k.lua +++ b/bind/v4k.lua @@ -1356,6 +1356,7 @@ enum MODEL_FLAGS { MODEL_MATCAPS = 16, MODEL_RIMLIGHT = 32, MODEL_PBR = 64, + MODEL_CULLFACE = 128, }; enum SHADING_MODE { SHADING_NONE, diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 1707d46..6aec453 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -17608,6 +17608,7 @@ enum MODEL_FLAGS { MODEL_MATCAPS = 16, MODEL_RIMLIGHT = 32, MODEL_PBR = 64, + MODEL_CULLFACE = 128, }; enum SHADING_MODE { @@ -386758,7 +386759,10 @@ void model_draw_call(model_t m, int shader) { handle old_shader = last_shader; shader_bind(shader); - renderstate_apply(&m.rs[model_getpass()]); + renderstate_t *rs = &m.rs[RENDER_PASS_NORMAL]; + rs->cull_face_enabled = m.flags&MODEL_CULLFACE; + + renderstate_apply(rs); glBindVertexArray( q->vao ); diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index 4da8d10..27b72d5 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -4125,7 +4125,10 @@ void model_draw_call(model_t m, int shader) { handle old_shader = last_shader; shader_bind(shader); - renderstate_apply(&m.rs[model_getpass()]); + renderstate_t *rs = &m.rs[RENDER_PASS_NORMAL]; + rs->cull_face_enabled = m.flags&MODEL_CULLFACE; + + renderstate_apply(rs); glBindVertexArray( q->vao ); diff --git a/engine/split/v4k_render.h b/engine/split/v4k_render.h index e7b67f5..a1b2d45 100644 --- a/engine/split/v4k_render.h +++ b/engine/split/v4k_render.h @@ -586,6 +586,7 @@ enum MODEL_FLAGS { MODEL_MATCAPS = 16, MODEL_RIMLIGHT = 32, MODEL_PBR = 64, + MODEL_CULLFACE = 128, }; enum SHADING_MODE { diff --git a/engine/v4k.c b/engine/v4k.c index 7f0622f..4bb1622 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -21298,7 +21298,10 @@ void model_draw_call(model_t m, int shader) { handle old_shader = last_shader; shader_bind(shader); - renderstate_apply(&m.rs[model_getpass()]); + renderstate_t *rs = &m.rs[RENDER_PASS_NORMAL]; + rs->cull_face_enabled = m.flags&MODEL_CULLFACE; + + renderstate_apply(rs); glBindVertexArray( q->vao ); diff --git a/engine/v4k.h b/engine/v4k.h index b722154..2968580 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -3675,6 +3675,7 @@ enum MODEL_FLAGS { MODEL_MATCAPS = 16, MODEL_RIMLIGHT = 32, MODEL_PBR = 64, + MODEL_CULLFACE = 128, }; enum SHADING_MODE {