mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-22 20:11:44 +00:00
added partial r_stains
changed default of r_stains to 0.75 git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1723 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
2cd3740b2f
commit
96de3b78c3
4 changed files with 102 additions and 106 deletions
|
@ -367,7 +367,7 @@ presetinfo_t preset[] =
|
|||
{"r_presetname", {"286", "fast", "default", "nice", "realtime"}},
|
||||
{"gl_texturemode", {"nn", "ln", "ln", "ll", "ll"}},
|
||||
{"r_particlesdesc", {"none", "highfps", "spikeset", "spikeset", "spikeset"}},
|
||||
{"r_stains", {"0", "0", "1", "1", "1"}},
|
||||
{"r_stains", {"0", "0", "0.75", "0.75", "0.75"}},
|
||||
{"r_drawflat", {"1", "0", "0", "0", "0"}},
|
||||
{"r_nolerp", {"1", "1", "0", "0", "0"}},
|
||||
{"r_nolightdir", {"1", "0", "0", "0", "0"}},
|
||||
|
|
|
@ -65,7 +65,7 @@ cvar_t r_sirds = {"r_sirds", "0", NULL, CVAR_SEMICHEAT};//whack in a value of 2
|
|||
|
||||
cvar_t r_loadlits = {"r_loadlit", "1"};
|
||||
|
||||
cvar_t r_stains = {"r_stains", "1", NULL, CVAR_ARCHIVE};
|
||||
cvar_t r_stains = {"r_stains", "0.75", NULL, CVAR_ARCHIVE};
|
||||
cvar_t r_stainfadetime = {"r_stainfadetime", "1"};
|
||||
cvar_t r_stainfadeammount = {"r_stainfadeammount", "1"};
|
||||
|
||||
|
|
|
@ -80,18 +80,15 @@ void GLR_StainSurf (msurface_t *surf, float *parms)
|
|||
int i;
|
||||
int smax, tmax;
|
||||
float amm;
|
||||
int lim;
|
||||
mtexinfo_t *tex;
|
||||
stmap *stainbase;
|
||||
|
||||
lim = 255 - (bound(0, r_stains.value, 1)*255);
|
||||
|
||||
#define stain(x) \
|
||||
\
|
||||
change = stainbase[(s)*3+x] + amm*parms[4+x]; \
|
||||
stainbase[(s)*3+x] = bound(0, change, 255);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
stmap *stainbase;
|
||||
stainbase[(s)*3+x] = bound(lim, change, 255);
|
||||
|
||||
if (surf->lightmaptexturenum < 0)
|
||||
return;
|
||||
|
@ -100,59 +97,57 @@ void GLR_StainSurf (msurface_t *surf, float *parms)
|
|||
tmax = (surf->extents[1]>>4)+1;
|
||||
tex = surf->texinfo;
|
||||
|
||||
stainbase = lightmap[surf->lightmaptexturenum]->stainmaps;
|
||||
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * 3;
|
||||
stainbase = lightmap[surf->lightmaptexturenum]->stainmaps;
|
||||
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * 3;
|
||||
|
||||
rad = *parms;
|
||||
dist = DotProduct ((parms+1), surf->plane->normal) - surf->plane->dist;
|
||||
rad -= fabs(dist);
|
||||
minlight = 0;
|
||||
if (rad < minlight) //not hit
|
||||
return;
|
||||
minlight = rad - minlight;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
impact[i] = (parms+1)[i] - surf->plane->normal[i]*dist;
|
||||
}
|
||||
|
||||
rad = *parms;
|
||||
dist = DotProduct ((parms+1), surf->plane->normal) - surf->plane->dist;
|
||||
rad -= fabs(dist);
|
||||
minlight = 0;
|
||||
if (rad < minlight) //not hit
|
||||
return;
|
||||
minlight = rad - minlight;
|
||||
local[0] = DotProduct (impact, tex->vecs[0]) + tex->vecs[0][3];
|
||||
local[1] = DotProduct (impact, tex->vecs[1]) + tex->vecs[1][3];
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
local[0] -= surf->texturemins[0];
|
||||
local[1] -= surf->texturemins[1];
|
||||
|
||||
for (t = 0 ; t<tmax ; t++)
|
||||
{
|
||||
td = local[1] - t*16;
|
||||
if (td < 0)
|
||||
td = -td;
|
||||
for (s=0 ; s<smax ; s++)
|
||||
{
|
||||
impact[i] = (parms+1)[i] - 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];
|
||||
|
||||
for (t = 0 ; t<tmax ; t++)
|
||||
{
|
||||
td = local[1] - t*16;
|
||||
if (td < 0)
|
||||
td = -td;
|
||||
for (s=0 ; s<smax ; s++)
|
||||
sd = local[0] - s*16;
|
||||
if (sd < 0)
|
||||
sd = -sd;
|
||||
if (sd > td)
|
||||
dist = sd + (td>>1);
|
||||
else
|
||||
dist = td + (sd>>1);
|
||||
if (dist < minlight)
|
||||
{
|
||||
sd = local[0] - s*16;
|
||||
if (sd < 0)
|
||||
sd = -sd;
|
||||
if (sd > td)
|
||||
dist = sd + (td>>1);
|
||||
else
|
||||
dist = td + (sd>>1);
|
||||
if (dist < minlight)
|
||||
{
|
||||
amm = (rad - dist);
|
||||
stain(0);
|
||||
stain(1);
|
||||
stain(2);
|
||||
amm = (rad - dist);
|
||||
stain(0);
|
||||
stain(1);
|
||||
stain(2);
|
||||
|
||||
surf->stained = true;
|
||||
}
|
||||
surf->stained = true;
|
||||
}
|
||||
stainbase += 3*LMBLOCK_WIDTH;
|
||||
}
|
||||
stainbase += 3*LMBLOCK_WIDTH;
|
||||
}
|
||||
|
||||
if (surf->stained)
|
||||
surf->cached_dlight=-1;
|
||||
if (surf->stained)
|
||||
surf->cached_dlight=-1;
|
||||
}
|
||||
|
||||
//combination of R_AddDynamicLights and R_MarkLights
|
||||
|
@ -241,7 +236,7 @@ void GLR_AddStain(vec3_t org, float red, float green, float blue, float radius)
|
|||
int i;
|
||||
|
||||
float parms[7];
|
||||
if (!cl.worldmodel || !r_stains.value)
|
||||
if (!cl.worldmodel || r_stains.value <= 0)
|
||||
return;
|
||||
parms[0] = radius;
|
||||
parms[1] = org[0];
|
||||
|
@ -294,7 +289,7 @@ void GLR_LessenStains(void)
|
|||
|
||||
static float time;
|
||||
|
||||
if (!r_stains.value)
|
||||
if (r_stains.value <= 0)
|
||||
return;
|
||||
|
||||
time += host_frametime;
|
||||
|
@ -953,7 +948,7 @@ store:
|
|||
blg = greenblklights;
|
||||
blb = blueblklights;
|
||||
|
||||
if (!r_stains.value)
|
||||
if (r_stains.value <= 0)
|
||||
isstained = false;
|
||||
else
|
||||
isstained = surf->stained;
|
||||
|
@ -1112,7 +1107,7 @@ store:
|
|||
blg = greenblklights;
|
||||
blb = blueblklights;
|
||||
|
||||
if (!r_stains.value)
|
||||
if (r_stains.value <= 0)
|
||||
isstained = false;
|
||||
else
|
||||
isstained = surf->stained;
|
||||
|
@ -1306,7 +1301,7 @@ store:
|
|||
blg = greenblklights;
|
||||
blb = blueblklights;
|
||||
|
||||
if (!r_stains.value)
|
||||
if (r_stains.value <= 0)
|
||||
isstained = false;
|
||||
else
|
||||
isstained = surf->stained;
|
||||
|
@ -1465,7 +1460,7 @@ store:
|
|||
blg = greenblklights;
|
||||
blb = blueblklights;
|
||||
|
||||
if (!r_stains.value)
|
||||
if (r_stains.value <= 0)
|
||||
isstained = false;
|
||||
else
|
||||
isstained = surf->stained;
|
||||
|
|
|
@ -101,69 +101,70 @@ void SWR_StainSurf (msurface_t *surf, float *parms)
|
|||
int i;
|
||||
int smax, tmax;
|
||||
float amm;
|
||||
int lim;
|
||||
mtexinfo_t *tex;
|
||||
|
||||
stmap *stainbase;
|
||||
|
||||
lim = 255 - (bound(0, r_stains.value, 1)*255);
|
||||
|
||||
smax = (surf->extents[0]>>4)+1;
|
||||
tmax = (surf->extents[1]>>4)+1;
|
||||
tex = surf->texinfo;
|
||||
|
||||
stainbase = stainmaps + surf->lightmaptexturenum*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
|
||||
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s);
|
||||
stainbase = stainmaps + surf->lightmaptexturenum*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
|
||||
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s);
|
||||
|
||||
rad = *parms;
|
||||
dist = DotProduct ((parms+1), surf->plane->normal) - surf->plane->dist;
|
||||
rad -= fabs(dist);
|
||||
minlight = 0;
|
||||
if (rad < minlight) //not hit
|
||||
return;
|
||||
minlight = rad - minlight;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
impact[i] = (parms+1)[i] - surf->plane->normal[i]*dist;
|
||||
}
|
||||
|
||||
rad = *parms;
|
||||
dist = DotProduct ((parms+1), surf->plane->normal) - surf->plane->dist;
|
||||
rad -= fabs(dist);
|
||||
minlight = 0;
|
||||
if (rad < minlight) //not hit
|
||||
return;
|
||||
minlight = rad - minlight;
|
||||
local[0] = DotProduct (impact, tex->vecs[0]) + tex->vecs[0][3];
|
||||
local[1] = DotProduct (impact, tex->vecs[1]) + tex->vecs[1][3];
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
local[0] -= surf->texturemins[0];
|
||||
local[1] -= surf->texturemins[1];
|
||||
|
||||
for (t = 0 ; t<tmax ; t++)
|
||||
{
|
||||
td = local[1] - t*16;
|
||||
if (td < 0)
|
||||
td = -td;
|
||||
for (s=0 ; s<smax ; s++)
|
||||
{
|
||||
impact[i] = (parms+1)[i] - 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];
|
||||
|
||||
for (t = 0 ; t<tmax ; t++)
|
||||
{
|
||||
td = local[1] - t*16;
|
||||
if (td < 0)
|
||||
td = -td;
|
||||
for (s=0 ; s<smax ; s++)
|
||||
sd = local[0] - s*16;
|
||||
if (sd < 0)
|
||||
sd = -sd;
|
||||
if (sd > td)
|
||||
dist = sd + (td>>1);
|
||||
else
|
||||
dist = td + (sd>>1);
|
||||
if (dist < minlight)
|
||||
{
|
||||
sd = local[0] - s*16;
|
||||
if (sd < 0)
|
||||
sd = -sd;
|
||||
if (sd > td)
|
||||
dist = sd + (td>>1);
|
||||
else
|
||||
dist = td + (sd>>1);
|
||||
if (dist < minlight)
|
||||
{
|
||||
amm = stainbase[(s)] - (dist - rad)*parms[4];
|
||||
stainbase[(s)] = bound(0, amm, 255);
|
||||
amm = stainbase[(s)] - (dist - rad)*parms[4];
|
||||
stainbase[(s)] = bound(lim, amm, 255);
|
||||
|
||||
surf->stained = true;
|
||||
}
|
||||
surf->stained = true;
|
||||
}
|
||||
stainbase += LMBLOCK_WIDTH;
|
||||
}
|
||||
stainbase += LMBLOCK_WIDTH;
|
||||
}
|
||||
|
||||
if (surf->stained)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
if (surf->cachespots[i])
|
||||
surf->cachespots[i]->dlight = -1;
|
||||
}
|
||||
if (surf->stained)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
if (surf->cachespots[i])
|
||||
surf->cachespots[i]->dlight = -1;
|
||||
}
|
||||
}
|
||||
|
||||
//combination of R_AddDynamicLights and R_MarkLights
|
||||
|
@ -216,7 +217,7 @@ void SWR_AddStain(vec3_t org, float red, float green, float blue, float radius)
|
|||
|
||||
if (red != green && red != blue) //sw only does luminance of stain maps
|
||||
return; //a mix would look wrong.
|
||||
if (!r_stains.value || !cl.worldmodel)
|
||||
if (r_stains.value <= 0 || !cl.worldmodel)
|
||||
return;
|
||||
parms[0] = radius;
|
||||
parms[1] = org[0];
|
||||
|
@ -259,7 +260,7 @@ void SWR_LessenStains(void)
|
|||
|
||||
static float time;
|
||||
|
||||
if (!r_stains.value || cl.paused)
|
||||
if (r_stains.value <= 0 || cl.paused)
|
||||
{
|
||||
time = 0;
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue