diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-03-24 06:21:58 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-03-24 06:21:58 +0400 |
commit | 3214d4fd5aa803237637da2eee5d1b9e0006ae26 (patch) | |
tree | b4b1faed52c55eea7da18b10eb216bfff90e3bf7 /source/blender/blenkernel/intern/pbvh.c | |
parent | 551d1a1ed56d7406f440c8e858ad64f177664c5b (diff) |
Code Cleanup: PBVH, avoid sqrt and use bool for raycast functions
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 426a1e1646c..5a81bbf01a8 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1453,14 +1453,16 @@ static bool pbvh_faces_node_raycast(PBVH *bvh, const PBVHNode *node, return hit; } -static int pbvh_grids_node_raycast(PBVH *bvh, PBVHNode *node, - float (*origco)[3], - const float ray_start[3], - const float ray_normal[3], float *dist) +static bool pbvh_grids_node_raycast( + PBVH *bvh, PBVHNode *node, + float (*origco)[3], + const float ray_start[3], const float ray_normal[3], + float *dist) { int totgrid = node->totprim; int gridsize = bvh->gridkey.grid_size; - int i, x, y, hit = 0; + int i, x, y; + bool hit = false; for (i = 0; i < totgrid; ++i) { CCGElem *grid = bvh->grids[node->prim_indices[i]]; @@ -1505,9 +1507,10 @@ static int pbvh_grids_node_raycast(PBVH *bvh, PBVHNode *node, return hit; } -int BKE_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco, - const float ray_start[3], const float ray_normal[3], - float *dist) +bool BKE_pbvh_node_raycast( + PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco, + const float ray_start[3], const float ray_normal[3], + float *dist) { bool hit = false; |