From 4bd5e4fd9b80384d511e4c8f2f642b43159aba4c Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 21 Jul 2021 10:40:31 +0200 Subject: Use the standard C `INFINITY` and `NAN` constants directly The `Math_INF` and `Math_NAN` defines were just aliases for those constants, so we might as well use them directly. Some portions of the code were already using `INFINITY` directly. --- servers/physics_3d/shape_3d_sw.h | 2 +- servers/physics_3d/soft_body_3d_sw.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'servers/physics_3d') diff --git a/servers/physics_3d/shape_3d_sw.h b/servers/physics_3d/shape_3d_sw.h index bc8bd3e695..0d1b7cc3d7 100644 --- a/servers/physics_3d/shape_3d_sw.h +++ b/servers/physics_3d/shape_3d_sw.h @@ -128,7 +128,7 @@ class PlaneShape3DSW : public Shape3DSW { public: Plane get_plane() const; - virtual real_t get_area() const { return Math_INF; } + virtual real_t get_area() const { return INFINITY; } virtual PhysicsServer3D::ShapeType get_type() const { return PhysicsServer3D::SHAPE_PLANE; } virtual void project_range(const Vector3 &p_normal, const Transform3D &p_transform, real_t &r_min, real_t &r_max) const; virtual Vector3 get_support(const Vector3 &p_normal) const; diff --git a/servers/physics_3d/soft_body_3d_sw.cpp b/servers/physics_3d/soft_body_3d_sw.cpp index 63a0fe11ba..724125bea8 100644 --- a/servers/physics_3d/soft_body_3d_sw.cpp +++ b/servers/physics_3d/soft_body_3d_sw.cpp @@ -1172,7 +1172,7 @@ struct _SoftBodyIntersectSegmentInfo { Vector3 dir; Vector3 hit_position; uint32_t hit_face_index = -1; - real_t hit_dist_sq = Math_INF; + real_t hit_dist_sq = INFINITY; static bool process_hit(uint32_t p_face_index, void *p_userdata) { _SoftBodyIntersectSegmentInfo &query_info = *(_SoftBodyIntersectSegmentInfo *)(p_userdata); @@ -1203,7 +1203,7 @@ bool SoftBodyShape3DSW::intersect_segment(const Vector3 &p_begin, const Vector3 soft_body->query_ray(p_begin, p_end, _SoftBodyIntersectSegmentInfo::process_hit, &query_info); - if (query_info.hit_dist_sq != Math_INF) { + if (query_info.hit_dist_sq != INFINITY) { r_result = query_info.hit_position; r_normal = soft_body->get_face_normal(query_info.hit_face_index); return true; -- cgit v1.2.3