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