]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
merged R_Shadow_Stage_LightWithShadows and R_Shadow_Stage_LightWithoutShadows to...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 23 Aug 2004 02:10:27 +0000 (02:10 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 23 Aug 2004 02:10:27 +0000 (02:10 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4361 d7cf8633-e32d-0410-b094-e92efae38249

r_shadow.c
r_shadow.h

index a209709ec1cacc82f7cdbc268dedf1c4d6d0b3a4..82d18025f07539cc8540ff7bf2e0ba0899298097 100644 (file)
@@ -908,7 +908,7 @@ void R_Shadow_Stage_ShadowVolumes(void)
        // optimize for them as noted above
 }
 
-void R_Shadow_Stage_LightWithoutShadows(void)
+void R_Shadow_Stage_Light(int shadowtest)
 {
        rmeshstate_t m;
        memset(&m, 0, sizeof(m));
@@ -923,31 +923,10 @@ void R_Shadow_Stage_LightWithoutShadows(void)
        qglDepthFunc(GL_EQUAL);
        qglCullFace(GL_FRONT); // quake is backwards, this culls back faces
        qglEnable(GL_CULL_FACE);
-       qglDisable(GL_STENCIL_TEST);
-       if (gl_support_stenciltwoside)
-               qglDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
-       qglStencilMask(~0);
-       qglStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
-       qglStencilFunc(GL_EQUAL, 128, ~0);
-       r_shadowstage = SHADOWSTAGE_LIGHT;
-       c_rt_lights++;
-}
-
-void R_Shadow_Stage_LightWithShadows(void)
-{
-       rmeshstate_t m;
-       memset(&m, 0, sizeof(m));
-       R_Mesh_State(&m);
-       GL_BlendFunc(GL_ONE, GL_ONE);
-       GL_DepthMask(false);
-       GL_DepthTest(true);
-       qglPolygonOffset(0, 0);
-       //qglDisable(GL_POLYGON_OFFSET_FILL);
-       GL_Color(1, 1, 1, 1);
-       GL_ColorMask(r_refdef.colormask[0], r_refdef.colormask[1], r_refdef.colormask[2], 1);
-       qglDepthFunc(GL_EQUAL);
-       qglCullFace(GL_FRONT); // quake is backwards, this culls back faces
-       qglEnable(GL_STENCIL_TEST);
+       if (shadowtest)
+               qglDisable(GL_STENCIL_TEST);
+       else
+               qglEnable(GL_STENCIL_TEST);
        if (gl_support_stenciltwoside)
                qglDisable(GL_STENCIL_TEST_TWO_SIDE_EXT);
        qglStencilMask(~0);
@@ -2206,10 +2185,7 @@ void R_DrawRTLight(rtlight_t *rtlight, int visiblevolumes)
 
        if (!visiblevolumes)
        {
-               if (shadow && gl_stencil)
-                       R_Shadow_Stage_LightWithShadows();
-               else
-                       R_Shadow_Stage_LightWithoutShadows();
+               R_Shadow_Stage_Light(shadow && gl_stencil);
 
                ent = &cl_entities[0].render;
                if (ent->model && ent->model->DrawLight)
index 5f6086033bda7e09657e6d8cea2a101ad94a47fe..ea8601af25ff4867fa590e1cd82d7361636f366d 100644 (file)
@@ -41,12 +41,6 @@ void R_Shadow_RenderLighting(int numverts, int numtriangles, const int *elements
 void R_Shadow_ClearStencil(void);
 
 void R_Shadow_RenderVolume(int numvertices, int numtriangles, const float *vertex3f, const int *element3i);
-void R_Shadow_Stage_Begin(void);
-void R_Shadow_LoadWorldLightsIfNeeded(void);
-void R_Shadow_Stage_ShadowVolumes(void);
-void R_Shadow_Stage_LightWithShadows(void);
-void R_Shadow_Stage_LightWithoutShadows(void);
-void R_Shadow_Stage_End(void);
 int R_Shadow_ScissorForBBox(const float *mins, const float *maxs);
 
 // these never change, they are used to create attenuation matrices