From 5ff58a9c6c66b8f9a3bd68d1355703270963dcae Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 28 Feb 2011 23:46:50 +0000 Subject: [PATCH] only update r_shadow_bouncegridmatrix when a texture update occurs - 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/r_shadow.c b/r_shadow.c index 971b196a..f521e93a 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -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])); -- 2.39.2