CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Quaternion.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Forward.hpp"
12
14
15#include <glm/ext/quaternion_geometric.hpp>
16#include <glm/ext/quaternion_transform.hpp>
17#include <glm/ext/quaternion_trigonometric.hpp>
18#include <glm/gtc/quaternion.hpp>
19
20namespace CeresEngine::inline Math {
21
23 template<typename T = double> using TQuaternion = glm::qua<T, glm::highp>;
24
26 using Quaternion CE_SCRIPT_EXPORT(name = "Quaternion<double>", external = true, plain = true)
28
30 using Quaternionf CE_SCRIPT_EXPORT(name = "Quaternion<float>", external = true, plain = true)
32
33} // namespace CeresEngine::inline Math
34
35#define IMPORT_FROM_GLM(Symbol) \
36 namespace CeresEngine::inline Math { \
37 using glm::Symbol; \
38 }
40IMPORT_FROM_GLM(slerp)
41IMPORT_FROM_GLM(conjugate)
42IMPORT_FROM_GLM(eulerAngles)
44IMPORT_FROM_GLM(pitch)
46IMPORT_FROM_GLM(angle)
47IMPORT_FROM_GLM(angleAxis)
48#undef IMPORT_FROM_GLM
49
50template<typename T> struct std::hash<CeresEngine::Math::TQuaternion<T>> {
51 using Type = CeresEngine::Math::TQuaternion<T>;
52 constexpr size_t operator()(const Type& obj) const { return CeresEngine::hash(obj[0], obj[1], obj[2], obj[4]); }
53};
54
55#define REFL_DECLARE_CE_QUATERNION(T)
#define CE_SCRIPT_EXPORT(...)
The CE_SCRIPT_EXPORT macro marks a class or method as exportable and available in scripting environme...
Definition Macros.hpp:247
#define IMPORT_FROM_GLM(Symbol)
Definition Quaternion.hpp:35
#define REFL_DECLARE_CE_QUATERNION(T)
Definition Quaternion.hpp:55
Definition Application.hpp:19
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Angle.hpp:20
glm::qua< T, glm::highp > TQuaternion
A quaternion type that uses a internal representation of type T
Definition Quaternion.hpp:23
TQuaternion< double > Quaternion
A quaternion type. Data is internally represented as double.
Definition Quaternion.hpp:27
TQuaternion< float > Quaternionf
A quaternion type. Data is internally represented as float.
Definition Quaternion.hpp:31