51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
/***
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: auVector.hpp
|
|
Date: 2022-2-1
|
|
File: AuroraUtils.hpp
|
|
File: auROXTLUtils.hpp
|
|
Date: 2021-6-9
|
|
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 &other) const
|
|
{
|
|
return AuMemcmp(other.elements, elements, sizeof(elements)) == 0;
|
|
}
|
|
|
|
inline float operator [](AuUInt idx) const
|
|
{
|
|
return elements[idx];
|
|
}
|
|
|
|
inline float &operator [](AuUInt 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
|