From bc4924ac59acbdf5c5c44c4e0046824c0e340e82 Mon Sep 17 00:00:00 2001 From: Andrei Alexeyev Date: Thu, 3 Oct 2024 20:12:39 +0200 Subject: [PATCH] stagedraw: disable face culling for 2D rendering It's never needed, and sometimes we have to re-enable it e.g. for blast particles. This lets those cases batch together with other sprites. --- src/stagedraw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/stagedraw.c b/src/stagedraw.c index 8706fc63..18126a84 100644 --- a/src/stagedraw.c +++ b/src/stagedraw.c @@ -622,6 +622,7 @@ static bool draw_powersurge_effect(Framebuffer *target_fb, BlendMode blend) { r_state_push(); r_blend(BLEND_NONE); r_disable(RCAP_DEPTH_TEST); + r_disable(RCAP_CULL_FACE); // if(player_is_powersurge_active(&global.plr)) { r_state_push(); @@ -675,6 +676,7 @@ static bool boss_distortion_rule(Framebuffer *fb) { r_state_push(); r_blend(BLEND_NONE); r_disable(RCAP_DEPTH_TEST); + r_disable(RCAP_CULL_FACE); cmplx fpos = global.boss->pos;; cmplx pos = fpos; @@ -809,6 +811,7 @@ static void stage_render_bg(StageInfo *stage) { if(should_draw_stage_bg()) { r_mat_mv_push(); r_enable(RCAP_DEPTH_TEST); + r_enable(RCAP_CULL_FACE); stage->procs->draw(); r_mat_mv_pop(); fbpair_swap(background); @@ -816,6 +819,7 @@ static void stage_render_bg(StageInfo *stage) { set_ortho(VIEWPORT_W, VIEWPORT_H); r_disable(RCAP_DEPTH_TEST); + r_disable(RCAP_CULL_FACE); apply_bg_shaders(stage->procs->shader_rules, background);