]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
only update r_shadow_bouncegridmatrix when a texture update occurs -
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 28 Feb 2011 23:46:50 +0000 (23:46 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 28 Feb 2011 23:46:50 +0000 (23:46 +0000)
otherwise it can render very weirdly while moving if the updateinterval
is greater than the frametime

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

r_shadow.c

index 971b196afbe5893f389890e6679950f634373501..f521e93ab38c3304689a7d7ab508bbd46fe8d8ec 100644 (file)
@@ -2365,6 +2365,10 @@ static void R_Shadow_UpdateBounceGridTexture(void)
                mins[2] = floor(r_refdef.view.origin[2] * ispacing[2] + 0.5f) * spacing[2] - 0.5f * size[2];
                VectorAdd(mins, size, maxs);
        }
+       r_shadow_bouncegridintensity = r_shadow_bouncegrid_intensity.value;
+       if (r_shadow_bouncegridtexture && realtime < r_shadow_bouncegridtime + r_shadow_bouncegrid_updateinterval.value && resolution[0] == r_shadow_bouncegridresolution[0] && resolution[1] == r_shadow_bouncegridresolution[1] && resolution[2] == r_shadow_bouncegridresolution[2])
+               return;
+       // we're going to update the bouncegrid, update the matrix...
        memset(m, 0, sizeof(m));
        m[0] = 1.0f / size[0];
        m[3] = -mins[0] * m[0];
@@ -2374,9 +2378,6 @@ static void R_Shadow_UpdateBounceGridTexture(void)
        m[11] = -mins[2] * m[10];
        m[15] = 1.0f;
        Matrix4x4_FromArrayFloatD3D(&r_shadow_bouncegridmatrix, m);
-       r_shadow_bouncegridintensity = r_shadow_bouncegrid_intensity.value;
-       if (r_shadow_bouncegridtexture && realtime < r_shadow_bouncegridtime + r_shadow_bouncegrid_updateinterval.value && resolution[0] == r_shadow_bouncegridresolution[0] && resolution[1] == r_shadow_bouncegridresolution[1] && resolution[2] == r_shadow_bouncegridresolution[2])
-               return;
        numpixels = resolution[0]*resolution[1]*resolution[2];
        // allocate pixels for this update...
        pixels = (unsigned char *)Mem_Alloc(r_main_mempool, numpixels * sizeof(unsigned char[4]));