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:
TimeServ 2005-12-17 21:51:42 +00:00
parent 2cd3740b2f
commit 96de3b78c3
4 changed files with 102 additions and 106 deletions

View file

@ -367,7 +367,7 @@ presetinfo_t preset[] =
{"r_presetname", {"286", "fast", "default", "nice", "realtime"}}, {"r_presetname", {"286", "fast", "default", "nice", "realtime"}},
{"gl_texturemode", {"nn", "ln", "ln", "ll", "ll"}}, {"gl_texturemode", {"nn", "ln", "ln", "ll", "ll"}},
{"r_particlesdesc", {"none", "highfps", "spikeset", "spikeset", "spikeset"}}, {"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_drawflat", {"1", "0", "0", "0", "0"}},
{"r_nolerp", {"1", "1", "0", "0", "0"}}, {"r_nolerp", {"1", "1", "0", "0", "0"}},
{"r_nolightdir", {"1", "0", "0", "0", "0"}}, {"r_nolightdir", {"1", "0", "0", "0", "0"}},

View file

@ -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_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_stainfadetime = {"r_stainfadetime", "1"};
cvar_t r_stainfadeammount = {"r_stainfadeammount", "1"}; cvar_t r_stainfadeammount = {"r_stainfadeammount", "1"};

View file

@ -80,18 +80,15 @@ void GLR_StainSurf (msurface_t *surf, float *parms)
int i; int i;
int smax, tmax; int smax, tmax;
float amm; float amm;
int lim;
mtexinfo_t *tex; mtexinfo_t *tex;
stmap *stainbase;
lim = 255 - (bound(0, r_stains.value, 1)*255);
#define stain(x) \ #define stain(x) \
\
change = stainbase[(s)*3+x] + amm*parms[4+x]; \ change = stainbase[(s)*3+x] + amm*parms[4+x]; \
stainbase[(s)*3+x] = bound(0, change, 255); stainbase[(s)*3+x] = bound(lim, change, 255);
stmap *stainbase;
if (surf->lightmaptexturenum < 0) if (surf->lightmaptexturenum < 0)
return; return;
@ -103,8 +100,6 @@ void GLR_StainSurf (msurface_t *surf, float *parms)
stainbase = lightmap[surf->lightmaptexturenum]->stainmaps; stainbase = lightmap[surf->lightmaptexturenum]->stainmaps;
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * 3; stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * 3;
rad = *parms; rad = *parms;
dist = DotProduct ((parms+1), surf->plane->normal) - surf->plane->dist; dist = DotProduct ((parms+1), surf->plane->normal) - surf->plane->dist;
rad -= fabs(dist); rad -= fabs(dist);
@ -241,7 +236,7 @@ void GLR_AddStain(vec3_t org, float red, float green, float blue, float radius)
int i; int i;
float parms[7]; float parms[7];
if (!cl.worldmodel || !r_stains.value) if (!cl.worldmodel || r_stains.value <= 0)
return; return;
parms[0] = radius; parms[0] = radius;
parms[1] = org[0]; parms[1] = org[0];
@ -294,7 +289,7 @@ void GLR_LessenStains(void)
static float time; static float time;
if (!r_stains.value) if (r_stains.value <= 0)
return; return;
time += host_frametime; time += host_frametime;
@ -953,7 +948,7 @@ store:
blg = greenblklights; blg = greenblklights;
blb = blueblklights; blb = blueblklights;
if (!r_stains.value) if (r_stains.value <= 0)
isstained = false; isstained = false;
else else
isstained = surf->stained; isstained = surf->stained;
@ -1112,7 +1107,7 @@ store:
blg = greenblklights; blg = greenblklights;
blb = blueblklights; blb = blueblklights;
if (!r_stains.value) if (r_stains.value <= 0)
isstained = false; isstained = false;
else else
isstained = surf->stained; isstained = surf->stained;
@ -1306,7 +1301,7 @@ store:
blg = greenblklights; blg = greenblklights;
blb = blueblklights; blb = blueblklights;
if (!r_stains.value) if (r_stains.value <= 0)
isstained = false; isstained = false;
else else
isstained = surf->stained; isstained = surf->stained;
@ -1465,7 +1460,7 @@ store:
blg = greenblklights; blg = greenblklights;
blb = blueblklights; blb = blueblklights;
if (!r_stains.value) if (r_stains.value <= 0)
isstained = false; isstained = false;
else else
isstained = surf->stained; isstained = surf->stained;

View file

@ -101,10 +101,13 @@ void SWR_StainSurf (msurface_t *surf, float *parms)
int i; int i;
int smax, tmax; int smax, tmax;
float amm; float amm;
int lim;
mtexinfo_t *tex; mtexinfo_t *tex;
stmap *stainbase; stmap *stainbase;
lim = 255 - (bound(0, r_stains.value, 1)*255);
smax = (surf->extents[0]>>4)+1; smax = (surf->extents[0]>>4)+1;
tmax = (surf->extents[1]>>4)+1; tmax = (surf->extents[1]>>4)+1;
tex = surf->texinfo; tex = surf->texinfo;
@ -112,8 +115,6 @@ void SWR_StainSurf (msurface_t *surf, float *parms)
stainbase = stainmaps + surf->lightmaptexturenum*LMBLOCK_WIDTH*LMBLOCK_HEIGHT; stainbase = stainmaps + surf->lightmaptexturenum*LMBLOCK_WIDTH*LMBLOCK_HEIGHT;
stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s); stainbase += (surf->light_t * LMBLOCK_WIDTH + surf->light_s);
rad = *parms; rad = *parms;
dist = DotProduct ((parms+1), surf->plane->normal) - surf->plane->dist; dist = DotProduct ((parms+1), surf->plane->normal) - surf->plane->dist;
rad -= fabs(dist); rad -= fabs(dist);
@ -150,7 +151,7 @@ void SWR_StainSurf (msurface_t *surf, float *parms)
if (dist < minlight) if (dist < minlight)
{ {
amm = stainbase[(s)] - (dist - rad)*parms[4]; amm = stainbase[(s)] - (dist - rad)*parms[4];
stainbase[(s)] = bound(0, amm, 255); stainbase[(s)] = bound(lim, amm, 255);
surf->stained = true; surf->stained = true;
} }
@ -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 if (red != green && red != blue) //sw only does luminance of stain maps
return; //a mix would look wrong. return; //a mix would look wrong.
if (!r_stains.value || !cl.worldmodel) if (r_stains.value <= 0 || !cl.worldmodel)
return; return;
parms[0] = radius; parms[0] = radius;
parms[1] = org[0]; parms[1] = org[0];
@ -259,7 +260,7 @@ void SWR_LessenStains(void)
static float time; static float time;
if (!r_stains.value || cl.paused) if (r_stains.value <= 0 || cl.paused)
{ {
time = 0; time = 0;
return; return;