]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
sanity checks on shadowmap size relative to border size
authoreihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 24 Oct 2009 20:49:47 +0000 (20:49 +0000)
committereihrul <eihrul@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 24 Oct 2009 20:49:47 +0000 (20:49 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9398 d7cf8633-e32d-0410-b094-e92efae38249

gl_backend.c
r_shadow.c

index 9ef466a94e605eb96b37ee1a04caffd5f89f4c6c..f41c975e48efe1811e3ff171842483ebe0c46240 100644 (file)
@@ -546,8 +546,6 @@ void R_Viewport_InitCubeSideView(r_viewport_t *v, const matrix4x4_t *cameramatri
 void R_Viewport_InitRectSideView(r_viewport_t *v, const matrix4x4_t *cameramatrix, int side, int size, int border, float nearclip, float farclip, const float *nearplane)
 {
        matrix4x4_t tempmatrix, basematrix;
-       if (border > size - 2)
-               border = size - 2;
        memset(v, 0, sizeof(*v));
        v->type = R_VIEWPORTTYPE_PERSPECTIVECUBESIDE;
        v->cameramatrix = *cameramatrix;
index 938f28e1e1943e8062b517d1a24edefbba614e2e..000f1c191c0e3580c8574f1fdeb499874954b849 100644 (file)
@@ -4189,8 +4189,11 @@ void R_DrawRTLight(rtlight_t *rtlight, qboolean visible)
                        if ((r_shadow_shadowmapmaxsize >> i) > lodlinear)
                                r_shadow_shadowmaplod = i;
 
-               size = r_shadow_shadowmode == R_SHADOW_SHADOWMODE_SHADOWMAPCUBESIDE ? r_shadow_shadowmapmaxsize >> r_shadow_shadowmaplod : lodlinear;
-               size = bound(1, size, r_shadow_shadowmapmaxsize);
+               if (r_shadow_shadowmode == R_SHADOW_SHADOWMODE_SHADOWMAPCUBESIDE)
+                       size = max(1, r_shadow_shadowmapmaxsize >> r_shadow_shadowmaplod);
+               else
+                       size = bound(r_shadow_shadowmapborder, lodlinear, r_shadow_shadowmapmaxsize);
+                       
                borderbias = r_shadow_shadowmapborder / (float)(size - r_shadow_shadowmapborder);
 
                if (numsurfaces)