* crash fix in volume render, less reliance on global R
authorMatt Ebb <matt@mke3.net>
Sun, 11 Oct 2009 23:04:01 +0000 (23:04 +0000)
committerMatt Ebb <matt@mke3.net>
Sun, 11 Oct 2009 23:04:01 +0000 (23:04 +0000)
source/blender/render/intern/include/volume_precache.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/volume_precache.c

index 368d60ee7f003ba71635c33c653fd6d508b5aade..5c3a7bdfbf08ea07a691c971c15c36682de0c547 100644 (file)
@@ -28,6 +28,6 @@
  
 void volume_precache(Render *re);
 void free_volume_precache(Render *re);
-int point_inside_volume_objectinstance(ObjectInstanceRen *obi, float *co);
+int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, float *co);
 
 #define VOL_MS_TIMESTEP        0.1f
index 655c453eee790dc25d8c1acf60b058bbfbc06a76..af7d7a02bbafb8db5bc6a1619c20da18582fa84d 100644 (file)
@@ -3026,7 +3026,7 @@ static void init_camera_inside_volumes(Render *re)
        for(vo= re->volumes.first; vo; vo= vo->next) {
                for(obi= re->instancetable.first; obi; obi= obi->next) {
                        if (obi->obr == vo->obr) {
-                               if (point_inside_volume_objectinstance(obi, co)) {
+                               if (point_inside_volume_objectinstance(re, obi, co)) {
                                        MatInside *mi;
                                        
                                        mi = MEM_mallocN(sizeof(MatInside), "camera inside material");
@@ -4850,8 +4850,6 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
        /* MAKE RENDER DATA */
        database_init_objects(re, lay, 0, 0, 0, 0);
        
-       init_camera_inside_volumes(re);
-
        if(!re->test_break(re->tbh)) {
                int tothalo;
 
@@ -4876,6 +4874,8 @@ void RE_Database_FromScene(Render *re, Scene *scene, int use_camera_view)
                                RE_make_stars(re, NULL, NULL, NULL, NULL);
                sort_halos(re, tothalo);
                
+               init_camera_inside_volumes(re);
+               
                re->i.infostr= "Creating Shadowbuffers";
                re->stats_draw(re->sdh, &re->i);
 
index 3361eea46e7605d0e3038d87f2e25a0c4bc0627f..62d7343036ac0a7b3d0c7cfe7969016963698cfe 100644 (file)
@@ -72,7 +72,6 @@ int intersect_outside_volume(RayObject *tree, Isect *isect, float *offset, int l
        if (limit == 0) return depth;
        
        if (RE_rayobject_raycast(tree, isect)) {
-               float hitco[3];
                
                isect->start[0] = isect->start[0] + isect->labda*isect->vec[0];
                isect->start[1] = isect->start[1] + isect->labda*isect->vec[1];
@@ -730,12 +729,12 @@ void free_volume_precache(Render *re)
        BLI_freelistN(&re->volumes);
 }
 
-int point_inside_volume_objectinstance(ObjectInstanceRen *obi, float *co)
+int point_inside_volume_objectinstance(Render *re, ObjectInstanceRen *obi, float *co)
 {
        RayObject *tree;
        int inside=0;
        
-       tree = makeraytree_object(&R, obi); //create_raytree_obi(obi, obi->obr->boundbox[0], obi->obr->boundbox[1]);
+       tree = makeraytree_object(re, obi); //create_raytree_obi(obi, obi->obr->boundbox[0], obi->obr->boundbox[1]);
        if (!tree) return 0;
        
        inside = point_inside_obi(tree, obi, co);