[+] AuVecD2, AuVecD3, AuVecD4

This commit is contained in:
Reece Wilson 2024-09-05 21:22:29 +01:00
parent b82d7aa98b
commit 3e73f0b23c

View File

@ -18,35 +18,55 @@
#if !defined(_AUHAS_GLM)
static int AuMemcmp(const void *dest, const void *src, size_t n);
template <int N>
struct AuFVec
{
float elements[N];
inline bool operator ==(const AuFVec &other) const
template <typename T, int N>
struct AuGVec
{
T elements[N];
inline bool operator ==(const AuGVec &other) const
{
return AuMemcmp(other.elements, elements, sizeof(elements)) == 0;
}
inline float operator [](AuUInt idx) const
inline T operator [](AuUInt idx) const
{
return elements[idx];
}
inline float &operator [](AuUInt idx)
inline T &operator [](AuUInt idx)
{
return elements[idx];
}
};
using AuVec2 = AuFVec<2>;
using AuVec3 = AuFVec<3>;
using AuVec4 = AuFVec<4>;
#else
#include <glm/glm.hpp>
using AuVec2 = glm::vec2;
using AuVec3 = glm::vec3;
using AuVec4 = glm::vec4;
template <int N>
using AuFVec = AuGVec<float, N>;
template <int N>
using AuDVec = AuGVec<double, N>;
using AuVecF2 = AuFVec<2>;
using AuVecF3 = AuFVec<3>;
using AuVecF4 = AuFVec<4>;
using AuVecD2 = AuDVec<2>;
using AuVecD3 = AuDVec<3>;
using AuVecD4 = AuDVec<4>;
using AuVec2 = AuVecF2;
using AuVec3 = AuVecF3;
using AuVec4 = AuVecF4;
#else
#include <glm/glm.hpp>
using AuVecF2 = glm::vec2;
using AuVecF3 = glm::vec3;
using AuVecF4 = glm::vec4;
using AuVecD2 = glm::vec<2, double, glm::defaultp>;
using AuVecD3 = glm::vec<3, double, glm::defaultp>;
using AuVecD4 = glm::vec<4, double, glm::defaultp>;
using AuVec2 = AuVecF2;
using AuVec3 = AuVecF3;
using AuVec4 = AuVecF4;
#endif