Toast Engine
Loading...
Searching...
No Matches
aabb.hpp
Go to the documentation of this file.
1
7
8#pragma once
9
10#include <glm/vec3.hpp>
11#include <optional>
12#include <toast/export.hpp>
13
14namespace physics {
15
16struct TOAST_API AABB {
17 glm::vec3 min {};
18 glm::vec3 max {};
19
20 [[nodiscard]]
21 auto overlaps(const AABB& other) const -> bool;
22 [[nodiscard]]
23 auto contains(const AABB& other) const -> bool;
24 [[nodiscard]]
25 auto expanded(float amount) const -> AABB;
26 [[nodiscard]]
27 auto area() const -> float;
28
29 struct RayHit {
30 float t_min;
31 float t_max;
32 };
33
34 [[nodiscard]]
35 auto intersectRay(const glm::vec3& origin, const glm::vec3& inv_dir) const -> std::optional<RayHit>;
36};
37
38[[nodiscard]]
39auto combine(const AABB& lhs, const AABB& rhs) -> AABB;
40
41[[nodiscard]]
42auto operator+(const AABB& lhs, const AABB& rhs) -> AABB;
43
44}
Definition aabb.hpp:29
Definition aabb.hpp:16