Math/VectorI: Remove array constructor

This commit is contained in:
Lynix 2018-02-18 18:57:30 +01:00
parent b2d10f6e69
commit 0063ca9950
9 changed files with 8 additions and 44 deletions

View File

@ -69,6 +69,7 @@ Nazara Engine:
- Fix Window triggering KeyPressed event after triggering a resize/movement event on Windows
- (WIP) Add support for materials and callbacks to Physics3D module.
- PhysWorld3D class is now movable
- ⚠️ Removed array/pointer constructor from Vector classes
Nazara Development Kit:
- Added ImageWidget (#139)

View File

@ -242,8 +242,8 @@ namespace Nz
}
#endif
const T* ptr = (&m11) + column*4;
return Vector4<T>(ptr);
const T* ptr = &m11 + column * 4;
return Vector4<T>(ptr[0], ptr[1], ptr[2], ptr[3]);
}
/*!

View File

@ -24,7 +24,6 @@ namespace Nz
Vector2() = default;
Vector2(T X, T Y);
explicit Vector2(T scale);
explicit Vector2(const T vec[2]);
template<typename U> explicit Vector2(const Vector2<U>& vec);
Vector2(const Vector2& vec) = default;
explicit Vector2(const Vector3<T>& vec);

View File

@ -45,18 +45,6 @@ namespace Nz
Set(scale);
}
/*!
* \brief Constructs a Vector2 object from an array of two elements
*
* \param vec[2] vec[0] is X component and vec[1] is Y component
*/
template<typename T>
Vector2<T>::Vector2(const T vec[2])
{
Set(vec);
}
/*!
* \brief Constructs a Vector2 object from another type of Vector2
*

View File

@ -25,7 +25,6 @@ namespace Nz
Vector3(T X, T Y, T Z);
Vector3(T X, const Vector2<T>& vec);
explicit Vector3(T scale);
explicit Vector3(const T vec[3]);
Vector3(const Vector2<T>& vec, T Z = 0.0);
template<typename U> explicit Vector3(const Vector3<U>& vec);
Vector3(const Vector3& vec) = default;

View File

@ -58,17 +58,6 @@ namespace Nz
Set(scale);
}
/*!
* \brief Constructs a Vector3 object from an array of three elements
*
* \param vec[3] vec[0] is X component, vec[1] is Y component and vec[2] is Z component
*/
template<typename T>
Vector3<T>::Vector3(const T vec[3])
{
Set(vec);
}
/*!
* \brief Constructs a Vector3 object from a Vector2<T> and a component
*
@ -522,7 +511,9 @@ namespace Nz
template<typename T>
Vector3<T>& Vector3<T>::Set(const T vec[3])
{
std::memcpy(&x, vec, 3*sizeof(T));
x = vec[0];
y = vec[1];
z = vec[2];
return *this;
}

View File

@ -27,7 +27,6 @@ namespace Nz
Vector4(T X, const Vector2<T>& vec, T W);
Vector4(T X, const Vector3<T>& vec);
explicit Vector4(T scale);
explicit Vector4(const T vec[4]);
Vector4(const Vector2<T>& vec, T Z = 0.0, T W = 1.0);
Vector4(const Vector3<T>& vec, T W = 1.0);
template<typename U> explicit Vector4(const Vector4<U>& vec);

View File

@ -17,7 +17,7 @@ namespace Nz
{
/*!
* \ingroup math
* \ingroup math
* \class Nz::Vector4
* \brief Math class that represents an element of the three dimensional vector space with the notion of projectivity. When the fourth component is 1, it describes an 'usual' point and when it is 0, it represents the point at infinity
*/
@ -90,18 +90,6 @@ namespace Nz
Set(scale);
}
/*!
* \brief Constructs a Vector4 object from an array of four elements
*
* \param vec[4] vec[0] is X component, vec[1] is Y component, vec[2] is Z component and vec[3] is W component
*/
template<typename T>
Vector4<T>::Vector4(const T vec[4])
{
Set(vec);
}
/*!
* \brief Constructs a Vector4 object from a Vector2<T> and two components
*

View File

@ -104,8 +104,7 @@ SCENARIO("Vector3", "[MATH][VECTOR3]")
Nz::Vector2f unit = Nz::Vector2f::Unit();
Nz::Vector3f smaller(-1.f, unit);
float data[3] = { 1.f, unit.x, unit.y };
Nz::Vector3f bigger(data);
Nz::Vector3f bigger(1.f, unit.x, unit.y);
WHEN("We combine divisions and multiplications")
{