Fix #30081: the fix for #30026 related to rendering indirect/environment light

with material ambient zero broke backwards compatibility too much. The behavior
to have ambient zero affect things even if it is not used as a factor does not
make much sense but keeps things compatible. Now instead fixed the use of
uninitialized memory.
This commit is contained in:
Brecht Van Lommel
2012-02-07 21:04:10 +00:00
parent 54c7f374c8
commit 9467ddb903

View File

@@ -1030,12 +1030,17 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float spec[3])
/* preprocess, textures were not done, don't use shi->amb for that reason */
void ambient_occlusion(ShadeInput *shi)
{
if(R.wrld.ao_gather_method == WO_AOGATHER_APPROX)
if((R.wrld.ao_gather_method == WO_AOGATHER_APPROX) && shi->mat->amb!=0.0f) {
sample_occ(&R, shi);
else if(R.r.mode & R_RAYTRACE)
}
else if((R.r.mode & R_RAYTRACE) && shi->mat->amb!=0.0f) {
ray_ao(shi, shi->ao, shi->env);
else
}
else {
shi->ao[0]= shi->ao[1]= shi->ao[2]= 1.0f;
zero_v3(shi->env);
zero_v3(shi->indirect);
}
}