From 1bb2bc370d250101baf048a6edd1cc349aa996e9 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 9 Jul 2015 22:28:08 -0500 Subject: [PATCH] Fix OpenGL2 ignoring last light grid point on each axis Also change light grid bounds clamping to make it more clear what invalid values are. --- code/renderergl1/tr_light.c | 2 +- code/renderergl2/tr_light.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/renderergl1/tr_light.c b/code/renderergl1/tr_light.c index fc6af6a9..0d0a5da4 100644 --- a/code/renderergl1/tr_light.c +++ b/code/renderergl1/tr_light.c @@ -151,7 +151,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) { frac[i] = v - pos[i]; if ( pos[i] < 0 ) { pos[i] = 0; - } else if ( pos[i] >= tr.world->lightGridBounds[i] - 1 ) { + } else if ( pos[i] > tr.world->lightGridBounds[i] - 1 ) { pos[i] = tr.world->lightGridBounds[i] - 1; } } diff --git a/code/renderergl2/tr_light.c b/code/renderergl2/tr_light.c index e95fecd0..faaa8dd3 100644 --- a/code/renderergl2/tr_light.c +++ b/code/renderergl2/tr_light.c @@ -156,7 +156,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent, world_t *world ) { frac[i] = v - pos[i]; if ( pos[i] < 0 ) { pos[i] = 0; - } else if ( pos[i] >= world->lightGridBounds[i] - 1 ) { + } else if ( pos[i] > world->lightGridBounds[i] - 1 ) { pos[i] = world->lightGridBounds[i] - 1; } } @@ -189,7 +189,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent, world_t *world ) { ignore = qfalse; for ( j = 0 ; j < 3 ; j++ ) { if ( i & (1<= world->lightGridBounds[j] - 1) + if ((pos[j] + 1) > world->lightGridBounds[j] - 1) { ignore = qtrue; // ignore values outside lightgrid }