Skip to content

Commit

Permalink
stagedraw: disable face culling for 2D rendering
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Akaricchi committed Oct 3, 2024
1 parent 08aa5a0 commit 113fdbe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/stagedraw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -809,13 +811,15 @@ 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);
}

set_ortho(VIEWPORT_W, VIEWPORT_H);
r_disable(RCAP_DEPTH_TEST);
r_disable(RCAP_CULL_FACE);

apply_bg_shaders(stage->procs->shader_rules, background);

Expand Down

0 comments on commit 113fdbe

Please sign in to comment.