=Render Bugfix=

Previous bugfix of spec not being included in only shadow lamps had 2 errors.
There weren't any checks for if shi->spec and shi->shad go below 0 because of
an only shadow lamp, and also the code for including spec in only shadow lamps
was slightly wrong.
This commit is contained in:
2007-07-31 05:27:41 +00:00
parent ab4af04a10
commit 2e6624a2b8

View File

@@ -1252,9 +1252,10 @@ static void shade_one_light(LampRen *lar, ShadeInput *shi, ShadeResult *shr, int
shr->shad[1] -= shadfac[3]*shi->g;
shr->shad[2] -= shadfac[3]*shi->b;
shr->spec[0] -= shadfac[3]*shi->r;
shr->spec[1] -= shadfac[3]*shi->g;
shr->spec[2] -= shadfac[3]*shi->b;
shr->spec[0] -= shadfac[3]*shi->specr;
shr->spec[1] -= shadfac[3]*shi->specg;
shr->spec[2] -= shadfac[3]*shi->specb;
return;
}
@@ -1512,6 +1513,16 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
shade_one_light(lar, shi, shr, passflag);
}
/*this check is to prevent only shadow lamps from producing negative
colors.*/
if (shr->spec[0] < 0) shr->spec[0] = 0;
if (shr->spec[1] < 0) shr->spec[1] = 0;
if (shr->spec[2] < 0) shr->spec[2] = 0;
if (shr->shad[0] < 0) shr->shad[0] = 0;
if (shr->shad[1] < 0) shr->shad[1] = 0;
if (shr->shad[2] < 0) shr->shad[2] = 0;
if(ma->sss_flag & MA_DIFF_SSS) {
float sss[3], col[3], texfac= ma->sss_texfac;