AireEngine
A 3D Open-World Game Engine
Loading...
Searching...
No Matches
mathHelper.h
1#pragma once
2
3#include<assimp/quaternion.h>
4#include<assimp/vector3.h>
5#include<assimp/matrix4x4.h>
6#include<glm/glm.hpp>
7#include<glm/gtc/quaternion.hpp>
8
11{
12public:
16 static inline glm::mat4 ConvertMatrixToGLMFormat(const aiMatrix4x4& from)
17 {
18 glm::mat4 to;
19 //the a,b,c,d in assimp is the row ; the 1,2,3,4 is the column
20 to[0][0] = from.a1; to[1][0] = from.a2; to[2][0] = from.a3; to[3][0] = from.a4;
21 to[0][1] = from.b1; to[1][1] = from.b2; to[2][1] = from.b3; to[3][1] = from.b4;
22 to[0][2] = from.c1; to[1][2] = from.c2; to[2][2] = from.c3; to[3][2] = from.c4;
23 to[0][3] = from.d1; to[1][3] = from.d2; to[2][3] = from.d3; to[3][3] = from.d4;
24 return to;
25 }
26
30 static inline glm::vec3 GetGLMVec(const aiVector3D& vec)
31 {
32 return glm::vec3(vec.x, vec.y, vec.z);
33 }
34
38 static inline glm::quat GetGLMQuat(const aiQuaternion& pOrientation)
39 {
40 return glm::quat(pOrientation.w, pOrientation.x, pOrientation.y, pOrientation.z);
41 }
42};
Helper class for math operations related to 3rd party libraries.
Definition mathHelper.h:11
static glm::quat GetGLMQuat(const aiQuaternion &pOrientation)
Definition mathHelper.h:38
static glm::mat4 ConvertMatrixToGLMFormat(const aiMatrix4x4 &from)
Definition mathHelper.h:16
static glm::vec3 GetGLMVec(const aiVector3D &vec)
Definition mathHelper.h:30