Fixing compiler warnings around implicit type casting loosing precision
This commit is contained in:
@@ -152,19 +152,19 @@ public:
|
||||
Vector3 c = v0.cross(v1);
|
||||
real_t d = v0.dot(v1);
|
||||
|
||||
if (d < -1.0 + CMP_EPSILON) {
|
||||
x = 0;
|
||||
y = 1;
|
||||
z = 0;
|
||||
w = 0;
|
||||
if (d < (real_t)-1.0 + CMP_EPSILON) {
|
||||
x = (real_t)0.0;
|
||||
y = (real_t)1.0;
|
||||
z = (real_t)0.0;
|
||||
w = (real_t)0.0;
|
||||
} else {
|
||||
real_t s = Math::sqrt((1.0 + d) * 2.0);
|
||||
real_t rs = 1.0 / s;
|
||||
real_t s = Math::sqrt(((real_t)1.0 + d) * (real_t)2.0);
|
||||
real_t rs = (real_t)1.0 / s;
|
||||
|
||||
x = c.x * rs;
|
||||
y = c.y * rs;
|
||||
z = c.z * rs;
|
||||
w = s * 0.5;
|
||||
w = s * (real_t)0.5;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -199,7 +199,7 @@ void Quaternion::operator*=(const real_t &s) {
|
||||
}
|
||||
|
||||
void Quaternion::operator/=(const real_t &s) {
|
||||
*this *= 1.0 / s;
|
||||
*this *= (real_t)1.0 / s;
|
||||
}
|
||||
|
||||
Quaternion Quaternion::operator+(const Quaternion &q2) const {
|
||||
@@ -222,7 +222,7 @@ Quaternion Quaternion::operator*(const real_t &s) const {
|
||||
}
|
||||
|
||||
Quaternion Quaternion::operator/(const real_t &s) const {
|
||||
return *this * (1.0 / s);
|
||||
return *this * ((real_t)1.0 / s);
|
||||
}
|
||||
|
||||
bool Quaternion::operator==(const Quaternion &p_quat) const {
|
||||
|
||||
Reference in New Issue
Block a user