7 #ifndef NAZARA_VECTOR4_HPP 8 #define NAZARA_VECTOR4_HPP 10 #include <Nazara/Core/String.hpp> 15 struct SerializationContext;
17 template<
typename T>
class Vector2;
18 template<
typename T>
class Vector3;
25 Vector4(T X, T Y, T Z, T W = 1.0);
26 Vector4(T X, T Y,
const Vector2<T>& vec);
27 Vector4(T X,
const Vector2<T>& vec, T W);
28 Vector4(T X,
const Vector3<T>& vec);
29 explicit Vector4(T scale);
30 Vector4(
const T vec[4]);
31 Vector4(
const Vector2<T>& vec, T Z = 0.0, T W = 1.0);
32 Vector4(
const Vector3<T>& vec, T W = 1.0);
33 template<
typename U>
explicit Vector4(
const Vector4<U>& vec);
34 Vector4(
const Vector4& vec) =
default;
41 Vector4
GetNormal(T* length =
nullptr)
const;
48 Vector4&
Maximize(
const Vector4& vec);
49 Vector4&
Minimize(
const Vector4& vec);
53 Vector4&
Set(T X, T Y, T Z, T W = 1.0);
54 Vector4&
Set(T X, T Y,
const Vector2<T>& vec);
55 Vector4&
Set(T X,
const Vector2<T>& vec, T W);
56 Vector4&
Set(T X,
const Vector3<T>& vec);
57 Vector4&
Set(T scale);
58 Vector4&
Set(
const T vec[4]);
59 Vector4&
Set(
const Vector2<T>& vec, T Z = 0.0, T W = 1.0);
60 Vector4&
Set(
const Vector3<T>& vec, T W = 1.0);
61 Vector4&
Set(
const Vector4<T>& vec);
62 template<
typename U> Vector4&
Set(
const Vector4<U>& vec);
67 operator const T* ()
const;
72 Vector4
operator+(
const Vector4& vec)
const;
73 Vector4
operator-(
const Vector4& vec)
const;
74 Vector4
operator*(
const Vector4& vec)
const;
76 Vector4
operator/(
const Vector4& vec)
const;
78 Vector4& operator=(
const Vector4& other) =
default;
94 static T
DotProduct(
const Vector4& vec1,
const Vector4& vec2);
95 static Vector4
Lerp(
const Vector4& from,
const Vector4& to, T interpolation);
96 static Vector4
Normalize(
const Vector4& vec);
97 static Vector4
UnitX();
98 static Vector4
UnitY();
99 static Vector4
UnitZ();
100 static Vector4
Zero();
105 typedef Vector4<double> Vector4d;
106 typedef Vector4<float> Vector4f;
107 typedef Vector4<int> Vector4i;
108 typedef Vector4<unsigned int> Vector4ui;
109 typedef Vector4<Int32> Vector4i32;
110 typedef Vector4<UInt32> Vector4ui32;
112 template<
typename T>
bool Serialize(SerializationContext& context,
const Vector4<T>& vector);
113 template<
typename T>
bool Unserialize(SerializationContext& context, Vector4<T>* vector);
116 template<
typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector4<T>& vec);
123 template<
class T>
struct hash<
Nz::Vector4<T>>;
126 #include <Nazara/Math/Vector4.inl> 128 #endif // NAZARA_VECTOR4_HPP Vector4 GetNormal(T *length=nullptr) const
Gets a copy normalized of the vector.
Definition: Vector4.inl:185
static Vector4 UnitX()
Shorthand for the vector (1, 0, 0, 1)
Definition: Vector4.inl:962
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Vector4 & operator/=(const Vector4 &vec)
Multiplies the components of other vector to this vector.
Definition: Vector4.inl:756
bool Unserialize(SerializationContext &context, bool *value)
Unserializes a boolean.
Definition: Algorithm.inl:279
static Vector4 UnitY()
Shorthand for the vector (0, 1, 0, 1)
Definition: Vector4.inl:978
String ToString() const
Gives a string representation.
Definition: Vector4.inl:514
const Vector4 & operator+() const
Helps to represent the sign of the vector.
Definition: Vector4.inl:553
static Vector4 Zero()
Shorthand for the vector (0, 0, 0, 1)
Definition: Vector4.inl:1010
bool operator!=(const Vector4 &vec) const
Compares the vector to other one.
Definition: Vector4.inl:831
bool operator>(const Vector4 &vec) const
Compares the vector to other one.
Definition: Vector4.inl:896
Vector4 & MakeUnitY()
Makes the vector (0, 1, 0, 1)
Definition: Vector4.inl:214
Vector4 & Normalize(T *length=nullptr)
Gives the normalized vector.
Definition: Vector4.inl:309
Vector4 operator/(const Vector4 &vec) const
Divides the components of the vector with other vector.
Definition: Vector4.inl:632
bool operator==(const Vector4 &vec) const
Compares the vector to other one.
Definition: Vector4.inl:815
Vector4 & MakeUnitX()
Makes the vector (1, 0, 0, 1)
Definition: Vector4.inl:201
T DotProduct(const Vector4 &vec) const
Calculates the dot (scalar) product with two vectors.
Definition: Vector4.inl:170
bool operator>=(const Vector4 &vec) const
Compares the vector to other one.
Definition: Vector4.inl:909
bool operator<(const Vector4 &vec) const
Compares the vector to other one.
Definition: Vector4.inl:844
bool Serialize(SerializationContext &context, bool value)
Serializes a boolean.
Definition: Algorithm.inl:214
Math class that represents an element of the three dimensional vector space with the notion of projec...
Definition: Matrix4.hpp:23
Vector4 & MakeUnitZ()
Makes the vector (0, 0, 1, 1)
Definition: Vector4.inl:227
Vector4 operator*(const Vector4 &vec) const
Multiplies the components of the vector with other vector.
Definition: Vector4.inl:603
Vector4 & Minimize(const Vector4 &vec)
Sets this vector's components to the minimum of its own and other components.
Definition: Vector4.inl:282
static Vector4 Lerp(const Vector4 &from, const Vector4 &to, T interpolation)
Interpolates the vector to other one with a factor of interpolation.
Definition: Vector4.inl:928
bool operator<=(const Vector4 &vec) const
Compares the vector to other one.
Definition: Vector4.inl:870
T AbsDotProduct(const Vector4 &vec) const
Calculates the absolute dot (scalar) product with two vectors.
Definition: Vector4.inl:155
Vector4 & Set(T X, T Y, T Z, T W=1.0)
Sets the components of the vector.
Definition: Vector4.inl:335
Vector4 & operator*=(const Vector4 &vec)
Multiplies the components of other vector to this vector.
Definition: Vector4.inl:717
Vector4 operator-() const
Negates the components of the vector.
Definition: Vector4.inl:564
Vector4 & Maximize(const Vector4 &vec)
Sets this vector's components to the maximum of its own and other components.
Definition: Vector4.inl:255
Vector4 & operator-=(const Vector4 &vec)
Substracts the components of other vector to this vector.
Definition: Vector4.inl:699
Vector4 & operator+=(const Vector4 &vec)
Adds the components of other vector to this vector.
Definition: Vector4.inl:681
static Vector4 UnitZ()
Shorthand for the vector (0, 0, 1, 1)
Definition: Vector4.inl:994
Vector4 & MakeZero()
Makes the vector (0, 0, 0, 1)
Definition: Vector4.inl:240