Revision: 59532
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59532
Author:   gdh
Date:     2013-08-26 17:50:16 +0000 (Mon, 26 Aug 2013)
Log Message:
-----------
Added BVH code to the add_reference_mesh() function. Now, it takes into 
account each of the steps as it makes the BoundBox for a triangle.

Modified Paths:
--------------
    branches/soc-2013-cycles_mblur/intern/cycles/bvh/bvh_build.cpp

Modified: branches/soc-2013-cycles_mblur/intern/cycles/bvh/bvh_build.cpp
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/bvh/bvh_build.cpp      
2013-08-26 16:08:03 UTC (rev 59531)
+++ branches/soc-2013-cycles_mblur/intern/cycles/bvh/bvh_build.cpp      
2013-08-26 17:50:16 UTC (rev 59532)
@@ -79,6 +79,22 @@
                        bounds.grow(co);
                }
 
+               /* If the mesh has deformation blur, we need to take that into 
account. */
+               Attribute *attr = mesh->attributes.find(ATTR_STD_DMOTION);
+               if (attr) {
+                       size_t mesh_size = mesh->verts.size();
+                       size_t steps = mesh->mblur_steps - 1;
+                       float3 *vert_steps = attr->data_float3();
+
+                       /* Go through all of the steps and grow the bounds
+                        * for each step of the triangle. */
+                       for (size_t i = 0; i < steps; i++) {
+                               for (size_t k = 0; k < 3; k++) {
+                                       bounds.grow(vert_steps[i * mesh_size + 
t.v[k]]);
+                               }
+                       }
+               }
+
                if(bounds.valid()) {
                        references.push_back(BVHReference(bounds, j, i, ~0));
                        root.grow(bounds);

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

Reply via email to