mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-22 09:11:33 +00:00
files/light: rearrange light code
This commit is contained in:
parent
f3ae3beacd
commit
eb566c3b70
1 changed files with 18 additions and 11 deletions
|
@ -297,20 +297,19 @@ R_AddDynamicLights(const msurface_t *surf, const refdef_t *r_newrefdef,
|
||||||
float *s_blocklights, const float *s_blocklights_max)
|
float *s_blocklights, const float *s_blocklights_max)
|
||||||
{
|
{
|
||||||
int lnum;
|
int lnum;
|
||||||
float fdist, frad, fminlight;
|
|
||||||
vec3_t impact, local;
|
|
||||||
int t;
|
|
||||||
int i;
|
|
||||||
int smax, tmax;
|
int smax, tmax;
|
||||||
dlight_t *dl;
|
|
||||||
float *plightdest;
|
|
||||||
float fsacc, ftacc;
|
|
||||||
|
|
||||||
smax = (surf->extents[0] >> surf->lmshift) + 1;
|
smax = (surf->extents[0] >> surf->lmshift) + 1;
|
||||||
tmax = (surf->extents[1] >> surf->lmshift) + 1;
|
tmax = (surf->extents[1] >> surf->lmshift) + 1;
|
||||||
|
|
||||||
for (lnum = 0; lnum < r_newrefdef->num_dlights; lnum++)
|
for (lnum = 0; lnum < r_newrefdef->num_dlights; lnum++)
|
||||||
{
|
{
|
||||||
|
float ftacc, fdist, frad, fminlight;
|
||||||
|
vec3_t impact, local;
|
||||||
|
float *plightdest;
|
||||||
|
dlight_t *dl;
|
||||||
|
int t, i;
|
||||||
|
|
||||||
if (!(surf->dlightbits & (1 << lnum)))
|
if (!(surf->dlightbits & (1 << lnum)))
|
||||||
{
|
{
|
||||||
continue; /* not lit by this light */
|
continue; /* not lit by this light */
|
||||||
|
@ -347,6 +346,7 @@ R_AddDynamicLights(const msurface_t *surf, const refdef_t *r_newrefdef,
|
||||||
|
|
||||||
for (t = 0, ftacc = 0; t < tmax; t++, ftacc += (1 << surf->lmshift))
|
for (t = 0, ftacc = 0; t < tmax; t++, ftacc += (1 << surf->lmshift))
|
||||||
{
|
{
|
||||||
|
float fsacc;
|
||||||
int s, td;
|
int s, td;
|
||||||
|
|
||||||
td = local[1] - ftacc;
|
td = local[1] - ftacc;
|
||||||
|
@ -358,7 +358,7 @@ R_AddDynamicLights(const msurface_t *surf, const refdef_t *r_newrefdef,
|
||||||
|
|
||||||
td *= surf->lmvlen[1];
|
td *= surf->lmvlen[1];
|
||||||
|
|
||||||
for (s = 0, fsacc = 0; s < smax; s++, fsacc += (1 << surf->lmshift), plightdest += 3)
|
for (s = 0, fsacc = 0; s < smax; s++, fsacc += (1 << surf->lmshift))
|
||||||
{
|
{
|
||||||
int sd;
|
int sd;
|
||||||
|
|
||||||
|
@ -383,10 +383,17 @@ R_AddDynamicLights(const msurface_t *surf, const refdef_t *r_newrefdef,
|
||||||
if ((fdist < fminlight) && (plightdest < (s_blocklights_max - 3)))
|
if ((fdist < fminlight) && (plightdest < (s_blocklights_max - 3)))
|
||||||
{
|
{
|
||||||
float diff = frad - fdist;
|
float diff = frad - fdist;
|
||||||
|
int j;
|
||||||
|
|
||||||
plightdest[0] += diff * dl->color[0];
|
for (j = 0; j < 3; j++)
|
||||||
plightdest[1] += diff * dl->color[1];
|
{
|
||||||
plightdest[2] += diff * dl->color[2];
|
*plightdest += diff * dl->color[j];
|
||||||
|
plightdest ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
plightdest += 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue