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