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
7#include <egg/core/Allocator.hh>
8
9namespace Kinoko::Render {
10
11class DrawMdl;
12
13enum class AnmType : s32 {
14 Empty = -1,
15 Chr = 0,
16 Clr = 1,
17 Srt = 2,
18 Pat = 3,
19 Shp = 4,
20 Max = 5,
21};
22
23class AnmNodeChr {
24public:
25 AnmNodeChr(Abstract::g3d::AnmObjChrRes anmObjChrRes, AnmType anmType, size_t idx)
26 : m_anmObjChrRes(anmObjChrRes), m_anmType(anmType), m_idx(idx) {}
27
29 [[nodiscard]] f32 frameCount() const {
30 return static_cast<f32>(m_anmObjChrRes.frameCount());
31 }
32
34 [[nodiscard]] f32 frame() const {
35 return m_anmObjChrRes.frame();
36 }
37
38private:
39 Abstract::g3d::AnmObjChrRes m_anmObjChrRes;
40 [[maybe_unused]] AnmType m_anmType;
41 [[maybe_unused]] size_t m_idx;
42};
43
44class AnmMgr {
45public:
47 AnmMgr(DrawMdl *drawMdl) : m_parent(drawMdl) {}
48
49 void linkAnims(size_t idx, const Abstract::g3d::ResFile *resFile, const char *name,
50 AnmType anmType);
51 void playAnim(f32 frame, f32 rate, size_t idx);
52
54 [[nodiscard]] const AnmNodeChr *activeAnim(AnmType anmType) const {
55 return m_activeAnims[static_cast<size_t>(anmType)];
56 }
57
58private:
59 [[maybe_unused]] DrawMdl *m_parent;
60 std::list<AnmNodeChr, EGG::Allocator<AnmNodeChr>> m_anmList;
61 std::array<AnmNodeChr *, static_cast<size_t>(AnmType::Max) - 1> m_activeAnims;
62};
63
64} // namespace Kinoko::Render
Represents a binary resource file which contains object models, textures, and animations.
Definition ResFile.hh:14
Pertains to rendering the kart model.