]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
disable water clipping plane while rendering sky, this fixes the "black
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Jan 2008 11:45:39 +0000 (11:45 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Jan 2008 11:45:39 +0000 (11:45 +0000)
sky" bug in reflection/refraction rendering

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7974 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
r_shadow.c

index 64b031dc7eaddf4e150c7cc63e0c7cffe83d5214..04ecb0ad4dc22e3ea5578b15ec94f03fc29468ab 100644 (file)
@@ -2565,7 +2565,7 @@ void R_View_Update(void)
        R_View_UpdateEntityVisible();
 }
 
-void R_SetupView(void)
+void R_SetupView(qboolean allowwaterclippingplane)
 {
        if (!r_refdef.view.useperspective)
                GL_SetupView_Mode_Ortho(-r_refdef.view.ortho_x, -r_refdef.view.ortho_y, r_refdef.view.ortho_x, r_refdef.view.ortho_y, -r_refdef.farclip, r_refdef.farclip);
@@ -2576,7 +2576,7 @@ void R_SetupView(void)
 
        GL_SetupView_Orientation_FromEntity(&r_refdef.view.matrix);
 
-       if (r_refdef.view.useclipplane)
+       if (r_refdef.view.useclipplane && allowwaterclippingplane)
        {
                // LordHavoc: couldn't figure out how to make this approach the
                vec_t dist = r_refdef.view.clipplane.dist - r_water_clippingplanebias.value;
@@ -2631,7 +2631,7 @@ void R_ResetViewRendering3D(void)
 
        // GL is weird because it's bottom to top, r_refdef.view.y is top to bottom
        qglViewport(r_refdef.view.x, vid.height - (r_refdef.view.y + r_refdef.view.height), r_refdef.view.width, r_refdef.view.height);CHECKGLERROR
-       R_SetupView();
+       R_SetupView(true);
        GL_Scissor(r_refdef.view.x, r_refdef.view.y, r_refdef.view.width, r_refdef.view.height);
        GL_Color(1, 1, 1, 1);
        GL_ColorMask(r_refdef.view.colormask[0], r_refdef.view.colormask[1], r_refdef.view.colormask[2], 1);
@@ -5570,7 +5570,10 @@ static void R_DrawTextureSurfaceList_Sky(int texturenumsurfaces, msurface_t **te
        if (skyrendernow)
        {
                skyrendernow = false;
+               // we have to force off the water clipping plane while rendering sky
+               R_SetupView(false);
                R_Sky();
+               R_SetupView(true);
                // restore entity matrix
                R_Mesh_Matrix(&rsurface.matrix);
        }
index 6b047852729e5632fb3d7fcdad401c1d35e11f42..6f9fea6dfd3c0913ab8207f6df8a05faa76cca4c 100644 (file)
@@ -3162,7 +3162,7 @@ void R_ShadowVolumeLighting(qboolean visible)
        R_Shadow_RenderMode_End();
 }
 
-extern void R_SetupView(void);
+extern void R_SetupView(qboolean allowwaterclippingplane);
 extern cvar_t r_shadows_throwdistance;
 void R_DrawModelShadows(void)
 {
@@ -3244,7 +3244,7 @@ void R_DrawModelShadows(void)
        R_Mesh_Draw(0, 4, 2, polygonelements, 0, 0);
 
        // restoring the perspective view is done by R_RenderScene
-       //R_SetupView();
+       //R_SetupView(true);
 
        // restore other state to normal
        R_Shadow_RenderMode_End();