Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
collision.hpp
Go to the documentation of this file.
1
7
8
#pragma once
9
10
#include "
body.hpp
"
11
#include "
shape.hpp
"
12
13
#include <compare>
14
#include <utility>
15
16
namespace
physics {
17
18
struct
BodyShapeKey
{
19
BodyID
body;
20
ShapeID
shape;
21
auto
operator<=>(
const
BodyShapeKey
&)
const
=
default
;
22
};
23
24
struct
BroadPhasePair
{
25
BodyShapeKey
a;
26
BodyShapeKey
b;
27
auto
operator<=>(
const
BroadPhasePair
&)
const
=
default
;
28
};
29
30
[[nodiscard]]
31
inline
auto
canonicalPair(
BodyShapeKey
first,
BodyShapeKey
second) ->
BroadPhasePair
{
32
if
(second < first) {
33
std::swap(first, second);
34
}
35
return
{.a = first, .b = second};
36
}
37
38
inline
constexpr
uint8_t k_primitive_manifold_normal_index = 0xFFu;
39
40
}
body.hpp
Body identifiers, creation data, and copied runtime state.
shape.hpp
Shape identifiers, geometry, and runtime records.
physics::BodyID
Definition
body.hpp:20
physics::BodyShapeKey
Definition
collision.hpp:18
physics::BroadPhasePair
Definition
collision.hpp:24
physics::ShapeID
Definition
shape.hpp:29
engine
src
toast
physics
collision.hpp
Generated by
1.17.0