Fixed many bugs
Added NzOpenGL::GetEntry Activated preprocessor error if not compiling with a C++11 compliant compiler Cube can now be constructed with a Rect Desactived utility option "threaded window" (bugged) Epured Image interface (No more UpdateFace, use Update with z = the face you are targetting) Fixed compilation errors (Thanks to RafBill) Fixed predefined colors not exported Fixed uplading pixels not aligned by 4 bytes Fixed Thumbs.db files not ignored by git NzImage now supports Filling and Flipping (Horizontally and vertically) NzImage::Get(Const)Pixels now support pixel location NzVector(2/3) can now return floatting distance/length with all types NzVector(2/3/4) can now be constructed by a vector of smaller dimension Premake now set "-std=c++11" build option for GCC Renamed NzImage::(Get/Set)Pixel to (Get/Set)PixelColor Updated new([])/delete([]) in the leaks tracker to the new C++11 signatures
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#define NAZARA_CUBE_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
template<typename T>
|
||||
@@ -17,6 +18,7 @@ class NzCube
|
||||
NzCube();
|
||||
NzCube(T X, T Y, T Z, T Width, T Height, T Depth);
|
||||
NzCube(T cube[6]);
|
||||
NzCube(const NzRect<T>& rect);
|
||||
template<typename U> explicit NzCube(const NzCube<U>& rect);
|
||||
NzCube(const NzCube& rect) = default;
|
||||
~NzCube() = default;
|
||||
|
||||
@@ -33,6 +33,17 @@ depth(vec[5])
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzCube<T>::NzCube(const NzRect<T>& rect) :
|
||||
x(rect.x),
|
||||
y(rect.y),
|
||||
z(0),
|
||||
width(rect.width),
|
||||
height(rect.height),
|
||||
depth(1)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template<typename U>
|
||||
NzCube<T>::NzCube(const NzCube<U>& rect) :
|
||||
|
||||
@@ -96,17 +96,12 @@ template<typename T> class NzMatrix4
|
||||
|
||||
struct SharedMatrix
|
||||
{
|
||||
SharedMatrix() : // Vivement GCC 4.7 sur Windows
|
||||
refCount(1)
|
||||
{
|
||||
}
|
||||
|
||||
T m11, m12, m13, m14;
|
||||
T m21, m22, m23, m24;
|
||||
T m31, m32, m33, m34;
|
||||
T m41, m42, m43, m44;
|
||||
|
||||
unsigned short refCount;
|
||||
unsigned short refCount = 1;
|
||||
NazaraMutex(mutex)
|
||||
};
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ NzMatrix4<T> NzMatrix4<T>::GetInverse() const
|
||||
NzMatrix4 matrix;
|
||||
T det = GetDeterminant();
|
||||
|
||||
if (det != 0.0)
|
||||
if (!NzNumberEquals(det, static_cast<T>(0.0)))
|
||||
{
|
||||
matrix(0, 0) = (m_sharedMatrix->m22 * (m_sharedMatrix->m33 * m_sharedMatrix->m44 - m_sharedMatrix->m34 * m_sharedMatrix->m43) - m_sharedMatrix->m32 * (m_sharedMatrix->m23 * m_sharedMatrix->m44 - m_sharedMatrix->m43 * m_sharedMatrix->m24) + m_sharedMatrix->m42 * (m_sharedMatrix->m23 * m_sharedMatrix->m34 - m_sharedMatrix->m33 * m_sharedMatrix->m24)) / det;
|
||||
matrix(0, 1) = -(m_sharedMatrix->m12 * (m_sharedMatrix->m33 * m_sharedMatrix->m44 - m_sharedMatrix->m43 * m_sharedMatrix->m34) - m_sharedMatrix->m32 * (m_sharedMatrix->m13 * m_sharedMatrix->m44 - m_sharedMatrix->m43 * m_sharedMatrix->m14) + m_sharedMatrix->m42 * (m_sharedMatrix->m13 * m_sharedMatrix->m34 - m_sharedMatrix->m33 * m_sharedMatrix->m14)) / det;
|
||||
|
||||
@@ -217,15 +217,15 @@ NzQuaternion<T> NzQuaternion<T>::Slerp(const NzQuaternion& quatA, const NzQuater
|
||||
k1 = std::sin(interp * omega) * sinOmega;
|
||||
}
|
||||
|
||||
/* interpolate and return new quaternion */
|
||||
NzQuaternion result(k0 * quatA.w, k0 * quatA.x, k0 * quatA.y, k0 * quatA.z);
|
||||
|
||||
return result += q;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzEulerAngles<T> NzQuaternion<T>::ToEulerAngles() const
|
||||
{
|
||||
Normalize();
|
||||
|
||||
T test = x*y + z*w;
|
||||
if (test > 0.499)
|
||||
// singularity at north pole
|
||||
|
||||
@@ -22,12 +22,14 @@ template<typename T> class NzVector2
|
||||
|
||||
T AbsDotProduct(const NzVector2& vec) const;
|
||||
T Distance(const NzVector2& vec) const;
|
||||
float Distancef(const NzVector2& vec) const;
|
||||
T DotProduct(const NzVector2& vec) const;
|
||||
NzVector2 GetNormal() const;
|
||||
void MakeCeil(const NzVector2& vec);
|
||||
void MakeFloor(const NzVector2& vec);
|
||||
T Length() const;
|
||||
T Normalize();
|
||||
float Lengthf() const;
|
||||
void Normalize();
|
||||
T SquaredDistance(const NzVector2& vec) const;
|
||||
T SquaredLength() const;
|
||||
|
||||
|
||||
@@ -49,7 +49,14 @@ T NzVector2<T>::AbsDotProduct(const NzVector2& vec) const
|
||||
return std::fabs(x * vec.x) + std::fabs(y * vec.y);
|
||||
}
|
||||
|
||||
template<> inline int NzVector2<int>::AbsDotProduct(const NzVector2<int>& vec) const
|
||||
template<>
|
||||
inline int NzVector2<int>::AbsDotProduct(const NzVector2<int>& vec) const
|
||||
{
|
||||
return std::labs(x * vec.x) + std::labs(y * vec.y);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline unsigned int NzVector2<unsigned int>::AbsDotProduct(const NzVector2<unsigned int>& vec) const
|
||||
{
|
||||
return std::labs(x * vec.x) + std::labs(y * vec.y);
|
||||
}
|
||||
@@ -60,6 +67,12 @@ T NzVector2<T>::Distance(const NzVector2& vec) const
|
||||
return std::sqrt(SquaredDistance(vec));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
float NzVector2<T>::Distancef(const NzVector2& vec) const
|
||||
{
|
||||
return std::sqrt(static_cast<float>(SquaredDistance(vec)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T NzVector2<T>::DotProduct(const NzVector2& vec) const
|
||||
{
|
||||
@@ -102,17 +115,21 @@ T NzVector2<T>::Length() const
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T NzVector2<T>::Normalize()
|
||||
float NzVector2<T>::Lengthf() const
|
||||
{
|
||||
T length = Length();
|
||||
return std::sqrt(static_cast<float>(SquaredLength()));
|
||||
}
|
||||
|
||||
if (length != 0.f)
|
||||
template<typename T>
|
||||
void NzVector2<T>::Normalize()
|
||||
{
|
||||
auto length = Length();
|
||||
|
||||
if (!NzNumberEquals(length, static_cast<T>(0.0)))
|
||||
{
|
||||
x /= length;
|
||||
y /= length;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -214,7 +231,7 @@ NzVector2<T> NzVector2<T>::operator*(T scale) const
|
||||
template<typename T>
|
||||
NzVector2<T> NzVector2<T>::operator/(const NzVector2& vec) const
|
||||
{
|
||||
if (vec.x == 0.f || vec.y == 0.f)
|
||||
if (NzNumberEquals(vec.x, static_cast<T>(0.0)) || NzNumberEquals(vec.y, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -228,7 +245,7 @@ NzVector2<T> NzVector2<T>::operator/(const NzVector2& vec) const
|
||||
template<typename T>
|
||||
NzVector2<T> NzVector2<T>::operator/(T scale) const
|
||||
{
|
||||
if (scale == 0.f)
|
||||
if (NzNumberEquals(scale, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -278,7 +295,7 @@ NzVector2<T>& NzVector2<T>::operator*=(T scale)
|
||||
template<typename T>
|
||||
NzVector2<T>& NzVector2<T>::operator/=(const NzVector2& vec)
|
||||
{
|
||||
if (vec.x == 0.f || vec.y == 0.f)
|
||||
if (NzNumberEquals(vec.x, static_cast<T>(0.0)) || NzNumberEquals(vec.y, static_cast<T>(0.0)) || NzNumberEquals(vec.z, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -295,7 +312,7 @@ NzVector2<T>& NzVector2<T>::operator/=(const NzVector2& vec)
|
||||
template<typename T>
|
||||
NzVector2<T>& NzVector2<T>::operator/=(T scale)
|
||||
{
|
||||
if (scale == 0.f)
|
||||
if (NzNumberEquals(scale, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -361,7 +378,7 @@ NzVector2<T> operator*(T scale, const NzVector2<T>& vec)
|
||||
template<typename T>
|
||||
NzVector2<T> operator/(T scale, const NzVector2<T>& vec)
|
||||
{
|
||||
if (vec.x == 0.f || vec.y == 0.f)
|
||||
if (NzNumberEquals(vec.x, static_cast<T>(0.0)) || NzNumberEquals(vec.y, static_cast<T>(0.0)) || NzNumberEquals(vec.z, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define NAZARA_VECTOR3_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Vector2.hpp>
|
||||
|
||||
template<typename T> class NzVector3
|
||||
{
|
||||
@@ -16,6 +17,7 @@ template<typename T> class NzVector3
|
||||
NzVector3(T X, T Y, T Z);
|
||||
explicit NzVector3(T scale);
|
||||
NzVector3(T vec[3]);
|
||||
NzVector3(const NzVector2<T>& vec);
|
||||
template<typename U> explicit NzVector3(const NzVector3<U>& vec);
|
||||
NzVector3(const NzVector3& vec) = default;
|
||||
~NzVector3() = default;
|
||||
@@ -23,12 +25,14 @@ template<typename T> class NzVector3
|
||||
T AbsDotProduct(const NzVector3& vec) const;
|
||||
NzVector3 CrossProduct(const NzVector3& vec) const;
|
||||
T Distance(const NzVector3& vec) const;
|
||||
float Distancef(const NzVector3& vec) const;
|
||||
T DotProduct(const NzVector3& vec) const;
|
||||
NzVector3 GetNormal() const;
|
||||
void MakeCeil(const NzVector3& vec);
|
||||
void MakeFloor(const NzVector3& vec);
|
||||
T Length() const;
|
||||
T Normalize();
|
||||
float Lengthf() const;
|
||||
void Normalize();
|
||||
T SquaredDistance(const NzVector3& vec) const;
|
||||
T SquaredLength() const;
|
||||
|
||||
@@ -77,6 +81,7 @@ template<typename T> NzVector3<T> operator/(T scale, const NzVector3<T>& vec);
|
||||
typedef NzVector3<double> NzVector3d;
|
||||
typedef NzVector3<float> NzVector3f;
|
||||
typedef NzVector3<int> NzVector3i;
|
||||
typedef NzVector3<unsigned int> NzVector3ui;
|
||||
|
||||
#include <Nazara/Math/Vector3.inl>
|
||||
|
||||
|
||||
@@ -38,6 +38,14 @@ z(vec[2])
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector3<T>::NzVector3(const NzVector2<T>& vec) :
|
||||
x(vec.x),
|
||||
y(vec.y),
|
||||
z(0)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template<typename U>
|
||||
NzVector3<T>::NzVector3(const NzVector3<U>& vec) :
|
||||
@@ -53,7 +61,14 @@ T NzVector3<T>::AbsDotProduct(const NzVector3& vec) const
|
||||
return std::fabs(x * vec.x) + std::fabs(y * vec.y) + std::fabs(z * vec.z);
|
||||
}
|
||||
|
||||
template<> inline int NzVector3<int>::AbsDotProduct(const NzVector3<int>& vec) const
|
||||
template<>
|
||||
inline int NzVector3<int>::AbsDotProduct(const NzVector3<int>& vec) const
|
||||
{
|
||||
return std::labs(x * vec.x) + std::labs(y * vec.y) + std::labs(z * vec.z);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline unsigned int NzVector3<unsigned int>::AbsDotProduct(const NzVector3<unsigned int>& vec) const
|
||||
{
|
||||
return std::labs(x * vec.x) + std::labs(y * vec.y) + std::labs(z * vec.z);
|
||||
}
|
||||
@@ -70,6 +85,12 @@ T NzVector3<T>::Distance(const NzVector3& vec) const
|
||||
return std::sqrt(SquaredDistance(vec));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
float NzVector3<T>::Distancef(const NzVector3& vec) const
|
||||
{
|
||||
return std::sqrt(static_cast<float>(SquaredDistance()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T NzVector3<T>::DotProduct(const NzVector3& vec) const
|
||||
{
|
||||
@@ -118,18 +139,22 @@ T NzVector3<T>::Length() const
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T NzVector3<T>::Normalize()
|
||||
float NzVector3<T>::Lengthf() const
|
||||
{
|
||||
return std::sqrt(static_cast<float>(SquaredLength()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void NzVector3<T>::Normalize()
|
||||
{
|
||||
T length = Length();
|
||||
|
||||
if (length != 0.f)
|
||||
if (!NzNumberEquals(length, static_cast<T>(0.0)))
|
||||
{
|
||||
x /= length;
|
||||
y /= length;
|
||||
z /= length;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -231,7 +256,7 @@ NzVector3<T> NzVector3<T>::operator*(T scale) const
|
||||
template<typename T>
|
||||
NzVector3<T> NzVector3<T>::operator/(const NzVector3& vec) const
|
||||
{
|
||||
if (vec.x == 0.f || vec.y == 0.f || vec.z == 0.f)
|
||||
if (NzNumberEquals(vec.x, static_cast<T>(0.0)) || NzNumberEquals(vec.y, static_cast<T>(0.0)) || NzNumberEquals(vec.z, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -245,7 +270,7 @@ NzVector3<T> NzVector3<T>::operator/(const NzVector3& vec) const
|
||||
template<typename T>
|
||||
NzVector3<T> NzVector3<T>::operator/(T scale) const
|
||||
{
|
||||
if (scale == 0.f)
|
||||
if (NzNumberEquals(scale, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -299,7 +324,7 @@ NzVector3<T>& NzVector3<T>::operator*=(T scale)
|
||||
template<typename T>
|
||||
NzVector3<T>& NzVector3<T>::operator/=(const NzVector3& vec)
|
||||
{
|
||||
if (vec.x == 0.f || vec.y == 0.f || vec.z == 0.f)
|
||||
if (NzNumberEquals(vec.x, static_cast<T>(0.0)) || NzNumberEquals(vec.y, static_cast<T>(0.0)) || NzNumberEquals(vec.z, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -317,7 +342,7 @@ NzVector3<T>& NzVector3<T>::operator/=(const NzVector3& vec)
|
||||
template<typename T>
|
||||
NzVector3<T>& NzVector3<T>::operator/=(T scale)
|
||||
{
|
||||
if (scale == 0.f)
|
||||
if (NzNumberEquals(scale, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -385,7 +410,7 @@ NzVector3<T> operator*(T scale, const NzVector3<T>& vec)
|
||||
template<typename T>
|
||||
NzVector3<T> operator/(T scale, const NzVector3<T>& vec)
|
||||
{
|
||||
if (vec.x == 0.f || vec.y == 0.f || vec.z == 0.f)
|
||||
if (NzNumberEquals(vec.x, static_cast<T>(0.0)) || NzNumberEquals(vec.y, static_cast<T>(0.0)) || NzNumberEquals(vec.z, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define NAZARA_VECTOR4_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
template<typename T> class NzVector4
|
||||
{
|
||||
@@ -17,6 +18,7 @@ template<typename T> class NzVector4
|
||||
explicit NzVector4(T scale);
|
||||
NzVector4(T vec[4]);
|
||||
template<typename U> explicit NzVector4(const NzVector4<U>& vec);
|
||||
NzVector4(const NzVector3<T>& vec, T W = 1.0);
|
||||
NzVector4(const NzVector4& vec) = default;
|
||||
~NzVector4() = default;
|
||||
|
||||
|
||||
@@ -51,13 +51,29 @@ w(static_cast<T>(vec.w))
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
NzVector4<T>::NzVector4(const NzVector3<T>& vec, T W) :
|
||||
x(vec.x),
|
||||
y(vec.y),
|
||||
z(vec.z),
|
||||
w(W)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T NzVector4<T>::AbsDotProduct(const NzVector4& vec) const
|
||||
{
|
||||
return std::fabs(x * vec.x) + std::fabs(y * vec.y) + std::fabs(z * vec.z) + std::fabs(w * vec.w);
|
||||
}
|
||||
|
||||
template<> inline int NzVector4<int>::AbsDotProduct(const NzVector4<int>& vec) const
|
||||
template<>
|
||||
inline int NzVector4<int>::AbsDotProduct(const NzVector4<int>& vec) const
|
||||
{
|
||||
return std::labs(x * vec.x) + std::labs(y * vec.y) + std::labs(z * vec.z) + std::labs(w * vec.w);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline unsigned int NzVector4<unsigned int>::AbsDotProduct(const NzVector4<unsigned int>& vec) const
|
||||
{
|
||||
return std::labs(x * vec.x) + std::labs(y * vec.y) + std::labs(z * vec.z) + std::labs(w * vec.w);
|
||||
}
|
||||
@@ -103,7 +119,7 @@ void NzVector4<T>::MakeFloor(const NzVector4& vec)
|
||||
template<typename T>
|
||||
void NzVector4<T>::Normalize()
|
||||
{
|
||||
if (w != 0.f)
|
||||
if (!NzNumberEquals(w, static_cast<T>(0.0)))
|
||||
{
|
||||
x /= w;
|
||||
y /= w;
|
||||
@@ -116,7 +132,7 @@ NzString NzVector4<T>::ToString() const
|
||||
{
|
||||
NzStringStream ss;
|
||||
|
||||
return ss << "Vector4(" << x << ", " << y << ", " << z <<')';
|
||||
return ss << "Vector4(" << x << ", " << y << ", " << z << ", " << w << ')';
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -180,7 +196,7 @@ NzVector4<T> NzVector4<T>::operator+(const NzVector4& vec) const
|
||||
template<typename T>
|
||||
NzVector4<T> NzVector4<T>::operator-(const NzVector4& vec) const
|
||||
{
|
||||
return NzVector4(x - vec.x, y - vec.y, z - vec.z);
|
||||
return NzVector4(x - vec.x, y - vec.y, z - vec.z, w - vec.w);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -198,7 +214,7 @@ NzVector4<T> NzVector4<T>::operator*(T scale) const
|
||||
template<typename T>
|
||||
NzVector4<T> NzVector4<T>::operator/(const NzVector4& vec) const
|
||||
{
|
||||
if (vec.x == 0.f || vec.y == 0.f || vec.z == 0.f || vec.w == 0.f)
|
||||
if (NzNumberEquals(vec.x, static_cast<T>(0.0)) || NzNumberEquals(vec.y, static_cast<T>(0.0)) || NzNumberEquals(vec.z, static_cast<T>(0.0)) || NzNumberEquals(vec.w, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -212,7 +228,7 @@ NzVector4<T> NzVector4<T>::operator/(const NzVector4& vec) const
|
||||
template<typename T>
|
||||
NzVector4<T> NzVector4<T>::operator/(T scale) const
|
||||
{
|
||||
if (scale == 0.f)
|
||||
if (NzNumberEquals(scale, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -270,7 +286,7 @@ NzVector4<T>& NzVector4<T>::operator*=(T scale)
|
||||
template<typename T>
|
||||
NzVector4<T>& NzVector4<T>::operator/=(const NzVector4& vec)
|
||||
{
|
||||
if (vec.x == 0.f || vec.y == 0.f || vec.z == 0.f || vec.w == 0.f)
|
||||
if (NzNumberEquals(vec.x, static_cast<T>(0.0)) || NzNumberEquals(vec.y, static_cast<T>(0.0)) || NzNumberEquals(vec.z, static_cast<T>(0.0)) || NzNumberEquals(vec.w, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -289,7 +305,7 @@ NzVector4<T>& NzVector4<T>::operator/=(const NzVector4& vec)
|
||||
template<typename T>
|
||||
NzVector4<T>& NzVector4<T>::operator/=(T scale)
|
||||
{
|
||||
if (scale == 0.f)
|
||||
if (NzNumberEquals(scale, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
@@ -359,7 +375,7 @@ NzVector4<T> operator*(T scale, const NzVector4<T>& vec)
|
||||
template<typename T>
|
||||
NzVector4<T> operator/(T scale, const NzVector4<T>& vec)
|
||||
{
|
||||
if (vec.x == 0.f || vec.y == 0.f || vec.z == 0.f || vec.w == 0.f)
|
||||
if (NzNumberEquals(vec.x, static_cast<T>(0.0)) || NzNumberEquals(vec.y, static_cast<T>(0.0)) || NzNumberEquals(vec.z, static_cast<T>(0.0)) || NzNumberEquals(vec.w, static_cast<T>(0.0)))
|
||||
{
|
||||
NzStringStream ss;
|
||||
ss << __FILE__ << ':' << __LINE__ << ": Division by zero";
|
||||
|
||||
Reference in New Issue
Block a user