diff options
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/basis.cpp | 2 | ||||
-rw-r--r-- | core/math/face3.cpp | 2 | ||||
-rw-r--r-- | core/math/face3.h | 2 | ||||
-rw-r--r-- | core/math/math_funcs.h | 25 |
4 files changed, 16 insertions, 15 deletions
diff --git a/core/math/basis.cpp b/core/math/basis.cpp index 84f9d12bb1..eb6703aff2 100644 --- a/core/math/basis.cpp +++ b/core/math/basis.cpp @@ -1002,7 +1002,7 @@ void Basis::rotate_sh(real_t *p_values) { const static real_t s_scale_dst2 = s_c3 * s_c_scale_inv; const static real_t s_scale_dst4 = s_c5 * s_c_scale_inv; - real_t src[9] = { p_values[0], p_values[1], p_values[2], p_values[3], p_values[4], p_values[5], p_values[6], p_values[7], p_values[8] }; + const real_t src[9] = { p_values[0], p_values[1], p_values[2], p_values[3], p_values[4], p_values[5], p_values[6], p_values[7], p_values[8] }; real_t m00 = elements[0][0]; real_t m01 = elements[0][1]; diff --git a/core/math/face3.cpp b/core/math/face3.cpp index 5bc1bc25e6..fb92f6b0df 100644 --- a/core/math/face3.cpp +++ b/core/math/face3.cpp @@ -208,7 +208,7 @@ bool Face3::intersects_aabb(const AABB &p_aabb) const { /** TEST ALL EDGES **/ - Vector3 edge_norms[3] = { + const Vector3 edge_norms[3] = { vertex[0] - vertex[1], vertex[1] - vertex[2], vertex[2] - vertex[0], diff --git a/core/math/face3.h b/core/math/face3.h index c61d6ad66e..23260336fa 100644 --- a/core/math/face3.h +++ b/core/math/face3.h @@ -133,7 +133,7 @@ bool Face3::intersects_aabb2(const AABB &p_aabb) const { #undef TEST_AXIS - Vector3 edge_norms[3] = { + const Vector3 edge_norms[3] = { vertex[0] - vertex[1], vertex[1] - vertex[2], vertex[2] - vertex[0], diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 44340b97ae..b741277872 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -473,16 +473,16 @@ public: uint32_t x = ci.ui; uint32_t sign = (unsigned short)(x >> 31); uint32_t mantissa; - uint32_t exp; + uint32_t exponent; uint16_t hf; // get mantissa mantissa = x & ((1 << 23) - 1); // get exponent bits - exp = x & (0xFF << 23); - if (exp >= 0x47800000) { + exponent = x & (0xFF << 23); + if (exponent >= 0x47800000) { // check if the original single precision float number is a NaN - if (mantissa && (exp == (0xFF << 23))) { + if (mantissa && (exponent == (0xFF << 23))) { // we have a single precision NaN mantissa = (1 << 23) - 1; } else { @@ -493,17 +493,18 @@ public: (uint16_t)(mantissa >> 13); } // check if exponent is <= -15 - else if (exp <= 0x38000000) { - /*// store a denorm half-float value or zero - exp = (0x38000000 - exp) >> 23; - mantissa >>= (14 + exp); - - hf = (((uint16_t)sign) << 15) | (uint16_t)(mantissa); - */ + else if (exponent <= 0x38000000) { + /* + // store a denorm half-float value or zero + exponent = (0x38000000 - exponent) >> 23; + mantissa >>= (14 + exponent); + + hf = (((uint16_t)sign) << 15) | (uint16_t)(mantissa); + */ hf = 0; //denormals do not work for 3D, convert to zero } else { hf = (((uint16_t)sign) << 15) | - (uint16_t)((exp - 0x38000000) >> 13) | + (uint16_t)((exponent - 0x38000000) >> 13) | (uint16_t)(mantissa >> 13); } |