[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59544] branches/soc-2013-cycles_mblur/ intern/cycles/bvh/bvh.cpp: Added BVH adjustments for deformation blur in the refit_node() function.

Gavin Howard gavin.d.howard at gmail.com
Tue Aug 27 01:59:47 CEST 2013


Revision: 59544
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59544
Author:   gdh
Date:     2013-08-26 23:59:46 +0000 (Mon, 26 Aug 2013)
Log Message:
-----------
Added BVH adjustments for deformation blur in the refit_node() function. 
This code is still untested. That's what I will be doing after I commit 
this.

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

Modified: branches/soc-2013-cycles_mblur/intern/cycles/bvh/bvh.cpp
===================================================================
--- branches/soc-2013-cycles_mblur/intern/cycles/bvh/bvh.cpp	2013-08-26 23:37:08 UTC (rev 59543)
+++ branches/soc-2013-cycles_mblur/intern/cycles/bvh/bvh.cpp	2013-08-26 23:59:46 UTC (rev 59544)
@@ -645,6 +645,22 @@
 					bbox.grow(vpos[vidx[0]]);
 					bbox.grow(vpos[vidx[1]]);
 					bbox.grow(vpos[vidx[2]]);
+
+					/* 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++) {
+							bbox.grow(vert_steps[i * mesh_size + vidx[0]]);
+							bbox.grow(vert_steps[i * mesh_size + vidx[1]]);
+							bbox.grow(vert_steps[i * mesh_size + vidx[2]]);
+						}
+					}
 				}
 			}
 




More information about the Bf-blender-cvs mailing list