Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectCollisionBase.hh
1
#pragma once
2
3
#include <egg/math/Matrix.hh>
4
5
namespace
Field
{
6
8
struct
GJKState
{
9
GJKState
() : m_flags(0), m_idx(0), m_mask(0), m_00c(0), m_scales{{}} {}
10
11
u32 m_flags;
12
u32 m_idx;
13
u32 m_mask;
14
s32 m_00c;
15
std::array<EGG::Vector3f, 4> m_s;
16
std::array<EGG::Vector3f, 4> m_support1;
17
std::array<EGG::Vector3f, 4> m_support2;
18
std::array<std::array<f32, 4>, 16> m_scales;
19
};
20
24
class
ObjectCollisionBase
{
25
public
:
26
ObjectCollisionBase
();
27
virtual
~ObjectCollisionBase
();
28
29
virtual
void
transform(
const
EGG::Matrix34f
&mat,
const
EGG::Vector3f
&scale) = 0;
30
virtual
void
transform(
const
EGG::Matrix34f
&mat,
const
EGG::Vector3f
&scale,
31
const
EGG::Vector3f
&speed) = 0;
32
virtual
const
EGG::Vector3f
&getSupport(
const
EGG::Vector3f
&v)
const
= 0;
33
virtual
f32 getBoundingRadius()
const
= 0;
34
35
bool
check(
ObjectCollisionBase
&rhs,
EGG::Vector3f
&distance);
36
38
[[nodiscard]]
const
EGG::Vector3f
&translation()
const
{
39
return
m_translation;
40
}
41
42
protected
:
43
EGG::Vector3f
m_translation;
44
45
private
:
46
bool
enclosesOrigin(
const
GJKState
&state, u32 idx)
const
;
47
void
FUN_808350e4(
GJKState
&state,
EGG::Vector3f
&v)
const
;
48
bool
getNearestSimplex(
GJKState
&state,
EGG::Vector3f
&v)
const
;
49
void
getNearestPoint(
GJKState
&state, u32 idx,
EGG::Vector3f
&v0,
EGG::Vector3f
&v1)
const
;
50
bool
FUN_808357e4(
const
GJKState
&state, u32 idx)
const
;
51
bool
inSimplex(
const
GJKState
&state,
const
EGG::Vector3f
&v)
const
;
52
void
getNearestPoint(
const
GJKState
&state, u32 idx,
EGG::Vector3f
&v)
const
;
53
void
calcSimplex(
GJKState
&state)
const
;
54
55
EGG::Vector3f
m_00;
56
57
static
std::array<std::array<f32, 4>, 4> s_dotProductCache;
58
};
59
60
}
// namespace Field
EGG::Matrix34f
A 3 x 4 matrix.
Definition
Matrix.hh:8
Field::ObjectCollisionBase
The base class that all objects' collision inherits from.
Definition
ObjectCollisionBase.hh:24
Field
Pertains to collision.
Definition
BoxColManager.cc:8
EGG::Vector3f
A 3D float vector.
Definition
Vector.hh:88
Field::GJKState
Houses the state of an object in terms of the Gilbert–Johnson–Keerthi (GJK) algorithm.
Definition
ObjectCollisionBase.hh:8
game
field
ObjectCollisionBase.hh
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.12.0