diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-07-05 11:55:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-07-05 20:17:06 +0300 |
commit | 06c1e782b0269e61dfbce3ae3665f959eb2759c2 (patch) | |
tree | fee3648eed2c696ec09ab10d3ccc5d4cd3439eb6 /source/blender/blenkernel/intern/pbvh.c | |
parent | 4a61d21f61f58d36275a5f0aeb017d677a1735b0 (diff) |
Dyntopo: avoid redundant vector copy
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 58ec75dc706..6b6d1b400ea 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1496,12 +1496,18 @@ typedef struct { static bool ray_aabb_intersect(PBVHNode *node, void *data_v) { RaycastData *rcd = data_v; - float bb_min[3], bb_max[3]; + const float *bb_min, *bb_max; - if (rcd->original) - BKE_pbvh_node_get_original_BB(node, bb_min, bb_max); - else - BKE_pbvh_node_get_BB(node, bb_min, bb_max); + if (rcd->original) { + /* BKE_pbvh_node_get_original_BB */ + bb_min = node->orig_vb.bmin; + bb_max = node->orig_vb.bmax; + } + else { + /* BKE_pbvh_node_get_BB */ + bb_min = node->vb.bmin; + bb_max = node->vb.bmax; + } return isect_ray_aabb_v3(&rcd->ray, bb_min, bb_max, &node->tmin); } @@ -1801,17 +1807,21 @@ static PlaneAABBIsect test_planes_aabb(const float bb_min[3], bool BKE_pbvh_node_planes_contain_AABB(PBVHNode *node, void *data) { - float bb_min[3], bb_max[3]; + const float *bb_min, *bb_max; + /* BKE_pbvh_node_get_BB */ + bb_min = node->vb.bmin; + bb_max = node->vb.bmax; - BKE_pbvh_node_get_BB(node, bb_min, bb_max); return test_planes_aabb(bb_min, bb_max, data) != ISECT_OUTSIDE; } bool BKE_pbvh_node_planes_exclude_AABB(PBVHNode *node, void *data) { - float bb_min[3], bb_max[3]; + const float *bb_min, *bb_max; + /* BKE_pbvh_node_get_BB */ + bb_min = node->vb.bmin; + bb_max = node->vb.bmax; - BKE_pbvh_node_get_BB(node, bb_min, bb_max); return test_planes_aabb(bb_min, bb_max, data) != ISECT_INSIDE; } |