diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-01-20 09:00:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-01-20 09:03:10 +0300 |
commit | e25b1136944e19a233af10859481869e59c12886 (patch) | |
tree | 19d4c3e57ed99dede3d11f8462875f36bca8e65f /source | |
parent | bda0820d575061fca3514281f81f04870bbd495e (diff) |
Cleanup: naming convention
Follow isect_ray_tri_watertight_v3 naming.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 16 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 12 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 9 |
3 files changed, 22 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 699d70a59f4..9b7bc273065 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1439,7 +1439,7 @@ void BKE_pbvh_node_get_bm_orco_data( /********************************* Raycast ***********************************/ typedef struct { - IsectRayAABBData ray; + struct IsectRayAABB_Precalc ray; bool original; } RaycastData; @@ -1453,7 +1453,7 @@ static bool ray_aabb_intersect(PBVHNode *node, void *data_v) else BKE_pbvh_node_get_BB(node, bb_min, bb_max); - return isect_ray_aabb(&rcd->ray, bb_min, bb_max, &node->tmin); + return isect_ray_aabb_v3(&rcd->ray, bb_min, bb_max, &node->tmin); } void BKE_pbvh_raycast( @@ -1463,7 +1463,7 @@ void BKE_pbvh_raycast( { RaycastData rcd; - isect_ray_aabb_initialize(&rcd.ray, ray_start, ray_normal); + isect_ray_aabb_v3_precalc(&rcd.ray, ray_start, ray_normal); rcd.original = original; BKE_pbvh_search_callback_occluded(bvh, ray_aabb_intersect, &rcd, cb, data); @@ -1637,7 +1637,7 @@ void BKE_pbvh_raycast_project_ray_root( if (bvh->nodes) { float rootmin_start, rootmin_end; float bb_min_root[3], bb_max_root[3], bb_center[3], bb_diff[3]; - IsectRayAABBData ray; + struct IsectRayAABB_Precalc ray; float ray_normal_inv[3]; float offset = 1.0f + 1e-3f; float offset_vec[3] = {1e-3f, 1e-3f, 1e-3f}; @@ -1658,15 +1658,15 @@ void BKE_pbvh_raycast_project_ray_root( madd_v3_v3v3fl(bb_min_root, bb_center, bb_diff, -offset); /* first project start ray */ - isect_ray_aabb_initialize(&ray, ray_start, ray_normal); - if (!isect_ray_aabb(&ray, bb_min_root, bb_max_root, &rootmin_start)) + isect_ray_aabb_v3_precalc(&ray, ray_start, ray_normal); + if (!isect_ray_aabb_v3(&ray, bb_min_root, bb_max_root, &rootmin_start)) return; /* then the end ray */ mul_v3_v3fl(ray_normal_inv, ray_normal, -1.0); - isect_ray_aabb_initialize(&ray, ray_end, ray_normal_inv); + isect_ray_aabb_v3_precalc(&ray, ray_end, ray_normal_inv); /* unlikely to fail exiting if entering succeeded, still keep this here */ - if (!isect_ray_aabb(&ray, bb_min_root, bb_max_root, &rootmin_end)) + if (!isect_ray_aabb_v3(&ray, bb_min_root, bb_max_root, &rootmin_end)) return; madd_v3_v3v3fl(ray_start, ray_start, ray_normal, rootmin_start); diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 863bc766276..e3a8f975844 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -271,14 +271,18 @@ bool isect_point_tri_v3( /* axis-aligned bounding box */ bool isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float min2[3], const float max2[3]); -typedef struct { +struct IsectRayAABB_Precalc { float ray_origin[3]; float ray_inv_dir[3]; int sign[3]; -} IsectRayAABBData; +}; -void isect_ray_aabb_initialize(IsectRayAABBData *data, const float ray_origin[3], const float ray_direction[3]); -bool isect_ray_aabb(const IsectRayAABBData *data, const float bb_min[3], const float bb_max[3], float *tmin); +void isect_ray_aabb_v3_precalc( + struct IsectRayAABB_Precalc *data, + const float ray_origin[3], const float ray_direction[3]); +bool isect_ray_aabb_v3( + const struct IsectRayAABB_Precalc *data, + const float bb_min[3], const float bb_max[3], float *tmin); /* other */ bool isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], const float radius, diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 8859be62fea..4665e10d40d 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2195,7 +2195,9 @@ bool isect_aabb_aabb_v3(const float min1[3], const float max1[3], const float mi min2[0] < max1[0] && min2[1] < max1[1] && min2[2] < max1[2]); } -void isect_ray_aabb_initialize(IsectRayAABBData *data, const float ray_origin[3], const float ray_direction[3]) +void isect_ray_aabb_v3_precalc( + struct IsectRayAABB_Precalc *data, + const float ray_origin[3], const float ray_direction[3]) { copy_v3_v3(data->ray_origin, ray_origin); @@ -2209,8 +2211,9 @@ void isect_ray_aabb_initialize(IsectRayAABBData *data, const float ray_origin[3] } /* Adapted from http://www.gamedev.net/community/forums/topic.asp?topic_id=459973 */ -bool isect_ray_aabb(const IsectRayAABBData *data, const float bb_min[3], - const float bb_max[3], float *tmin_out) +bool isect_ray_aabb_v3( + const IsectRayAABB_Precalc *data, const float bb_min[3], + const float bb_max[3], float *tmin_out) { float bbox[2][3]; |