warning fixes

This commit is contained in:
BlackMATov
2021-02-21 02:07:27 +07:00
parent aae8244575
commit 5c800b1ce6
4 changed files with 92 additions and 88 deletions

View File

@@ -795,7 +795,7 @@ namespace vmath_hpp
/// REFERENCE:
/// https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dxmatrixperspectivefovlh
const T sy = rcp(tan(fovy * T{0.5}));
const T sy = rcp(tan(fovy * T{0.5f}));
const T sx = sy * rcp(aspect);
const T sz = zfar * rcp(zfar - znear);
const T tz = (znear * zfar) * rcp(znear - zfar);
@@ -812,7 +812,7 @@ namespace vmath_hpp
/// REFERENCE:
/// https://docs.microsoft.com/en-us/windows/win32/direct3d9/d3dxmatrixperspectivefovrh
const T sy = rcp(tan(fovy * T{0.5}));
const T sy = rcp(tan(fovy * T{0.5f}));
const T sx = sy * rcp(aspect);
const T sz = zfar * rcp(znear - zfar);
const T tz = (znear * zfar) * rcp(znear - zfar);
@@ -901,7 +901,7 @@ namespace vmath_hpp
/// REFERENCE:
/// http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/
auto xyzw = T{0.5} * sqrt(max(T{0}, vec{
auto xyzw = T{0.5f} * sqrt(max(T{0}, vec{
T{1} + m[0][0] - m[1][1] - m[2][2],
T{1} - m[0][0] + m[1][1] - m[2][2],
T{1} - m[0][0] - m[1][1] + m[2][2],
@@ -927,7 +927,7 @@ namespace vmath_hpp
const T n = sqrt(length2(from) * length2(to));
const T s = dot(from, to) + n;
if ( s < T{0.000001} * n ) {
if ( s < T{0.000001f} * n ) {
return abs(from.z) < abs(from.x)
? normalize(qua{vec{-from.y, from.x, T{0}}, T{0}})
: normalize(qua{vec{T{0}, -from.z, from.y}, T{0}});
@@ -946,7 +946,7 @@ namespace vmath_hpp
/// REFERENCE:
/// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/
const auto [s, c] = sincos(angle * T{0.5});
const auto [s, c] = sincos(angle * T{0.5f});
const auto [x, y, z] = normalize(axis);
return {vec{x, y, z} * s, c};
@@ -962,7 +962,7 @@ namespace vmath_hpp
/// REFERENCE:
/// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/
const auto [s, c] = sincos(angle * T{0.5});
const auto [s, c] = sincos(angle * T{0.5f});
return {vec{s, T{0}, T{0}}, c};
}
@@ -977,7 +977,7 @@ namespace vmath_hpp
/// REFERENCE:
/// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/
const auto [s, c] = sincos(angle * T{0.5});
const auto [s, c] = sincos(angle * T{0.5f});
return {vec{T{0}, s, T{0}}, c};
}
@@ -992,7 +992,7 @@ namespace vmath_hpp
/// REFERENCE:
/// http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/
const auto [s, c] = sincos(angle * T{0.5});
const auto [s, c] = sincos(angle * T{0.5f});
return {vec{T{0}, T{0}, s}, c};
}

View File

@@ -151,13 +151,13 @@ namespace vmath_hpp
template < typename T >
[[nodiscard]] std::enable_if_t<std::is_floating_point_v<T>, T>
constexpr radians(T degrees) noexcept {
return degrees * T{0.01745329251994329576923690768489};
return degrees * T(0.01745329251994329576923690768489);
}
template < typename T >
[[nodiscard]] std::enable_if_t<std::is_floating_point_v<T>, T>
constexpr degrees(T radians) noexcept {
return radians * T{57.295779513082320876798154814105};
return radians * T(57.295779513082320876798154814105);
}
template < typename T >

View File

@@ -183,7 +183,7 @@ namespace vmath_hpp
const T raw_cos_theta_sign = sign(raw_cos_theta);
// half degree linear threshold: cos((pi / 180) * 0.25)
if ( const T cos_theta = raw_cos_theta * raw_cos_theta_sign; cos_theta < T{0.99999} ) {
if ( const T cos_theta = raw_cos_theta * raw_cos_theta_sign; cos_theta < T{0.99999f} ) {
const T theta = acos(cos_theta);
const T rsin_theta = rsqrt(T{1} - sqr(cos_theta));
const T xs_scale = sin((T{1} - a) * theta) * rsin_theta;