AuroraRuntime/Include/auROXTL/auVector.hpp
J Reece Wilson b29f8ebf21 [*] Major fix -> vec wrapper w/o glm accessors were broken
[*] Preemptive linux/clang API fixes
[*] Fix clang equiv MSVC template bug (they're nice enough to throw an error instead of crashing)
2022-03-20 09:56:15 +00:00

48 lines
1.0 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: auVector.hpp
Date: 2022-2-1
Author: Reece
***/
#pragma once
#if defined(__has_include) && !defined(_AUHAS_GLM) && defined(_AU_DETECT_GLM)
#if __has_include(<glm/glm.hpp>)
#define _AUHAS_GLM
#endif
#endif
#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<N> &other) const
{
return AuMemcmp(other.elements, elements, sizeof(elements)) == 0;
}
inline float operator [](int idx) const
{
return elements[idx];
}
inline float &operator [](int idx)
{
return elements[idx];
}
};
using AuVec3 = AuFVec<3>;
using AuVec4 = AuFVec<4>;
#else
#include <glm/glm.hpp>
using AuVec3 = glm::vec3;
using AuVec4 = glm::vec4;
#endif