svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22668:22701
[blender.git] / source / blender / render / intern / source / shadeoutput.c
index 4c627056c1dcfb04f8eaf7784857a709b614db67..d5c8cf30b3000ec13466bd393144198012f1c701 100644 (file)
@@ -61,12 +61,14 @@ extern struct Render R;
 static ListBase *get_lights(ShadeInput *shi)
 {
        
+       if(R.r.scemode & R_PREVIEWBUTS)
+               return &R.lights;
        if(shi->light_override)
                return &shi->light_override->gobject;
-       else if(shi->mat && shi->mat->group)
+       if(shi->mat && shi->mat->group)
                return &shi->mat->group->gobject;
-       else
-               return &R.lights;
+       
+       return &R.lights;
 }
 
 #if 0
@@ -1005,6 +1007,7 @@ static void do_specular_ramp(ShadeInput *shi, float is, float t, float *spec)
 }
 
 /* pure AO, check for raytrace and world should have been done */
+/* 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) && shi->mat->amb!=0.0f)
@@ -1020,8 +1023,8 @@ void ambient_occlusion(ShadeInput *shi)
 void ambient_occlusion_to_diffuse(ShadeInput *shi, float *diff)
 {
        if((R.r.mode & R_RAYTRACE) || R.wrld.ao_gather_method == WO_AOGATHER_APPROX) {
-               if(shi->mat->amb!=0.0f) {
-                       float f= R.wrld.aoenergy*shi->mat->amb;
+               if(shi->amb!=0.0f) {
+                       float f= R.wrld.aoenergy*shi->amb;
 
                        if (R.wrld.aomix==WO_AOADDSUB) {
                                diff[0] = 2.0f*shi->ao[0]-1.0f;
@@ -1710,7 +1713,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
                        shi->alpha*= fresnel_fac(shi->view, shi->vn, ma->fresnel_tra_i, ma->fresnel_tra);
                        
                /* note: shi->mode! */
-               if(shi->mode & (MA_ZTRA|MA_RAYTRANSP)) {
+               if(shi->mode & MA_TRANSP) {
                        if(shi->spectra!=0.0f) {
                                float t = MAX3(shr->spec[0], shr->spec[1], shr->spec[2]);
                                t *= shi->spectra;
@@ -1727,11 +1730,12 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
                shr->combined[1]+= shi->ambg;
                shr->combined[2]+= shi->ambb;
 
+               /* removed
                if(shi->combinedflag & SCE_PASS_RADIO) {
                        shr->combined[0]+= shi->r*shi->amb*shi->rad[0];
                        shr->combined[1]+= shi->g*shi->amb*shi->rad[1];
                        shr->combined[2]+= shi->b*shi->amb*shi->rad[2];
-               }
+               }*/
                
                /* add AO in combined? */
                if(R.wrld.mode & WO_AMB_OCC) {