]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Enable depth test for skybox
authoruis <uis9936@gmail.com>
Tue, 2 Jan 2024 18:21:08 +0000 (21:21 +0300)
committeruis <uis9936@gmail.com>
Tue, 2 Jan 2024 18:21:08 +0000 (21:21 +0300)
gl_rmain.c
r_sky.c

index 7b2c7ac6f95677930af4cf7c6ce79a352df1eeda..cfcb39276ad1bf6aa2e13bac9998b20c88026dc4 100644 (file)
@@ -7257,26 +7257,6 @@ void R_RenderScene(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture)
                // don't let sound skip if going slow
                if (r_refdef.scene.extraupdate)
                        S_ExtraUpdate ();
-
-               if (r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->DrawSky)
-               {
-                       r_refdef.scene.worldmodel->DrawSky(r_refdef.scene.worldentity);
-                       if (r_timereport_active)
-                               R_TimeReport("worldsky");
-               }
-
-               if (R_DrawBrushModelsSky() && r_timereport_active)
-                       R_TimeReport("bmodelsky");
-
-               if (skyrendermasked && skyrenderlater)
-               {
-                       // we have to force off the water clipping plane while rendering sky
-                       R_SetupView(false, fbo, depthtexture, colortexture);
-                       R_Sky();
-                       R_SetupView(true, fbo, depthtexture, colortexture);
-                       if (r_timereport_active)
-                               R_TimeReport("sky");
-               }
        }
 
        R_Shadow_PrepareModelShadows();
@@ -7330,6 +7310,30 @@ void R_RenderScene(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture)
        if (r_refdef.scene.extraupdate)
                S_ExtraUpdate ();
 
+       if (cl.csqc_vidvars.drawworld)
+       {
+               // don't let sound skip if going slow
+               if (r_refdef.scene.worldmodel && r_refdef.scene.worldmodel->DrawSky)
+               {
+                       r_refdef.scene.worldmodel->DrawSky(r_refdef.scene.worldentity);
+                       if (r_timereport_active)
+                               R_TimeReport("worldsky");
+               }
+
+               if (R_DrawBrushModelsSky() && r_timereport_active)
+                       R_TimeReport("bmodelsky");
+
+               if (skyrendermasked && skyrenderlater)
+               {
+                       // we have to force off the water clipping plane while rendering sky
+                       R_SetupView(false, fbo, depthtexture, colortexture);
+                       R_Sky();
+                       R_SetupView(true, fbo, depthtexture, colortexture);
+                       if (r_timereport_active)
+                               R_TimeReport("sky");
+               }
+       }
+
        if ((r_shadows.integer == 1 || (r_shadows.integer > 0 && !shadowmapping)) && !r_shadows_drawafterrtlighting.integer && r_refdef.scene.lightmapintensity > 0)
        {
                R_ResetViewRendering3D(fbo, depthtexture, colortexture);
diff --git a/r_sky.c b/r_sky.c
index 17754782640d899399fe729128c639de793cb2ac..ea884b985f9729da733236b337e9bcfae0f6ee26 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -308,7 +308,7 @@ static void R_SkyBox(void)
        RSurf_ActiveCustomEntity(&skymatrix, &skyinversematrix, 0, 0, 1, 1, 1, 1, 6*4, skyboxvertex3f, skyboxtexcoord2f, NULL, NULL, NULL, NULL, 6*2, skyboxelement3i, skyboxelement3s, false, false);
        for (i = 0;i < 6;i++)
                if(skyboxskinframe[i])
-                       R_DrawCustomSurface(skyboxskinframe[i], &identitymatrix, MATERIALFLAG_SKY | MATERIALFLAG_FULLBRIGHT | MATERIALFLAG_NOCULLFACE | MATERIALFLAG_NODEPTHTEST, i*4, 4, i*2, 2, false, false);
+                       R_DrawCustomSurface(skyboxskinframe[i], &identitymatrix, MATERIALFLAG_SKY | MATERIALFLAG_FULLBRIGHT | MATERIALFLAG_NOCULLFACE, i*4, 4, i*2, 2, false, false);
 }
 
 #define skygridx 32