diff --git a/include/Nazara/Math/Cube.hpp b/include/Nazara/Math/Cube.hpp index ed6988915..c7627a649 100644 --- a/include/Nazara/Math/Cube.hpp +++ b/include/Nazara/Math/Cube.hpp @@ -43,14 +43,13 @@ class NzCube NzCube& Set(T X, T Y, T Z, T Width, T Height, T Depth); NzCube& Set(const T cube[6]); + NzCube& Set(const NzCube& cube); NzCube& Set(const NzRect& rect); NzCube& Set(const NzVector3& vec1, const NzVector3& vec2); template NzCube& Set(const NzCube& cube); NzString ToString() const; - operator NzString() const; - T& operator[](unsigned int i); T operator[](unsigned int i) const; diff --git a/include/Nazara/Math/Cube.inl b/include/Nazara/Math/Cube.inl index b03c2e7df..714d0b1f1 100644 --- a/include/Nazara/Math/Cube.inl +++ b/include/Nazara/Math/Cube.inl @@ -187,6 +187,14 @@ NzCube& NzCube::Set(const T cube[6]) return *this; } +template +NzCube& NzCube::Set(const NzCube& cube) +{ + std::memcpy(this, &cube, sizeof(NzCube)); + + return *this; +} + template NzCube& NzCube::Set(const NzRect& rect) { @@ -235,12 +243,6 @@ NzString NzCube::ToString() const return ss << "Cube(" << x << ", " << y << ", " << z << ", " << width << ", " << height << ", " << depth << ')'; } -template -NzCube::operator NzString() const -{ - return ToString(); -} - template T& NzCube::operator[](unsigned int i) { diff --git a/include/Nazara/Math/EulerAngles.hpp b/include/Nazara/Math/EulerAngles.hpp index a36fba40d..68e0fbbde 100644 --- a/include/Nazara/Math/EulerAngles.hpp +++ b/include/Nazara/Math/EulerAngles.hpp @@ -38,8 +38,6 @@ template class NzEulerAngles NzQuaternion ToQuaternion() const; NzString ToString() const; - operator NzString() const; - NzEulerAngles operator+(const NzEulerAngles& angles) const; NzEulerAngles operator-(const NzEulerAngles& angles) const; /*NzEulerAngles operator*(const NzEulerAngles& angles) const; diff --git a/include/Nazara/Math/EulerAngles.inl b/include/Nazara/Math/EulerAngles.inl index 5d7c327d0..1f54213b6 100644 --- a/include/Nazara/Math/EulerAngles.inl +++ b/include/Nazara/Math/EulerAngles.inl @@ -69,9 +69,7 @@ void NzEulerAngles::Set(const T angles[3]) template void NzEulerAngles::Set(const NzEulerAngles& angles) { - pitch = angles.pitch; - yaw = angles.yaw; - roll = angles.roll; + std::memcpy(this, &angles, sizeof(NzEulerAngles)); } template @@ -107,12 +105,6 @@ NzString NzEulerAngles::ToString() const return ss << "EulerAngles(" << pitch << ", " << yaw << ", " << roll << ')'; } -template -NzEulerAngles::operator NzString() const -{ - return ToString(); -} - template NzEulerAngles NzEulerAngles::operator+(const NzEulerAngles& angles) const { diff --git a/include/Nazara/Math/Matrix4.hpp b/include/Nazara/Math/Matrix4.hpp index ff57e293e..c3c8f7f07 100644 --- a/include/Nazara/Math/Matrix4.hpp +++ b/include/Nazara/Math/Matrix4.hpp @@ -84,8 +84,6 @@ class NzMatrix4 NzMatrix4& Transpose(); - operator NzString() const; - operator T*(); operator const T*() const; diff --git a/include/Nazara/Math/Matrix4.inl b/include/Nazara/Math/Matrix4.inl index f95f8225d..0b50ca0c1 100644 --- a/include/Nazara/Math/Matrix4.inl +++ b/include/Nazara/Math/Matrix4.inl @@ -626,7 +626,7 @@ NzMatrix4& NzMatrix4::Set(const T matrix[16]) template NzMatrix4& NzMatrix4::Set(const NzMatrix4& matrix) { - std::memcpy(&m11, &matrix.m11, 16*sizeof(T)); + std::memcpy(this, &matrix, sizeof(NzMatrix4)); return *this; } @@ -741,12 +741,6 @@ NzMatrix4& NzMatrix4::Transpose() return *this; } -template -NzMatrix4::operator NzString() const -{ - return ToString(); -} - template NzMatrix4::operator T*() { diff --git a/include/Nazara/Math/Quaternion.hpp b/include/Nazara/Math/Quaternion.hpp index 6984f0fdd..5661ec2c8 100644 --- a/include/Nazara/Math/Quaternion.hpp +++ b/include/Nazara/Math/Quaternion.hpp @@ -57,8 +57,6 @@ template class NzQuaternion //NzMatrix3 ToRotationMatrix() const; NzString ToString() const; - operator NzString() const; - NzQuaternion& operator=(const NzQuaternion& quat); NzQuaternion operator+(const NzQuaternion& quat) const; diff --git a/include/Nazara/Math/Quaternion.inl b/include/Nazara/Math/Quaternion.inl index fa01c62aa..70abac9c5 100644 --- a/include/Nazara/Math/Quaternion.inl +++ b/include/Nazara/Math/Quaternion.inl @@ -221,10 +221,7 @@ NzQuaternion& NzQuaternion::Set(const NzQuaternion& quat) template NzQuaternion& NzQuaternion::Set(const NzQuaternion& quat) { - w = quat.w; - x = quat.x; - y = quat.y; - z = quat.z; + std::memcpy(this, &quat, sizeof(NzQuaternion)); return *this; } @@ -259,12 +256,6 @@ NzString NzQuaternion::ToString() const return ss << "Quaternion(" << w << " | " << x << ", " << y << ", " << z << ')'; } -template -NzQuaternion::operator NzString() const -{ - return ToString(); -} - template NzQuaternion& NzQuaternion::operator=(const NzQuaternion& quat) { diff --git a/include/Nazara/Math/Rect.hpp b/include/Nazara/Math/Rect.hpp index 66066405d..eb6ddefb2 100644 --- a/include/Nazara/Math/Rect.hpp +++ b/include/Nazara/Math/Rect.hpp @@ -41,13 +41,12 @@ class NzRect NzRect& Set(T X, T Y, T Width, T Height); NzRect& Set(const T rect[4]); + NzRect& Set(const NzRect& rect); NzRect& Set(const NzVector2& vec1, const NzVector2& vec2); template NzRect& Set(const NzRect& rect); NzString ToString() const; - operator NzString() const; - T& operator[](unsigned int i); T operator[](unsigned int i) const; diff --git a/include/Nazara/Math/Rect.inl b/include/Nazara/Math/Rect.inl index 86d680ad0..e8f03384a 100644 --- a/include/Nazara/Math/Rect.inl +++ b/include/Nazara/Math/Rect.inl @@ -164,6 +164,14 @@ NzRect& NzRect::Set(const T rect[4]) return *this; } +template +NzRect& NzRect::Set(const NzRect& rect) +{ + std::memcpy(this, &rect, sizeof(NzRect)); + + return *this; +} + template NzRect& NzRect::Set(const NzVector2& vec1, const NzVector2& vec2) { @@ -195,12 +203,6 @@ NzString NzRect::ToString() const return ss << "Rect(" << x << ", " << y << ", " << width << ", " << height << ')'; } -template -NzRect::operator NzString() const -{ - return ToString(); -} - template T& NzRect::operator[](unsigned int i) { diff --git a/include/Nazara/Math/Vector2.hpp b/include/Nazara/Math/Vector2.hpp index 816760fd5..c2de14db4 100644 --- a/include/Nazara/Math/Vector2.hpp +++ b/include/Nazara/Math/Vector2.hpp @@ -45,6 +45,7 @@ class NzVector2 NzVector2& Set(T X, T Y); NzVector2& Set(T scale); NzVector2& Set(const T vec[2]); + NzVector2& Set(const NzVector2& vec); template NzVector2& Set(const NzVector2& vec); T SquaredDistance(const NzVector2& vec) const; @@ -52,8 +53,6 @@ class NzVector2 NzString ToString() const; - operator NzString() const; - operator T*(); operator const T*() const; diff --git a/include/Nazara/Math/Vector2.inl b/include/Nazara/Math/Vector2.inl index 3f41b80d1..d5d9a0da2 100644 --- a/include/Nazara/Math/Vector2.inl +++ b/include/Nazara/Math/Vector2.inl @@ -177,6 +177,14 @@ NzVector2& NzVector2::Set(const T vec[2]) return *this; } +template +NzVector2& NzVector2::Set(const NzVector2& vec) +{ + std::memcpy(this, &vec, sizeof(NzVector2)); + + return *this; +} + template template NzVector2& NzVector2::Set(const NzVector2& vec) @@ -207,12 +215,6 @@ NzString NzVector2::ToString() const return ss << "Vector2(" << x << ", " << y << ')'; } -template -NzVector2::operator NzString() const -{ - return ToString(); -} - template NzVector2::operator T*() { diff --git a/include/Nazara/Math/Vector3.hpp b/include/Nazara/Math/Vector3.hpp index d65b764b9..d49bc5f44 100644 --- a/include/Nazara/Math/Vector3.hpp +++ b/include/Nazara/Math/Vector3.hpp @@ -53,6 +53,7 @@ template class NzVector3 NzVector3& Set(T scale); NzVector3& Set(const T vec[3]); NzVector3& Set(const NzVector2& vec, T Z = 0.0); + NzVector3& Set(const NzVector3& vec); template NzVector3& Set(const NzVector3& vec); T SquaredDistance(const NzVector3& vec) const; @@ -60,8 +61,6 @@ template class NzVector3 NzString ToString() const; - operator NzString() const; - operator T*(); operator const T*() const; diff --git a/include/Nazara/Math/Vector3.inl b/include/Nazara/Math/Vector3.inl index c03d1dd53..3bf42e142 100644 --- a/include/Nazara/Math/Vector3.inl +++ b/include/Nazara/Math/Vector3.inl @@ -232,6 +232,14 @@ NzVector3& NzVector3::Set(const NzVector2& vec, T Z) return *this; } +template +NzVector3& NzVector3::Set(const NzVector3& vec) +{ + std::memcpy(this, &vec, sizeof(NzVector3)); + + return *this; +} + template template NzVector3& NzVector3::Set(const NzVector3& vec) @@ -263,12 +271,6 @@ NzString NzVector3::ToString() const return ss << "Vector3(" << x << ", " << y << ", " << z <<')'; } -template -NzVector3::operator NzString() const -{ - return ToString(); -} - template NzVector3::operator T*() { diff --git a/include/Nazara/Math/Vector4.hpp b/include/Nazara/Math/Vector4.hpp index 9daa32507..b5ce734b5 100644 --- a/include/Nazara/Math/Vector4.hpp +++ b/include/Nazara/Math/Vector4.hpp @@ -40,12 +40,11 @@ template class NzVector4 NzVector4& Set(T scale); NzVector4& Set(const T vec[4]); NzVector4& Set(const NzVector3& vec, T W = 1.0); + NzVector4& Set(const NzVector4& vec); template NzVector4& Set(const NzVector4& vec); NzString ToString() const; - operator NzString() const; - operator T*(); operator const T*() const; diff --git a/include/Nazara/Math/Vector4.inl b/include/Nazara/Math/Vector4.inl index 768a17de6..9523ec792 100644 --- a/include/Nazara/Math/Vector4.inl +++ b/include/Nazara/Math/Vector4.inl @@ -184,6 +184,14 @@ NzVector4& NzVector4::Set(const NzVector3& vec, T W) return *this; } +template +NzVector4& NzVector4::Set(const NzVector4& vec) +{ + std::memcpy(this, &vec, sizeof(NzVector4)); + + return *this; +} + template template NzVector4& NzVector4::Set(const NzVector4& vec) @@ -204,12 +212,6 @@ NzString NzVector4::ToString() const return ss << "Vector4(" << x << ", " << y << ", " << z << ", " << w << ')'; } -template -NzVector4::operator NzString() const -{ - return ToString(); -} - template NzVector4::operator T*() {