[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21331] branches/soc-2009-jaguarandi/ source/blender/render/intern/source/rayobject_bvh.c: *No need of a BB if the underlying structure already has a BB

André Pinto andresusanopinto at gmail.com
Fri Jul 3 04:26:41 CEST 2009


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

Log Message:
-----------
*No need of a BB if the underlying structure already has a BB

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

Modified: branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject_bvh.c
===================================================================
--- branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject_bvh.c	2009-07-03 01:57:38 UTC (rev 21330)
+++ branches/soc-2009-jaguarandi/source/blender/render/intern/source/rayobject_bvh.c	2009-07-03 02:26:40 UTC (rev 21331)
@@ -59,7 +59,7 @@
 {
 	BVHNode *child[BVH_NCHILDS];
 	float	*bb; //[6]; //[2][3];
-	char split_axis;
+	int split_axis;
 };
 
 struct BVHTree
@@ -205,23 +205,31 @@
 {
 	if(rtbuild_size(builder) == 1)
 	{
-//		return (BVHNode*)builder->begin[0];
-//
-//
-		int i;
-		BVHNode *parent = bvh_new_node(tree, nid);
-		
-		INIT_MINMAX(parent->bb, parent->bb+3);
+		RayObject *child = builder->begin[0];
 
-		for(i=0; i<1; i++)
+		if(RayObject_isRayFace(child))
 		{
-			parent->child[i] = (BVHNode*)builder->begin[i];
-			bvh_merge_bb(parent->child[i], parent->bb, parent->bb+3);
+			int i;
+			BVHNode *parent = bvh_new_node(tree, nid);
+			
+			INIT_MINMAX(parent->bb, parent->bb+3);
+
+			for(i=0; i<1; i++)
+			{
+				parent->child[i] = (BVHNode*)builder->begin[i];
+				bvh_merge_bb(parent->child[i], parent->bb, parent->bb+3);
+			}
+			for(; i<BVH_NCHILDS; i++)
+				parent->child[i] = 0;
+
+			return parent;
 		}
-		for(; i<BVH_NCHILDS; i++)
-			parent->child[i] = 0;
-
-		return parent;
+		else
+		{
+			//Its a sub-raytrace structure, assume it has it own raycast
+			//methods and adding a Bounding Box arround is unnecessary
+			return (BVHNode*)child;
+		}
 	}
 	else
 	{





More information about the Bf-blender-cvs mailing list