forked from bartvdbraak/blender
Fix #1207
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:
parent
d6eeceb83d
commit
97f2cf05f5
@ -1927,32 +1927,33 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
|
|||||||
|
|
||||||
if(i>0.0 && (R.r.mode & R_SHADOW)) {
|
if(i>0.0 && (R.r.mode & R_SHADOW)) {
|
||||||
if(ma->mode & MA_SHADOW) {
|
if(ma->mode & MA_SHADOW) {
|
||||||
|
if(lar->type==LA_HEMI); // no shadow
|
||||||
if(lar->shb) {
|
else {
|
||||||
shadfac[3] = testshadowbuf(lar->shb, shi->co, inp);
|
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) {
|
else if(lar->mode & LA_SHAD_RAY) {
|
||||||
// this extra 0.001 prevents boundary cases (shadow on smooth sphere)
|
// 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)
|
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);
|
ray_shadow(shi, lar, shadfac);
|
||||||
else shadfac[3]= 0.0;
|
else shadfac[3]= 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* warning, here it skips the loop */
|
/* warning, here it skips the loop */
|
||||||
if(lar->mode & LA_ONLYSHADOW) {
|
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]);
|
if(shadfac[3]==0.0) continue;
|
||||||
shr->diff[0] -= shadfac[3];
|
|
||||||
shr->diff[1] -= shadfac[3];
|
i*= shadfac[3];
|
||||||
shr->diff[2] -= shadfac[3];
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
lar->spottexfac= 1.0/(xn);
|
||||||
|
|
||||||
if(lar->mode & LA_ONLYSHADOW) {
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user