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/quaternion.h | |
parent | 7a7fabe4f6d66ffb0c0fbbaf1696e67456c383d7 (diff) | |
parent | 5298e16e80e032a7ff0c6a661b826859e5aeccd0 (diff) |
Merge pull request #57703 from lawnjelly/float_literals_math_funcs
Diffstat (limited to 'core/math/quaternion.h')
-rw-r--r-- | core/math/quaternion.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/math/quaternion.h b/core/math/quaternion.h index 7874e4f428..f8a2c6456e 100644 --- a/core/math/quaternion.h +++ b/core/math/quaternion.h @@ -145,19 +145,19 @@ struct _NO_DISCARD_ Quaternion { Vector3 c = v0.cross(v1); real_t d = v0.dot(v1); - if (d < -1.0 + CMP_EPSILON) { + if (d < -1.0f + CMP_EPSILON) { x = 0; y = 1; z = 0; w = 0; } else { - real_t s = Math::sqrt((1.0 + d) * 2.0); - real_t rs = 1.0 / s; + real_t s = Math::sqrt((1.0f + d) * 2.0f); + real_t rs = 1.0f / s; x = c.x * rs; y = c.y * rs; z = c.z * rs; - w = s * 0.5; + w = s * 0.5f; } } }; @@ -192,7 +192,7 @@ void Quaternion::operator*=(const real_t &s) { } void Quaternion::operator/=(const real_t &s) { - *this *= 1.0 / s; + *this *= 1.0f / s; } Quaternion Quaternion::operator+(const Quaternion &q2) const { @@ -215,7 +215,7 @@ Quaternion Quaternion::operator*(const real_t &s) const { } Quaternion Quaternion::operator/(const real_t &s) const { - return *this * (1.0 / s); + return *this * (1.0f / s); } bool Quaternion::operator==(const Quaternion &p_quaternion) const { |