Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
ObjectBase.hh
1
#pragma once
2
3
#include "game/field/BoxColManager.hh"
4
#include "game/field/RailInterpolator.hh"
5
#include "game/field/obj/ObjectId.hh"
6
7
#include "game/render/DrawMdl.hh"
8
9
#include "game/system/map/MapdataGeoObj.hh"
10
11
#include <egg/math/Matrix.hh>
12
13
namespace
Field
{
14
15
class
ObjectBase
{
16
public
:
17
ObjectBase
(
const
System::MapdataGeoObj
¶ms);
18
virtual
~ObjectBase
();
19
20
virtual
void
init() {}
21
virtual
void
calc() {}
22
virtual
void
calcModel();
23
virtual
void
load() = 0;
24
[[nodiscard]]
virtual
const
char
*getResources()
const
;
25
virtual
void
loadGraphics();
26
virtual
void
loadAnims() {}
27
virtual
void
createCollision() = 0;
28
virtual
void
loadRail();
29
virtual
void
calcCollisionTransform() = 0;
30
32
[[nodiscard]]
virtual
u32
loadFlags()
const
{
33
// TODO: This references LOD to determine load flags
34
return
0;
35
}
36
37
[[nodiscard]]
virtual
const
char
*getKclName()
const
;
38
40
[[nodiscard]]
virtual
const
EGG::Vector3f
&getPosition()
const
{
41
return
m_pos;
42
}
43
45
[[nodiscard]]
virtual
f32 getCollisionRadius()
const
{
46
return
100.0f;
47
}
48
50
[[nodiscard]] ObjectId id()
const
{
51
return
m_id;
52
}
53
54
void
setPos(
const
EGG::Vector3f
&pos) {
55
m_flags |= 0x1;
56
m_pos = pos;
57
}
58
59
protected
:
60
void
calcTransform();
61
void
linkAnims(
const
std::span<const char *> &names,
const
std::span<Render::AnmType> types);
62
void
setMatrixTangentTo(
const
EGG::Vector3f
&up,
const
EGG::Vector3f
&tangent);
63
64
static
EGG::Vector3f
RotateAxisAngle(f32 angle,
const
EGG::Vector3f
&axis,
65
const
EGG::Vector3f
&v1);
66
static
void
SetRotTangentHorizontal(
EGG::Matrix34f
&mat,
const
EGG::Vector3f
&up,
67
const
EGG::Vector3f
&tangent);
68
70
[[nodiscard]]
static
EGG::Vector3f
Interpolate(f32 t,
const
EGG::Vector3f
&v0,
71
const
EGG::Vector3f
&v1) {
72
return
v0 + (v1 - v0) * t;
73
}
74
75
Render::DrawMdl
*m_drawMdl;
76
Abstract::g3d::ResFile
*m_resFile;
77
ObjectId m_id;
78
RailInterpolator
*m_railInterpolator;
79
BoxColUnit
*m_boxColUnit;
80
u16
m_flags;
81
EGG::Vector3f
m_pos;
82
EGG::Vector3f
m_rot;
83
EGG::Vector3f
m_scale;
84
EGG::Matrix34f
m_transform;
85
const
System::MapdataGeoObj
*m_mapObj;
86
};
87
88
}
// namespace Field
Abstract::g3d::ResFile
Represents a binary resource file which contains object models, textures, and animations.
Definition
ResFile.hh:15
EGG::Matrix34f
A 3 x 4 matrix.
Definition
Matrix.hh:8
Field::ObjectBase
Definition
ObjectBase.hh:15
Field::RailInterpolator
Definition
RailInterpolator.hh:13
Render::DrawMdl
Definition
DrawMdl.hh:7
System::MapdataGeoObj
Definition
MapdataGeoObj.hh:9
uint16_t
uint32_t
Field
Pertains to collision.
Definition
BoxColManager.cc:8
EGG::Vector3f
A 3D float vector.
Definition
Vector.hh:87
Field::BoxColUnit
A representation of the boundaries of an entity that has dynamic collision.
Definition
BoxColManager.hh:32
game
field
obj
ObjectBase.hh
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.12.0