Math/VectorI: Remove array constructor
This commit is contained in:
parent
b2d10f6e69
commit
0063ca9950
|
|
@ -69,6 +69,7 @@ Nazara Engine:
|
||||||
- Fix Window triggering KeyPressed event after triggering a resize/movement event on Windows
|
- Fix Window triggering KeyPressed event after triggering a resize/movement event on Windows
|
||||||
- (WIP) Add support for materials and callbacks to Physics3D module.
|
- (WIP) Add support for materials and callbacks to Physics3D module.
|
||||||
- PhysWorld3D class is now movable
|
- PhysWorld3D class is now movable
|
||||||
|
- ⚠️ Removed array/pointer constructor from Vector classes
|
||||||
|
|
||||||
Nazara Development Kit:
|
Nazara Development Kit:
|
||||||
- Added ImageWidget (#139)
|
- Added ImageWidget (#139)
|
||||||
|
|
|
||||||
|
|
@ -242,8 +242,8 @@ namespace Nz
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const T* ptr = (&m11) + column*4;
|
const T* ptr = &m11 + column * 4;
|
||||||
return Vector4<T>(ptr);
|
return Vector4<T>(ptr[0], ptr[1], ptr[2], ptr[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ namespace Nz
|
||||||
Vector2() = default;
|
Vector2() = default;
|
||||||
Vector2(T X, T Y);
|
Vector2(T X, T Y);
|
||||||
explicit Vector2(T scale);
|
explicit Vector2(T scale);
|
||||||
explicit Vector2(const T vec[2]);
|
|
||||||
template<typename U> explicit Vector2(const Vector2<U>& vec);
|
template<typename U> explicit Vector2(const Vector2<U>& vec);
|
||||||
Vector2(const Vector2& vec) = default;
|
Vector2(const Vector2& vec) = default;
|
||||||
explicit Vector2(const Vector3<T>& vec);
|
explicit Vector2(const Vector3<T>& vec);
|
||||||
|
|
|
||||||
|
|
@ -45,18 +45,6 @@ namespace Nz
|
||||||
Set(scale);
|
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
|
* \brief Constructs a Vector2 object from another type of Vector2
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ namespace Nz
|
||||||
Vector3(T X, T Y, T Z);
|
Vector3(T X, T Y, T Z);
|
||||||
Vector3(T X, const Vector2<T>& vec);
|
Vector3(T X, const Vector2<T>& vec);
|
||||||
explicit Vector3(T scale);
|
explicit Vector3(T scale);
|
||||||
explicit Vector3(const T vec[3]);
|
|
||||||
Vector3(const Vector2<T>& vec, T Z = 0.0);
|
Vector3(const Vector2<T>& vec, T Z = 0.0);
|
||||||
template<typename U> explicit Vector3(const Vector3<U>& vec);
|
template<typename U> explicit Vector3(const Vector3<U>& vec);
|
||||||
Vector3(const Vector3& vec) = default;
|
Vector3(const Vector3& vec) = default;
|
||||||
|
|
|
||||||
|
|
@ -58,17 +58,6 @@ namespace Nz
|
||||||
Set(scale);
|
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
|
* \brief Constructs a Vector3 object from a Vector2<T> and a component
|
||||||
*
|
*
|
||||||
|
|
@ -522,7 +511,9 @@ namespace Nz
|
||||||
template<typename T>
|
template<typename T>
|
||||||
Vector3<T>& Vector3<T>::Set(const T vec[3])
|
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;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ namespace Nz
|
||||||
Vector4(T X, const Vector2<T>& vec, T W);
|
Vector4(T X, const Vector2<T>& vec, T W);
|
||||||
Vector4(T X, const Vector3<T>& vec);
|
Vector4(T X, const Vector3<T>& vec);
|
||||||
explicit Vector4(T scale);
|
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 Vector2<T>& vec, T Z = 0.0, T W = 1.0);
|
||||||
Vector4(const Vector3<T>& vec, T W = 1.0);
|
Vector4(const Vector3<T>& vec, T W = 1.0);
|
||||||
template<typename U> explicit Vector4(const Vector4<U>& vec);
|
template<typename U> explicit Vector4(const Vector4<U>& vec);
|
||||||
|
|
|
||||||
|
|
@ -90,18 +90,6 @@ namespace Nz
|
||||||
Set(scale);
|
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
|
* \brief Constructs a Vector4 object from a Vector2<T> and two components
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,7 @@ SCENARIO("Vector3", "[MATH][VECTOR3]")
|
||||||
Nz::Vector2f unit = Nz::Vector2f::Unit();
|
Nz::Vector2f unit = Nz::Vector2f::Unit();
|
||||||
Nz::Vector3f smaller(-1.f, unit);
|
Nz::Vector3f smaller(-1.f, unit);
|
||||||
|
|
||||||
float data[3] = { 1.f, unit.x, unit.y };
|
Nz::Vector3f bigger(1.f, unit.x, unit.y);
|
||||||
Nz::Vector3f bigger(data);
|
|
||||||
|
|
||||||
WHEN("We combine divisions and multiplications")
|
WHEN("We combine divisions and multiplications")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue