diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-12 10:01:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 10:01:48 +0100 |
commit | daf9729b925ea13d77312bb3ce18198e158c03a8 (patch) | |
tree | 44dba39a46237db559a8ab82189328f171492edd /core/math/aabb.h | |
parent | 7a7fabe4f6d66ffb0c0fbbaf1696e67456c383d7 (diff) | |
parent | 5298e16e80e032a7ff0c6a661b826859e5aeccd0 (diff) |
Merge pull request #57703 from lawnjelly/float_literals_math_funcs
Diffstat (limited to 'core/math/aabb.h')
-rw-r--r-- | core/math/aabb.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/core/math/aabb.h b/core/math/aabb.h index cb6f05e9ea..e88ba33531 100644 --- a/core/math/aabb.h +++ b/core/math/aabb.h @@ -119,7 +119,7 @@ struct _NO_DISCARD_ AABB { } _FORCE_INLINE_ Vector3 get_center() const { - return position + (size * 0.5); + return position + (size * 0.5f); } operator String() const; @@ -208,7 +208,7 @@ inline bool AABB::encloses(const AABB &p_aabb) const { } Vector3 AABB::get_support(const Vector3 &p_normal) const { - Vector3 half_extents = size * 0.5; + Vector3 half_extents = size * 0.5f; Vector3 ofs = position + half_extents; return Vector3( @@ -242,7 +242,7 @@ Vector3 AABB::get_endpoint(int p_point) const { } bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count, const Vector3 *p_points, int p_point_count) const { - Vector3 half_extents = size * 0.5; + Vector3 half_extents = size * 0.5f; Vector3 ofs = position + half_extents; for (int i = 0; i < p_plane_count; i++) { @@ -284,7 +284,7 @@ bool AABB::intersects_convex_shape(const Plane *p_planes, int p_plane_count, con } bool AABB::inside_convex_shape(const Plane *p_planes, int p_plane_count) const { - Vector3 half_extents = size * 0.5; + Vector3 half_extents = size * 0.5f; Vector3 ofs = position + half_extents; for (int i = 0; i < p_plane_count; i++) { @@ -364,7 +364,7 @@ inline void AABB::expand_to(const Vector3 &p_vector) { } void AABB::project_range_in_plane(const Plane &p_plane, real_t &r_min, real_t &r_max) const { - Vector3 half_extents(size.x * 0.5, size.y * 0.5, size.z * 0.5); + Vector3 half_extents(size.x * 0.5f, size.y * 0.5f, size.z * 0.5f); Vector3 center(position.x + half_extents.x, position.y + half_extents.y, position.z + half_extents.z); real_t length = p_plane.normal.abs().dot(half_extents); @@ -407,9 +407,9 @@ bool AABB::smits_intersect_ray(const Vector3 &p_from, const Vector3 &p_dir, real ERR_PRINT("AABB size is negative, this is not supported. Use AABB.abs() to get an AABB with a positive size."); } #endif - real_t divx = 1.0 / p_dir.x; - real_t divy = 1.0 / p_dir.y; - real_t divz = 1.0 / p_dir.z; + real_t divx = 1.0f / p_dir.x; + real_t divy = 1.0f / p_dir.y; + real_t divz = 1.0f / p_dir.z; Vector3 upbound = position + size; real_t tmin, tmax, tymin, tymax, tzmin, tzmax; @@ -459,9 +459,9 @@ void AABB::grow_by(real_t p_amount) { position.x -= p_amount; position.y -= p_amount; position.z -= p_amount; - size.x += 2.0 * p_amount; - size.y += 2.0 * p_amount; - size.z += 2.0 * p_amount; + size.x += 2.0f * p_amount; + size.y += 2.0f * p_amount; + size.z += 2.0f * p_amount; } void AABB::quantize(real_t p_unit) { |