Some more small speedups.

Not entirely thrilled with R_BuildLightMap inside 'store:'. Macros are a pain to work around...
This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-11-04 16:57:47 +00:00
parent 3417167e7e
commit a2ed608ee7

View file

@ -118,11 +118,6 @@ R_RecursiveLightUpdate (mnode_t *node)
c--, surf++) surf->cached_dlight = true; c--, surf++) surf->cached_dlight = true;
} }
/*
R_AddDynamicLights
LordHavoc: completely rewrote this, relies on 64bit integer math...
*/
void void
R_AddDynamicLights (msurface_t *surf) R_AddDynamicLights (msurface_t *surf)
{ {
@ -255,32 +250,37 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
case 4: case 4:
for (i = 0; i < tmax; i++, dest += stride) { for (i = 0; i < tmax; i++, dest += stride) {
for (j = 0; j < smax; j++) { for (j = 0; j < smax; j++) {
dest[0] = bound(0, bl[0] >> shift, 255); *dest++ = bound (0, *bl >> shift, 255);
dest[1] = bound(0, bl[1] >> shift, 255); bl++;
dest[2] = bound(0, bl[2] >> shift, 255); *dest++ = bound (0, *bl >> shift, 255);
dest[3] = 255; bl++;
dest += lightmap_bytes; *dest++ = bound (0, *bl >> shift, 255);
bl += 3; bl++;
*dest++ = 255;
bl++;
} }
} }
break; break;
case 3: case 3:
for (i = 0; i < tmax; i++, dest += stride) { for (i = 0; i < tmax; i++, dest += stride) {
for (j = 0; j < smax; j++) { for (j = 0; j < smax; j++) {
dest[0] = bound(0, bl[0] >> shift, 255); *dest++ = bound (0, *bl >> shift, 255);
dest[1] = bound(0, bl[1] >> shift, 255); bl++;
dest[2] = bound(0, bl[2] >> shift, 255); *dest++ = bound (0, *bl >> shift, 255);
dest += lightmap_bytes; bl++;
bl += 3; *dest++ = bound (0, *bl >> shift, 255);
bl++;
} }
} }
break; break;
case 1: case 1:
for (i = 0; i < tmax; i++, dest += stride) { for (i = 0; i < tmax; i++, dest += stride) {
for (j = 0; j < smax; j++) { for (j = 0; j < smax; j++) {
t2 = (bl[0] + bl[1] + bl[2]) / 3; t2 = *bl++;
t2 += *bl++;
t2 += *bl++;
t2 /= 3;
*dest++ = bound (0, t2 >> shift, 255); *dest++ = bound (0, t2 >> shift, 255);
bl += 3;
} }
} }
break; break;