[+] AuVecD2, AuVecD3, AuVecD4

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

View File

@ -19,34 +19,54 @@
#if !defined(_AUHAS_GLM) #if !defined(_AUHAS_GLM)
static int AuMemcmp(const void *dest, const void *src, size_t n); static int AuMemcmp(const void *dest, const void *src, size_t n);
template <int N> template <typename T, int N>
struct AuFVec struct AuGVec
{ {
float elements[N]; T elements[N];
inline bool operator ==(const AuFVec &other) const inline bool operator ==(const AuGVec &other) const
{ {
return AuMemcmp(other.elements, elements, sizeof(elements)) == 0; return AuMemcmp(other.elements, elements, sizeof(elements)) == 0;
} }
inline float operator [](AuUInt idx) const inline T operator [](AuUInt idx) const
{ {
return elements[idx]; return elements[idx];
} }
inline float &operator [](AuUInt idx) inline T &operator [](AuUInt idx)
{ {
return elements[idx]; return elements[idx];
} }
}; };
using AuVec2 = AuFVec<2>; template <int N>
using AuVec3 = AuFVec<3>; using AuFVec = AuGVec<float, N>;
using AuVec4 = AuFVec<4>;
#else template <int N>
#include <glm/glm.hpp> 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;
using AuVec2 = glm::vec2;
using AuVec3 = glm::vec3;
using AuVec4 = glm::vec4;
#endif #endif