From 9514ad1ae4c046014c7180682767ad56c43baea8 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 7 Mar 2022 08:40:39 +0900 Subject: [PATCH] [gl] Draw sky chains before brush entities Drawing sky chains first ensures that sky surfaces correctly block parts of the map that should not be visible (by writing the correct depth to the depth buffer when doing box or dome skies). Writing brush models first means that the models (ammo boxes etc) could be visible when they should not be. --- libs/video/renderer/gl/gl_rsurf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/video/renderer/gl/gl_rsurf.c b/libs/video/renderer/gl/gl_rsurf.c index 5d32d9c5e..8a131ff44 100644 --- a/libs/video/renderer/gl/gl_rsurf.c +++ b/libs/video/renderer/gl/gl_rsurf.c @@ -739,6 +739,11 @@ gl_R_DrawWorld (void) bctx.entity = &r_worldentity; R_VisitWorldNodes (&bctx); + + gl_R_CalcLightmaps (); + + gl_R_DrawSkyChain (sky_chain); + if (r_drawentities->int_val) { for (size_t i = 0; i < r_ent_queue->ent_queues[mod_brush].size; i++) { \ entity_t *ent = r_ent_queue->ent_queues[mod_brush].a[i]; \ @@ -746,10 +751,6 @@ gl_R_DrawWorld (void) } } - gl_R_CalcLightmaps (); - - gl_R_DrawSkyChain (sky_chain); - if (!gl_Fog_GetDensity () || (gl_fb_bmodels->int_val && gl_mtex_fullbright) || gl_mtex_active_tmus > 1) {