2023-08-27 03:12:04 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace rage
|
|
|
|
{
|
|
|
|
template<typename T>
|
|
|
|
union vector2
|
|
|
|
{
|
|
|
|
T data[2];
|
|
|
|
struct { T x, y; };
|
|
|
|
|
2023-09-30 05:45:35 +08:00
|
|
|
constexpr vector2(T x, T y) :
|
2023-08-27 03:12:04 +08:00
|
|
|
x(x),
|
|
|
|
y(y)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-09-30 05:45:35 +08:00
|
|
|
constexpr vector2() :
|
2023-08-27 03:12:04 +08:00
|
|
|
x(),
|
|
|
|
y()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
union vector3
|
|
|
|
{
|
|
|
|
T data[3];
|
|
|
|
struct { T x, y, z; };
|
|
|
|
|
2023-09-30 05:45:35 +08:00
|
|
|
constexpr vector3(T x, T y, T z) :
|
2023-08-27 03:12:04 +08:00
|
|
|
x(x),
|
|
|
|
y(y),
|
|
|
|
z(z)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-09-30 05:45:35 +08:00
|
|
|
constexpr vector3() :
|
2023-08-27 03:12:04 +08:00
|
|
|
x(),
|
|
|
|
y(),
|
|
|
|
z()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
union vector4
|
|
|
|
{
|
|
|
|
T data[4];
|
|
|
|
struct { T x, y, z, w; };
|
|
|
|
|
2023-09-30 05:45:35 +08:00
|
|
|
constexpr vector4(T x, T y, T z, T w) :
|
2023-08-27 03:12:04 +08:00
|
|
|
x(x),
|
|
|
|
y(y),
|
|
|
|
z(z),
|
|
|
|
w(w)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2023-09-30 05:45:35 +08:00
|
|
|
constexpr vector4() :
|
2023-08-27 03:12:04 +08:00
|
|
|
x(),
|
|
|
|
y(),
|
|
|
|
z(),
|
|
|
|
w()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
union matrix34
|
|
|
|
{
|
|
|
|
T data[3][4];
|
|
|
|
struct { struct { T x, y, z, w; } rows[3]; };
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
union matrix44
|
|
|
|
{
|
|
|
|
T data[4][4];
|
|
|
|
struct { struct { T x, y, z, w; } rows[4]; };
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef vector2<float> fvector2;
|
|
|
|
typedef vector3<float> fvector3;
|
|
|
|
typedef vector4<float> fvector4;
|
|
|
|
typedef matrix34<float> fmatrix34;
|
|
|
|
typedef matrix44<float> fmatrix44;
|
2023-10-09 21:01:36 +08:00
|
|
|
}
|