fix for bug that caused transparant shadow change how a texture

rendered itself. this happened when transparent shadow ray hit a face
 with same material as where ray started.

 is this understandable? i guess not! :P
 the actual fix is just a few lines, to store material locally before
 going to trace transp shadow.
This commit is contained in:
Ton Roosendaal 2004-01-13 22:49:11 +00:00
parent 6727eb6104
commit 0d6533a48f

@ -1836,9 +1836,14 @@ int ray_trace_shadow_rad(ShadeInput *ship, ShadeResult *shr)
void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac, int mask) void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac, int mask)
{ {
Isect isec; Isect isec;
Material stored;
float fac, div=0.0, lampco[3]; float fac, div=0.0, lampco[3];
if(shi->matren->mode & MA_SHADOW_TRA) isec.mode= DDA_SHADOW_TRA; if(shi->matren->mode & MA_SHADOW_TRA) {
isec.mode= DDA_SHADOW_TRA;
/* needed to prevent shade_ray changing matren (textures) */
stored= *(shi->matren);
}
else isec.mode= DDA_SHADOW; else isec.mode= DDA_SHADOW;
shadfac[3]= 1.0; // 1=full light shadfac[3]= 1.0; // 1=full light
@ -1957,5 +1962,12 @@ void ray_shadow(ShadeInput *shi, LampRen *lar, float *shadfac, int mask)
else else
shadfac[3]= 1.0-fac/div; shadfac[3]= 1.0-fac/div;
} }
if(shi->matren->mode & MA_SHADOW_TRA) {
/* needed to prevent shade_ray changing matren (textures) */
*(shi->matren)= stored;
}
} }