mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
More use of mathlib, and some small optimizations.
This commit is contained in:
parent
3d572df460
commit
1dfd2d4eaf
1 changed files with 8 additions and 10 deletions
|
@ -160,9 +160,7 @@ R_AddDynamicLights (msurface_t *surf)
|
||||||
|
|
||||||
VectorSubtract (r_dlights[lnum].origin, currententity->origin, local);
|
VectorSubtract (r_dlights[lnum].origin, currententity->origin, local);
|
||||||
dist = DotProduct (local, surf->plane->normal) - surf->plane->dist;
|
dist = DotProduct (local, surf->plane->normal) - surf->plane->dist;
|
||||||
for (i = 0; i < 3; i++)
|
VectorMA (r_dlights[lnum].origin, -dist, surf->plane->normal, impact);
|
||||||
impact[i] =
|
|
||||||
r_dlights[lnum].origin[i] - surf->plane->normal[i] * dist;
|
|
||||||
|
|
||||||
i = DotProduct (impact, surf->texinfo->vecs[0]) +
|
i = DotProduct (impact, surf->texinfo->vecs[0]) +
|
||||||
surf->texinfo->vecs[0][3] - surf->texturemins[0];
|
surf->texinfo->vecs[0][3] - surf->texturemins[0];
|
||||||
|
@ -274,11 +272,11 @@ 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++ = bound (0, *bl >> shift, 255);
|
*dest++ = min (*bl >> shift, 255);
|
||||||
bl++;
|
bl++;
|
||||||
*dest++ = bound (0, *bl >> shift, 255);
|
*dest++ = min (*bl >> shift, 255);
|
||||||
bl++;
|
bl++;
|
||||||
*dest++ = bound (0, *bl >> shift, 255);
|
*dest++ = min (*bl >> shift, 255);
|
||||||
bl++;
|
bl++;
|
||||||
*dest++ = 255;
|
*dest++ = 255;
|
||||||
}
|
}
|
||||||
|
@ -287,11 +285,11 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
|
||||||
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++ = bound (0, *bl >> shift, 255);
|
*dest++ = min (*bl >> shift, 255);
|
||||||
bl++;
|
bl++;
|
||||||
*dest++ = bound (0, *bl >> shift, 255);
|
*dest++ = min (*bl >> shift, 255);
|
||||||
bl++;
|
bl++;
|
||||||
*dest++ = bound (0, *bl >> shift, 255);
|
*dest++ = min (*bl >> shift, 255);
|
||||||
bl++;
|
bl++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,7 +301,7 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
|
||||||
t2 += *bl++;
|
t2 += *bl++;
|
||||||
t2 += *bl++;
|
t2 += *bl++;
|
||||||
t2 /= 3;
|
t2 /= 3;
|
||||||
*dest++ = bound (0, t2 >> shift, 255);
|
*dest++ = min (t2 >> shift, 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue