[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17134] branches/sim_physics/source/ blender/render/intern/source: * fix for crash after latest light cache commit

Matt Ebb matt at mke3.net
Tue Oct 21 01:12:42 CEST 2008


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];
+				}
 			}
 		}
 	}





More information about the Bf-blender-cvs mailing list