Tramway SDK
math.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_FRAMEWORK_MATH_H
5#define TRAM_SDK_FRAMEWORK_MATH_H
6
7#include <glm/glm.hpp>
8#include <glm/gtx/quaternion.hpp>
9
10namespace tram {
11
22
23const vec3 DIRECTION_FORWARD (0.0f, 0.0f, -1.0f);
24const vec3 DIRECTION_SIDE (1.0f, 0.0f, 0.0f);
25const vec3 DIRECTION_UP (0.0f, 1.0f, 0.0f);
26
27const vec3 IDENTITY_POSITION (0.0f, 0.0f, 0.0f);
28const quat IDENTITY_ROTATION (1.0f, 0.0f, 0.0f, 0.0f);
29const vec3 IDENTITY_SCALE (1.0f, 1.0f, 1.0f);
30
31void QuatLookAt(quat& quaternion, const vec3& from, const vec3& to);
32void ProjectLine(vec3& point, const vec3& from, const vec3& to);
33
34vec3 RayTriangleIntersection(vec3 ray_pos, vec3 ray_dir, vec3 point1, vec3 point2, vec3 point3);
35
36void RotateAABB(vec3& min, vec3& max, quat rotation);
37
38mat4 PositionRotationToMatrix(const vec3& position, const quat& rotation);
39mat4 PositionRotationScaleToMatrix(const vec3& position, const quat& rotation, const vec3& scale);
40
41}
42
43#endif // TRAM_SDK_FRAMEWORK_MATH_H
Definition: api.h:9
const vec3 DIRECTION_SIDE(1.0f, 0.0f, 0.0f)
glm::mat2 mat2
Definition: math.h:14
glm::ivec4 ivec4
Definition: math.h:19
glm::vec4 vec4
Definition: math.h:16
glm::vec2 vec2
Definition: math.h:17
glm::ivec3 ivec3
Definition: math.h:18
const vec3 IDENTITY_POSITION(0.0f, 0.0f, 0.0f)
glm::uvec3 uvec3
Definition: math.h:20
glm::vec3 vec3
Definition: math.h:12
const quat IDENTITY_ROTATION(1.0f, 0.0f, 0.0f, 0.0f)
const vec3 IDENTITY_SCALE(1.0f, 1.0f, 1.0f)
glm::quat quat
Definition: math.h:13
vec3 RayTriangleIntersection(vec3 ray_pos, vec3 ray_dir, vec3 point1, vec3 point2, vec3 point3)
Definition: math.cpp:18
void QuatLookAt(quat &quaternion, const vec3 &from, const vec3 &to)
Definition: math.cpp:8
mat4 PositionRotationScaleToMatrix(const vec3 &position, const quat &rotation, const vec3 &scale)
Definition: math.cpp:106
glm::mat4 mat4
Definition: math.h:15
mat4 PositionRotationToMatrix(const vec3 &position, const quat &rotation)
Definition: math.cpp:99
const vec3 DIRECTION_UP(0.0f, 1.0f, 0.0f)
glm::uvec4 uvec4
Definition: math.h:21
const vec3 DIRECTION_FORWARD(0.0f, 0.0f, -1.0f)
void RotateAABB(vec3 &min, vec3 &max, quat rotation)
Definition: math.cpp:72
void ProjectLine(vec3 &point, const vec3 &from, const vec3 &to)
Definition: math.cpp:12