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,
30
const
EGG::Vector3f
&speed) = 0;
31
virtual
const
EGG::Vector3f
&getSupport(
const
EGG::Vector3f
&v)
const
= 0;
32
virtual
f32 getBoundingRadius()
const
= 0;
33
34
bool
check(
ObjectCollisionBase
&rhs,
EGG::Vector3f
&distance);
35
36
protected
:
37
EGG::Vector3f
m_translation;
38
39
private
:
40
bool
enclosesOrigin(
const
GJKState
&state, u32 idx)
const
;
41
void
FUN_808350e4(
GJKState
&state,
EGG::Vector3f
&v)
const
;
42
bool
getNearestSimplex(
GJKState
&state,
EGG::Vector3f
&v)
const
;
43
void
getNearestPoint(
GJKState
&state, u32 idx,
EGG::Vector3f
&v0,
EGG::Vector3f
&v1)
const
;
44
bool
FUN_808357e4(
const
GJKState
&state, u32 idx)
const
;
45
bool
inSimplex(
const
GJKState
&state,
const
EGG::Vector3f
&v)
const
;
46
void
getNearestPoint(
const
GJKState
&state, u32 idx,
EGG::Vector3f
&v)
const
;
47
void
calcSimplex(
GJKState
&state)
const
;
48
49
EGG::Vector3f
m_00;
50
51
static
std::array<std::array<f32, 4>, 4> s_dotProductCache;
52
};
53
54
}
// 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:83
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