Add vector constructors (#115)

This commit is contained in:
maybegreat48 2023-05-09 20:18:42 +00:00 committed by GitHub
parent 66a0c32e1d
commit 22b0242869

View File

@ -7,6 +7,18 @@ namespace rage
{ {
T data[2]; T data[2];
struct { T x, y; }; struct { T x, y; };
vector2(T x, T y) :
x(x),
y(y)
{
}
vector2() :
x(),
y()
{
}
}; };
template<typename T> template<typename T>
@ -14,6 +26,20 @@ namespace rage
{ {
T data[3]; T data[3];
struct { T x, y, z; }; struct { T x, y, z; };
vector3(T x, T y, T z) :
x(x),
y(y),
z(z)
{
}
vector3() :
x(),
y(),
z()
{
}
}; };
template<typename T> template<typename T>
@ -21,20 +47,36 @@ namespace rage
{ {
T data[4]; T data[4];
struct { T x, y, z, w; }; struct { T x, y, z, w; };
vector4(T x, T y, T z, T w) :
x(x),
y(y),
z(z),
w(w)
{
}
vector4() :
x(),
y(),
z(),
w()
{
}
}; };
template<typename T> template<typename T>
union matrix34 union matrix34
{ {
T data[3][4]; T data[3][4];
struct { struct {T x, y, z, w; } rows[3];}; struct { struct { T x, y, z, w; } rows[3]; };
}; };
template<typename T> template<typename T>
union matrix44 union matrix44
{ {
T data[4][4]; T data[4][4];
struct { struct {T x, y, z, w; } rows[4];}; struct { struct { T x, y, z, w; } rows[4]; };
}; };
typedef vector2<float> fvector2; typedef vector2<float> fvector2;