Fix type conversion warnings

This commit is contained in:
2019-01-11 00:33:29 -08:00
parent 5cca3a9fb1
commit c5a64e2336
3 changed files with 5 additions and 5 deletions

View File

@@ -136,7 +136,7 @@ float &Quaternion::operator [](unsigned i) {
}
Vector3 Quaternion::eulerXYZ() const {
double a2 = 2 * (c[0] * c[2] - c[1] * c[3]);
float a2 = 2 * (c[0] * c[2] - c[1] * c[3]);
if(a2 <= -0.99999) {
return Vector3::Create(
2.0f * atan2(c[1], c[0]),
@@ -151,9 +151,9 @@ Vector3 Quaternion::eulerXYZ() const {
);
} else {
return Vector3::Create(
atan2(2 * (c[0] * c[1] + c[2] * c[3]), (1 - 2 * (c[1] * c[1] + c[2] * c[2]))),
atan2f(2 * (c[0] * c[1] + c[2] * c[3]), (1 - 2 * (c[1] * c[1] + c[2] * c[2]))),
asinf(a2),
atan2(2 * (c[0] * c[3] + c[1] * c[2]), (1 - 2 * (c[2] * c[2] + c[3] * c[3])))
atan2f(2 * (c[0] * c[3] + c[1] * c[2]), (1 - 2 * (c[2] * c[2] + c[3] * c[3])))
);
}

View File

@@ -35,7 +35,7 @@ namespace kraken {
float SmoothStep(float a, float b, float t)
{
float d = (3.0 * t * t - 2.0 * t * t * t);
float d = (3.0f * t * t - 2.0f * t * t * t);
return a * (1.0f - d) + b * d;
}

View File

@@ -150,7 +150,7 @@ Vector3 Triangle3::operator[](unsigned int i) const
bool Triangle3::rayCast(const Vector3 &start, const Vector3 &dir, Vector3 &hit_point) const
{
// algorithm based on Dan Sunday's implementation at http://geomalgorithms.com/a06-_intersect-2.html
const float SMALL_NUM = 0.00000001; // anything that avoids division overflow
const float SMALL_NUM = 0.00000001f; // anything that avoids division overflow
Vector3 u, v, n; // triangle vectors
Vector3 w0, w; // ray vectors
float r, a, b; // params to calc ray-plane intersect