Flag for 'only shadow' was still working when lamp type switched to
Hemi. Also 'only shadow' didnt work yet for ray_shadow Spot lamp.
This commit is contained in:
Ton Roosendaal 2004-04-29 16:20:34 +00:00
parent d6eeceb83d
commit 97f2cf05f5
2 changed files with 26 additions and 25 deletions

@ -1927,32 +1927,33 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
if(i>0.0 && (R.r.mode & R_SHADOW)) {
if(ma->mode & MA_SHADOW) {
if(lar->shb) {
shadfac[3] = testshadowbuf(lar->shb, shi->co, inp);
}
else if(lar->type==LA_HEMI); // no shadow
else if(lar->mode & LA_SHAD_RAY) {
// this extra 0.001 prevents boundary cases (shadow on smooth sphere)
if((shi->vlr->n[0]*lv[0] + shi->vlr->n[1]*lv[1] + shi->vlr->n[2]*lv[2]) > -0.001)
ray_shadow(shi, lar, shadfac);
else shadfac[3]= 0.0;
}
/* warning, here it skips the loop */
if(lar->mode & LA_ONLYSHADOW) {
if(lar->type==LA_HEMI); // no shadow
else {
if(lar->shb) {
shadfac[3] = testshadowbuf(lar->shb, shi->co, inp);
}
else if(lar->mode & LA_SHAD_RAY) {
// this extra 0.001 prevents boundary cases (shadow on smooth sphere)
if((shi->vlr->n[0]*lv[0] + shi->vlr->n[1]*lv[1] + shi->vlr->n[2]*lv[2]) > -0.001)
ray_shadow(shi, lar, shadfac);
else shadfac[3]= 0.0;
}
/* warning, here it skips the loop */
if(lar->mode & LA_ONLYSHADOW) {
shadfac[3]= i*lar->energy*(1.0-shadfac[3]);
shr->diff[0] -= shadfac[3];
shr->diff[1] -= shadfac[3];
shr->diff[2] -= shadfac[3];
continue;
}
shadfac[3]= i*lar->energy*(1.0-shadfac[3]);
shr->diff[0] -= shadfac[3];
shr->diff[1] -= shadfac[3];
shr->diff[2] -= shadfac[3];
continue;
if(shadfac[3]==0.0) continue;
i*= shadfac[3];
}
if(shadfac[3]==0.0) continue;
i*= shadfac[3];
}
}

@ -1763,7 +1763,7 @@ void RE_add_render_lamp(Object *ob, int doshadbuf)
lar->spottexfac= 1.0/(xn);
if(lar->mode & LA_ONLYSHADOW) {
if((lar->mode & LA_SHAD)==0) lar->mode -= LA_ONLYSHADOW;
if((lar->mode & (LA_SHAD|LA_SHAD_RAY))==0) lar->mode -= LA_ONLYSHADOW;
}
}