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