Revision: 21356
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21356
Author:   jaguarandi
Date:     2009-07-03 20:16:59 +0200 (Fri, 03 Jul 2009)

Log Message:
-----------
rayobject_octree fixed

Modified Paths:
--------------
    
branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject_octree.c

Modified: 
branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject_octree.c
===================================================================
--- 
branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject_octree.c
 2009-07-03 17:44:20 UTC (rev 21355)
+++ 
branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject_octree.c
 2009-07-03 18:16:59 UTC (rev 21356)
@@ -60,7 +60,7 @@
 
 typedef struct Node
 {
-       struct RayObject *v[8];
+       struct RayFace *v[8];
        struct OcVal ov[8];
        struct Node *next;
 } Node;
@@ -79,7 +79,7 @@
        /* during building only */
        char *ocface; 
        
-       RayObject **ro_nodes;
+       RayFace **ro_nodes;
        int ro_nodes_size, ro_nodes_used;
        
 } Octree;
@@ -294,7 +294,7 @@
                while(no->v[a]!=NULL) a++;
        }
        
-       no->v[a]= (RayObject*)face;
+       no->v[a]= (RayFace*) RayObject_align(face);
        
        if(quad)
                calc_ocval_face(rtf[0], rtf[1], rtf[2], rtf[3], x>>2, y>>1, z, 
&no->ov[a]);
@@ -456,7 +456,7 @@
        
        oc->ocres = ocres;
        
-       oc->ro_nodes = MEM_callocN(sizeof(RayObject*)*size, "octree rayobject 
nodes");
+       oc->ro_nodes = (RayFace**)MEM_callocN(sizeof(RayFace*)*size, "octree 
rayobject nodes");
        oc->ro_nodes_size = size;
        oc->ro_nodes_used = 0;
 
@@ -469,8 +469,9 @@
 {
        Octree *oc = (Octree*)tree;
 
+       assert( RayObject_isRayFace(node) );
        assert( oc->ro_nodes_used < oc->ro_nodes_size );
-       oc->ro_nodes[ oc->ro_nodes_used++ ] = node;     
+       oc->ro_nodes[ oc->ro_nodes_used++ ] = (RayFace*)RayObject_align(node);
 }
 
 static void octree_fill_rayface(Octree *oc, RayFace *face)
@@ -601,7 +602,7 @@
        
        /* Calculate Bounding Box */
        for(c=0; c<oc->ro_nodes_used; c++)
-               RE_rayobject_merge_bb(oc->ro_nodes[c], oc->min, oc->max);
+               RE_rayobject_merge_bb( 
RayObject_unalignRayFace(oc->ro_nodes[c]), oc->min, oc->max);
                
        /* Alloc memory */
        oc->adrbranch= MEM_callocN(sizeof(void *)*BRANCH_ARRAY, "octree 
branches");
@@ -631,8 +632,7 @@
 
        for(c=0; c<oc->ro_nodes_used; c++)
        {
-               assert( RayObject_isRayFace(oc->ro_nodes[c]) );
-               octree_fill_rayface(oc, (RayFace*)oc->ro_nodes[c]);
+               octree_fill_rayface(oc, oc->ro_nodes[c]);
        }
 
        MEM_freeN(oc->ocface);
@@ -663,14 +663,14 @@
                for(; no; no = no->next)
                for(nr=0; nr<8; nr++)
                {
-                       RayObject *face = no->v[nr];
+                       RayFace *face = no->v[nr];
                        OcVal           *ov = no->ov+nr;
                        
                        if(!face) break;
                        
                        if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && 
(ov->ocz & ocval.ocz) )
                        {
-                               if( RE_rayobject_intersect(face,is) )
+                               if( RE_rayobject_intersect( 
RayObject_unalignRayFace(face),is) )
                                        return 1;
                        }
                }
@@ -682,14 +682,14 @@
                for(; no; no = no->next)
                for(nr=0; nr<8; nr++)
                {
-                       RayObject *face = no->v[nr];
+                       RayFace *face = no->v[nr];
                        OcVal           *ov = no->ov+nr;
                        
                        if(!face) break;
                        
                        if( (ov->ocx & ocval.ocx) && (ov->ocy & ocval.ocy) && 
(ov->ocz & ocval.ocz) )
                        { 
-                               if( RE_rayobject_intersect(face,is) )
+                               if( RE_rayobject_intersect( 
RayObject_unalignRayFace(face),is) )
                                        found= 1;
                        }
                }


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

Reply via email to