A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
AnmMgr.hh
1#pragma once
2
3#include "game/system/ResourceManager.hh"
4
5#include <abstract/g3d/ResFile.hh>
6
7namespace Render {
8
9class DrawMdl;
10
11enum class AnmType : s32 {
12 Empty = -1,
13 Chr = 0,
14 Clr = 1,
15 Srt = 2,
16 Pat = 3,
17 Shp = 4,
18 Max = 5,
19};
20
22public:
23 AnmNodeChr(Abstract::g3d::AnmObjChrRes anmObjChrRes, AnmType anmType, size_t idx)
24 : m_anmObjChrRes(anmObjChrRes), m_anmType(anmType), m_idx(idx) {}
25
27 [[nodiscard]] f32 frameCount() const {
28 return static_cast<f32>(m_anmObjChrRes.frameCount());
29 }
30
32 [[nodiscard]] f32 frame() const {
33 return m_anmObjChrRes.frame();
34 }
35
36private:
37 Abstract::g3d::AnmObjChrRes m_anmObjChrRes;
38 AnmType m_anmType;
39 size_t m_idx;
40};
41
42class AnmMgr {
43public:
45 AnmMgr(DrawMdl *drawMdl) : m_parent(drawMdl) {}
46
47 void linkAnims(size_t idx, const Abstract::g3d::ResFile *resFile, const char *name,
48 AnmType anmType);
49 void playAnim(f32 frame, f32 rate, size_t idx);
50
52 [[nodiscard]] const AnmNodeChr *activeAnim(AnmType anmType) const {
53 return m_activeAnims[static_cast<size_t>(anmType)];
54 }
55
56private:
57 DrawMdl *m_parent;
58 std::list<AnmNodeChr> m_anmList;
59 std::array<AnmNodeChr *, static_cast<size_t>(AnmType::Max) - 1> m_activeAnims;
60};
61
62} // namespace Render
Represents a binary resource file which contains object models, textures, and animations.
Definition ResFile.hh:15
Pertains to rendering the kart model.