mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-04-10 06:14:07 +08:00
19 lines
486 B
C++
19 lines
486 B
C++
#pragma once
|
|
#include <glm/glm.hpp>
|
|
struct AABB {
|
|
glm::vec3 min{0.0f, 0.0f, 0.0f};
|
|
glm::vec3 max{0.0f, 0.0f, 0.0f};
|
|
|
|
AABB(glm::vec3 min_point, glm::vec3 max_point):
|
|
min(min_point),
|
|
max(max_point)
|
|
{
|
|
|
|
}
|
|
|
|
bool intersects(const AABB& other) const {
|
|
return (min.x <= other.max.x && max.x >= other.min.x) &&
|
|
(min.y <= other.max.y && max.y >= other.min.y) &&
|
|
(min.z <= other.max.z && max.z >= other.min.z);
|
|
}
|
|
}; |