Revision: 17134
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17134
Author:   broken
Date:     2008-10-21 01:12:42 +0200 (Tue, 21 Oct 2008)

Log Message:
-----------
* fix for crash after latest light cache commit

Modified Paths:
--------------
    branches/sim_physics/source/blender/render/intern/source/convertblender.c
    branches/sim_physics/source/blender/render/intern/source/volumetric.c

Modified: 
branches/sim_physics/source/blender/render/intern/source/convertblender.c
===================================================================
--- branches/sim_physics/source/blender/render/intern/source/convertblender.c   
2008-10-20 20:16:33 UTC (rev 17133)
+++ branches/sim_physics/source/blender/render/intern/source/convertblender.c   
2008-10-20 23:12:42 UTC (rev 17134)
@@ -4927,7 +4927,8 @@
                                make_sss_tree(re);
                
                if(!re->test_break())
-                       volume_precache(re);
+                       if(re->r.mode & R_RAYTRACE)
+                               volume_precache(re);
        }
        
        if(re->test_break())

Modified: branches/sim_physics/source/blender/render/intern/source/volumetric.c
===================================================================
--- branches/sim_physics/source/blender/render/intern/source/volumetric.c       
2008-10-20 20:16:33 UTC (rev 17133)
+++ branches/sim_physics/source/blender/render/intern/source/volumetric.c       
2008-10-20 23:12:42 UTC (rev 17134)
@@ -253,6 +253,12 @@
        return (1.f - t) * v1 + t * v2;
 }
 
+inline float do_lerp(float t, float a, float b) {
+       if (a > 0.f && b > 0.f) return lerp(t, a, b);
+       else if (a < 0.f)               return b;
+       else if (b < 0.f)               return a;
+}
+
 /* trilinear interpolation */
 static void vol_get_precached_scattering(ShadeInput *shi, float *scatter_col, 
float *co)
 {
@@ -587,6 +593,7 @@
        shi_new.combinedflag= 0xFFFFFF;          /* ray trace does all options 
*/
        shi_new.light_override= shi->light_override;
        shi_new.mat_override= shi->mat_override;
+       shi_new.re = shi->re;
        
        VECCOPY(shi_new.camera_co, is->start);
        
@@ -918,15 +925,19 @@
                                }
                                
                                /* don't bother if the point is not inside the 
volume mesh */
-                               if (!point_inside_obi(tree, obi, co))
-                                       continue;
+                               if (!point_inside_obi(tree, obi, co)) {
+                                       obi->volume_precache[0*res_3 + x*res_2 
+ y*res + z] = -1.0f;
+                                       obi->volume_precache[1*res_3 + x*res_2 
+ y*res + z] = -1.0f;
+                                       obi->volume_precache[2*res_3 + x*res_2 
+ y*res + z] = -1.0f;
+                               }
+                               else {
+                                       density = vol_get_density(&shi, co);
+                                       vol_get_scattering(&shi, scatter_col, 
co, stepsize, density);
                                
-                               density = vol_get_density(&shi, co);
-                               vol_get_scattering(&shi, scatter_col, co, 
stepsize, density);
-                       
-                               obi->volume_precache[0*res_3 + x*res_2 + y*res 
+ z] = scatter_col[0];
-                               obi->volume_precache[1*res_3 + x*res_2 + y*res 
+ z] = scatter_col[1];
-                               obi->volume_precache[2*res_3 + x*res_2 + y*res 
+ z] = scatter_col[2];
+                                       obi->volume_precache[0*res_3 + x*res_2 
+ y*res + z] = scatter_col[0];
+                                       obi->volume_precache[1*res_3 + x*res_2 
+ y*res + z] = scatter_col[1];
+                                       obi->volume_precache[2*res_3 + x*res_2 
+ y*res + z] = scatter_col[2];
+                               }
                        }
                }
        }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to