NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_anmchr.h
1#ifndef NW4R_G3D_ANM_CHR_H
2#define NW4R_G3D_ANM_CHR_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/g3d/g3d_anmobj.h>
6#include <nw4r/g3d/res/g3d_resanmchr.h>
7
8namespace nw4r {
9namespace g3d {
10
11/******************************************************************************
12 *
13 * AnmObjChr
14 *
15 ******************************************************************************/
16// Forward declarations
17class AnmObjChrRes;
18
19class AnmObjChr : public AnmObj {
20public:
21 enum BindOption { BIND_ONE, BIND_PARTIAL, NUM_OF_BIND_OPTION };
22
23public:
24 AnmObjChr(MEMAllocator* pAllocator, u16* pBindingBuf, int numBinding);
25 virtual void G3dProc(ulong task, ulong param, void* pInfo) = 0; // at 0xC
26 virtual ~AnmObjChr() {} // at 0x10
27
28 virtual void SetFrame(f32 frame) = 0; // at 0x1C
29 virtual f32 GetFrame() const = 0; // at 0x20
30 virtual void UpdateFrame() = 0; // at 0x24
31
32 virtual void SetUpdateRate(f32 rate) = 0; // at 0x28
33 virtual f32 GetUpdateRate() const = 0; // at 0x2C
34
35 virtual bool Bind(const ResMdl mdl) = 0; // at 0x30
36 virtual void Release(); // at 0x34
37
38 virtual const ChrAnmResult* GetResult(ChrAnmResult* pResult,
39 ulong idx) = 0; // at 0x38
40
41 virtual AnmObjChrRes* Attach(int idx, AnmObjChrRes* pRes); // at 0x3C
42 virtual AnmObjChrRes* Detach(int idx); // at 0x40
43 virtual void DetachAll(); // at 0x44
44
45 virtual void SetWeight(int idx, f32 weight); // at 0x48
46 virtual f32 GetWeight(int idx) const; // at 0x4C
47
48 virtual bool Bind(const ResMdl mdl, ulong target,
49 BindOption option) = 0; // at 0x50
50 virtual void Release(const ResMdl mdl, ulong target,
51 BindOption option) = 0; // at 0x54
52
53 bool TestExistence(ulong idx) const;
54 bool TestDefined(ulong idx) const;
55
56 void UseQuaternionBlend(bool enable) {
57 SetAnmFlag(FLAG_USE_QUATERNION_ROTATION_BLEND, enable);
58 }
59
60 void UseAccurateScaleBlend(bool enable) {
61 SetAnmFlag(FLAG_USE_ACCURATE_SCALE_BLEND, enable);
62 }
63
64protected:
65 enum BindingFlag {
66 BINDING_ID_MASK = (1 << 14) - 1,
67 BINDING_INVALID = (1 << 14),
68 BINDING_UNDEFINED = (1 << 15),
69 };
70
71protected:
72 static const int DEFAULT_MAX_CHILDREN = 4;
73
74protected:
75 int mNumBinding; // at 0x10
76 u16* const mpBinding; // at 0x14
77
78 NW4R_G3D_RTTI_DECL_DERIVED(AnmObjChr, AnmObj);
79};
80
81/******************************************************************************
82 *
83 * AnmObjChrNode
84 *
85 ******************************************************************************/
86class AnmObjChrNode : public AnmObjChr {
87public:
88 AnmObjChrNode(MEMAllocator* pAllocator, u16* pBindingBuf, int numBinding,
89 AnmObjChrRes** ppChildrenBuf, int numChildren);
90 virtual void G3dProc(ulong task, ulong param, void* pInfo); // at 0xC
91 virtual ~AnmObjChrNode(); // at 0x10
92
93 virtual void SetFrame(f32 frame); // at 0x1C
94 virtual f32 GetFrame() const; // at 0x20
95 virtual void UpdateFrame(); // at 0x24
96
97 virtual void SetUpdateRate(f32 rate); // at 0x28
98 virtual f32 GetUpdateRate() const; // at 0x2C
99
100 virtual bool Bind(const ResMdl mdl); // at 0x30
101 virtual void Release(); // at 0x34
102
103 virtual AnmObjChrRes* Attach(int idx, AnmObjChrRes* pRes); // at 0x3C
104 virtual AnmObjChrRes* Detach(int idx); // at 0x40
105 virtual void DetachAll(); // at 0x44
106
107 virtual bool Bind(const ResMdl mdl, ulong target,
108 BindOption option); // at 0x50
109 virtual void Release(const ResMdl mdl, ulong target,
110 BindOption option); // at 0x54
111
112 int Size() const { return mChildrenArraySize; }
113 AnmObjChrRes* GetChild(int idx) const { return mpChildrenArray[idx]; }
114
115protected:
116 int mChildrenArraySize; // at 0x18
117 AnmObjChrRes** mpChildrenArray; // at 0x1C
118
119 NW4R_G3D_RTTI_DECL_DERIVED(AnmObjChrNode, AnmObjChr);
120};
121
122/******************************************************************************
123 *
124 * AnmObjChrBlend
125 *
126 ******************************************************************************/
127class AnmObjChrBlend : public AnmObjChrNode {
128public:
129 static AnmObjChrBlend* Construct(MEMAllocator* pAllocator, size_t* pSize,
130 ResMdl mdl, int numChildren);
131
132 AnmObjChrBlend(MEMAllocator* pAllocator, u16* pBindingBuf, int numBinding,
133 AnmObjChrRes** ppChildrenBuf, int numChildren,
134 f32* pWeightBuf);
135
136 virtual ~AnmObjChrBlend() {} // at 0x10
137
138 virtual const ChrAnmResult* GetResult(ChrAnmResult* pResult,
139 ulong idx); // at 0x38
140
141 virtual void SetWeight(int idx, f32 weight); // at 0x48
142 virtual f32 GetWeight(int idx) const; // at 0x4C
143
144private:
145 f32* mpWeightArray; // at 0x20
146
147 NW4R_G3D_RTTI_DECL_DERIVED(AnmObjChrBlend, AnmObjChrNode);
148};
149
150/******************************************************************************
151 *
152 * AnmObjChrRes
153 *
154 ******************************************************************************/
155class AnmObjChrRes : public AnmObjChr, protected FrameCtrl {
156public:
157 static AnmObjChrRes* Construct(MEMAllocator* pAllocator, size_t* pSize,
158 ResAnmChr chr, ResMdl mdl, bool cache);
159
160 AnmObjChrRes(MEMAllocator* pAllocator, ResAnmChr chr, u16* pBindingBuf,
161 int numBinding, ChrAnmResult* pCacheBuf);
162 virtual void G3dProc(ulong task, ulong param, void* pInfo); // at 0xC
163 virtual ~AnmObjChrRes() {} // at 0x10
164
165 virtual void SetFrame(f32 frame); // at 0x1C
166 virtual f32 GetFrame() const; // at 0x20
167 virtual void UpdateFrame(); // at 0x24
168
169 virtual void SetUpdateRate(f32 rate); // at 0x28
170 virtual f32 GetUpdateRate() const; // at 0x2C
171
172 virtual bool Bind(const ResMdl mdl); // at 0x30
173 using AnmObjChr::Release; // at 0x40
174
175 virtual const ChrAnmResult* GetResult(ChrAnmResult* pResult,
176 ulong idx); // at 0x38
177
178 virtual bool Bind(const ResMdl mdl, ulong target,
179 BindOption option); // at 0x50
180 virtual void Release(const ResMdl mdl, ulong target,
181 BindOption option); // at 0x54
182
183 void UpdateCache();
184
185 ResAnmChr GetResAnm() {
186 return mRes;
187 }
188
189 void SetPlayPolicy(PlayPolicyFunc pFunc) {
190 FrameCtrl::SetPlayPolicy(pFunc);
191 }
192
193private:
194 ResAnmChr mRes; // at 0x2C
195 ChrAnmResult* const mpResultCache; // at 0x30
196
197 NW4R_G3D_RTTI_DECL_DERIVED(AnmObjChrRes, AnmObjChr);
198};
199
200} // namespace g3d
201} // namespace nw4r
202
203#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10