OGL Engine 1.2.0-dev
Loading...
Searching...
No Matches
obb.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <glm/glm.hpp>
8#include <glm/gtc/quaternion.hpp>
9
10namespace Engine::Physics {
18 struct OBB {
20 glm::vec3 center;
22 glm::vec3 axes[3];
24 glm::vec3 halfExtents;
25
33 OBB(glm::vec3 pos, glm::vec3 size, glm::quat rot) {
34 center = pos;
35 halfExtents = size * 0.5f;
36
37 glm::mat3 rotMat = glm::mat3_cast(rot);
38
39 // Chaque colonne de rotMat est un axe local unitaire
40 axes[0] = rotMat[0]; // X local
41 axes[1] = rotMat[1]; // Y local
42 axes[2] = rotMat[2]; // Z local
43 }
44 };
45}
Definition aabb.hpp:10
glm::vec3 halfExtents
La moitié de la distance sur laquelle chaque axe s'étend.
Definition obb.hpp:24
glm::vec3 axes[3]
Les 3 axes XYZ orientés de la box.
Definition obb.hpp:22
glm::vec3 center
La position centrale de l'OBB.
Definition obb.hpp:20
OBB(glm::vec3 pos, glm::vec3 size, glm::quat rot)
Construit une nouvelle OBB.
Definition obb.hpp:33