Convert double to ints with floor rather than truncating (#5572)
Signed-off-by: Mike Jagdis <mjagdis@eris-associates.co.uk>
This commit is contained in:
parent
2bafab7233
commit
352134ba9e
@ -30,13 +30,20 @@ public:
|
|||||||
|
|
||||||
// tolua_end
|
// tolua_end
|
||||||
// Conversion constructors where U is not the same as T leaving the copy-constructor implicitly generated
|
// Conversion constructors where U is not the same as T leaving the copy-constructor implicitly generated
|
||||||
template <typename U, typename = typename std::enable_if<!std::is_same<U, T>::value>::type>
|
template <typename U, std::enable_if_t<(!std::is_same<U, T>::value) && ((!std::is_integral<T>::value) || (std::is_integral<U>::value)), bool> = true>
|
||||||
constexpr Vector3(const Vector3<U> & a_Rhs):
|
constexpr Vector3<T>(const Vector3<U> & a_Rhs):
|
||||||
x(static_cast<T>(a_Rhs.x)),
|
x(static_cast<T>(a_Rhs.x)),
|
||||||
y(static_cast<T>(a_Rhs.y)),
|
y(static_cast<T>(a_Rhs.y)),
|
||||||
z(static_cast<T>(a_Rhs.z))
|
z(static_cast<T>(a_Rhs.z))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
template <typename U, std::enable_if_t<(!std::is_same<U, T>::value) && ((std::is_integral<T>::value) && (!std::is_integral<U>::value)), bool> = true>
|
||||||
|
constexpr Vector3<T>(const Vector3<U> & a_Rhs):
|
||||||
|
x(static_cast<T>(std::floor(a_Rhs.x))),
|
||||||
|
y(static_cast<T>(std::floor(a_Rhs.y))),
|
||||||
|
z(static_cast<T>(std::floor(a_Rhs.z)))
|
||||||
|
{
|
||||||
|
}
|
||||||
// tolua_begin
|
// tolua_begin
|
||||||
|
|
||||||
inline void Set(T a_x, T a_y, T a_z)
|
inline void Set(T a_x, T a_y, T a_z)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user