]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added clearstencil parameter to R_Shadow_RenderMode_StencilShadowVolumes
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 7 Apr 2007 08:09:47 +0000 (08:09 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 7 Apr 2007 08:09:47 +0000 (08:09 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7069 d7cf8633-e32d-0410-b094-e92efae38249

r_shadow.c
r_shadow.h

index 0959b37be8d3bcbda5ef0d8d6a1111bc01f7a758..61c23ec11d5c030d8e897290d0b937e4f02ca72b 100644 (file)
@@ -1062,7 +1062,7 @@ void R_Shadow_RenderMode_Reset(void)
        GL_BlendFunc(GL_ONE, GL_ZERO);
 }
 
-void R_Shadow_RenderMode_StencilShadowVolumes(void)
+void R_Shadow_RenderMode_StencilShadowVolumes(qboolean clearstencil)
 {
        CHECKGLERROR
        R_Shadow_RenderMode_Reset();
@@ -1088,7 +1088,8 @@ void R_Shadow_RenderMode_StencilShadowVolumes(void)
                qglStencilMask(~0);CHECKGLERROR
                qglStencilOp(GL_KEEP, GL_DECR, GL_KEEP);CHECKGLERROR
        }
-       GL_Clear(GL_STENCIL_BUFFER_BIT);
+       if (clearstencil)
+               GL_Clear(GL_STENCIL_BUFFER_BIT);
        r_refdef.stats.lights_clears++;
 }
 
@@ -2918,7 +2919,7 @@ void R_DrawRTLight(rtlight_t *rtlight, qboolean visible)
                if (gl_stencil)
                {
                        usestencil = true;
-                       R_Shadow_RenderMode_StencilShadowVolumes();
+                       R_Shadow_RenderMode_StencilShadowVolumes(true);
                        if (numsurfaces)
                                R_Shadow_DrawWorldShadow(numsurfaces, surfacelist, shadowtrispvs);
                        for (i = 0;i < numshadowentities;i++)
@@ -3018,7 +3019,7 @@ void R_DrawModelShadows(void)
        else
                r_shadow_shadowingrendermode = R_SHADOW_RENDERMODE_STENCIL;
 
-       R_Shadow_RenderMode_StencilShadowVolumes();
+       R_Shadow_RenderMode_StencilShadowVolumes(true);
 
        for (i = 0;i < r_refdef.numentities;i++)
        {
index 963dc5d5ce42d151cfe81e12be3d3ef8e3466527..724a79173d947f7c2fba53365d712ebc2dcb4971 100644 (file)
@@ -44,7 +44,7 @@ void R_Shadow_RenderLighting(int firstvertex, int numvertices, int numtriangles,
 void R_Shadow_RenderMode_Begin(void);
 void R_Shadow_RenderMode_ActiveLight(rtlight_t *rtlight);
 void R_Shadow_RenderMode_Reset(void);
-void R_Shadow_RenderMode_StencilShadowVolumes(void);
+void R_Shadow_RenderMode_StencilShadowVolumes(qboolean clearstencil);
 void R_Shadow_RenderMode_Lighting(qboolean stenciltest, qboolean transparent);
 void R_Shadow_RenderMode_VisibleShadowVolumes(void);
 void R_Shadow_RenderMode_VisibleLighting(qboolean stenciltest, qboolean transparent);