mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
soft: update light code
This commit is contained in:
parent
214556728d
commit
23ff8f6dea
1 changed files with 10 additions and 11 deletions
|
@ -55,18 +55,16 @@ RI_AddDynamicLights(const msurface_t *surf)
|
|||
/* TODO: Covert to reuse with shared files/light */
|
||||
int lnum;
|
||||
int smax, tmax;
|
||||
mtexinfo_t *tex;
|
||||
|
||||
smax = (surf->extents[0] >> surf->lmshift) + 1;
|
||||
tmax = (surf->extents[1] >> surf->lmshift) + 1;
|
||||
|
||||
if (blocklight_max <= blocklights + smax*tmax*3)
|
||||
{
|
||||
r_outoflights = true;
|
||||
return;
|
||||
}
|
||||
|
||||
tex = surf->texinfo;
|
||||
|
||||
for (lnum=0; lnum < r_newrefdef.num_dlights; lnum++)
|
||||
{
|
||||
vec3_t impact, local, color;
|
||||
|
@ -118,16 +116,13 @@ RI_AddDynamicLights(const msurface_t *surf)
|
|||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
impact[i] = dl->origin[i] -
|
||||
surf->plane->normal[i] * dist;
|
||||
surf->plane->normal[i] * dist;
|
||||
}
|
||||
|
||||
local[0] = DotProduct(impact, tex->vecs[0]) +
|
||||
tex->vecs[0][3];
|
||||
local[1] = DotProduct(impact, tex->vecs[1]) +
|
||||
tex->vecs[1][3];
|
||||
|
||||
local[0] -= surf->texturemins[0];
|
||||
local[1] -= surf->texturemins[1];
|
||||
local[0] = DotProduct(impact, surf->lmvecs[0]) +
|
||||
surf->lmvecs[0][3] - surf->texturemins[0];
|
||||
local[1] = DotProduct(impact, surf->lmvecs[1]) +
|
||||
surf->lmvecs[1][3] - surf->texturemins[1];
|
||||
|
||||
for (t = 0; t < tmax; t++)
|
||||
{
|
||||
|
@ -139,6 +134,8 @@ RI_AddDynamicLights(const msurface_t *surf)
|
|||
td = -td;
|
||||
}
|
||||
|
||||
td *= surf->lmvlen[1];
|
||||
|
||||
for (s = 0; s < smax; s++)
|
||||
{
|
||||
int sd;
|
||||
|
@ -150,6 +147,8 @@ RI_AddDynamicLights(const msurface_t *surf)
|
|||
sd = -sd;
|
||||
}
|
||||
|
||||
sd *= surf->lmvlen[0];
|
||||
|
||||
if (sd > td)
|
||||
{
|
||||
dist = sd + (td >> 1);
|
||||
|
|
Loading…
Reference in a new issue