NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_scnmdlsmpl.h
1#ifndef NW4R_G3D_SCN_MDL_SMPL_H
2#define NW4R_G3D_SCN_MDL_SMPL_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/g3d/g3d_calcview.h>
6#include <nw4r/g3d/g3d_scnobj.h>
7#include <nw4r/g3d/res/g3d_resmdl.h>
8
9#include <nw4r/math.h>
10
11namespace nw4r {
12namespace g3d {
13
14// Forward declarations
15class AnmObj;
16class AnmObjChr;
17class AnmObjVis;
18class AnmObjMatClr;
19class AnmObjTexPat;
20class AnmObjTexSrt;
22
23class ScnMdlSimple : public ScnLeaf {
24public:
25 enum AnmObjType {
26 ANMOBJTYPE_CHR,
27 ANMOBJTYPE_VIS,
28 ANMOBJTYPE_MATCLR,
29 ANMOBJTYPE_TEXPAT,
30 ANMOBJTYPE_TEXSRT,
31 ANMOBJTYPE_SHP,
32 ANMOBJTYPE_NOT_SPECIFIED,
33
34 ANMOBJTYPE_VTX = ANMOBJTYPE_SHP
35 };
36
37 enum ByteCodeType {
38 BYTE_CODE_CALC,
39 BYTE_CODE_MIX,
40 BYTE_CODE_DRAW_OPA,
41 BYTE_CODE_DRAW_XLU,
42 };
43
44#define OPT(KEY, VALUE) OPTID_##KEY = (0x20000 | (VALUE))
45 enum ScnMdlSimpleOption {
46 OPT(NONE, 0),
47 OPT(IGNORE_ANMCHR_TRANS, 1),
48 };
49#undef OPT
50
51public:
52 static ScnMdlSimple* Construct(MEMAllocator* pAllocator, size_t* pSize,
53 ResMdl mdl, int numView);
54
55 ScnMdlSimple(MEMAllocator* pAllocator, ResMdl mdl,
56 math::MTX34* pWorldMtxArray, ulong* pWorldMtxAttribArray,
57 math::MTX34* pViewPosMtxArray, math::MTX33* pViewNrmMtxArray,
58 math::MTX34* pViewTexMtxArray, int numView, int numViewMtx);
59
60 virtual void G3dProc(ulong task, ulong param, void* pInfo); // at 0xC
61 virtual ~ScnMdlSimple(); // at 0x10
62
63 virtual bool SetScnObjOption(ulong option, ulong value); // at 0x20
64 virtual bool GetScnObjOption(ulong option, ulong* pValue) const; // at 0x24
65
66 virtual bool SetAnmObj(AnmObj* pObj, AnmObjType type); // at 0x34
67 virtual bool RemoveAnmObj(AnmObj* pObj); // at 0x38
68 virtual AnmObj* RemoveAnmObj(AnmObjType type); // at 0x3C
69 virtual AnmObj* GetAnmObj(AnmObjType type); // at 0x40
70 virtual const AnmObj* GetAnmObj(AnmObjType type) const; // at 0x44
71
72 bool GetScnMtxPos(math::MTX34* pMtx, ScnObjMtxType type, size_t idx) const;
73
74 void UpdateFrame();
75
76 void EnableScnMdlCallbackTiming(Timing timing);
77 void DisableScnMdlCallbackTiming(Timing timing);
78
79 math::MTX34* GetViewPosMtxArray();
80 const math::MTX34* GetViewPosMtxArray() const;
81
82 math::MTX33* GetViewNrmMtxArray();
83 const math::MTX33* GetViewNrmMtxArray() const;
84
85 math::MTX34* GetViewTexMtxArray();
86 const math::MTX34* GetViewTexMtxArray() const;
87
88 const u8* GetByteCode(ByteCodeType type) const;
89
90 ResMdl GetResMdl() {
91 return mResMdl;
92 }
93 const ResMdl GetResMdl() const {
94 return mResMdl;
95 }
96
97 math::MTX34* GetWldMtxArray() {
98 return mpWorldMtxArray;
99 }
100 ulong* GetWldMtxAttribArray() {
101 return mpWorldMtxAttribArray;
102 }
103
104 ulong GetNumViewMtx() const {
105 return mNumViewMtx;
106 }
107
108 const u8* GetByteCodeCalc() {
109 return mpByteCodeCalc;
110 }
111 const u8* GetByteCodeMix() {
112 return mpByteCodeMix;
113 }
114 const u8* GetByteCodeDrawOpa() {
115 return mpByteCodeDrawOpa;
116 }
117 const u8* GetByteCodeDrawXlu() {
118 return mpByteCodeDrawXlu;
119 }
120
121 ResMdlDrawMode GetDrawMode() const {
122 return mDrawMode;
123 }
124
125 void SetScnMdlCallback(ICalcWorldCallback* pCallback) {
126 mpCalcWorldCallback = pCallback;
127 }
128 ICalcWorldCallback* GetScnMdlCallback() {
129 return mpCalcWorldCallback;
130 }
131
132 u8 GetScnMdlCallbackTiming() const {
133 return mCwcbTiming;
134 }
135
136 void SetScnMdlCallbackNodeID(ulong id) {
137 mCwcbNodeID = id;
138 }
139 ulong GetScnMdlCallbackNodeID() const {
140 return mCwcbNodeID;
141 }
142
143 AnmObjChr* GetAnmObjChr() {
144 return mpAnmObjChr;
145 }
146 AnmObjVis* GetAnmObjVis() {
147 return mpAnmObjVis;
148 }
149 AnmObjMatClr* GetAnmObjMatClr() {
150 return mpAnmObjMatClr;
151 }
152 AnmObjTexPat* GetAnmObjTexPat() {
153 return mpAnmObjTexPat;
154 }
155 AnmObjTexSrt* GetAnmObjTexSrt() {
156 return mpAnmObjTexSrt;
157 }
158
159protected:
160 enum ScnMdlSmplFlag {
161 SCNMDLSMPLFLAG_LC_DMA = (1 << 0),
162 };
163
164 static const int VIEW_MAX = 16;
165
166 static const int MTX_CACHE_MIN = 8;
167 static const int MTX_CACHE_MAX =
168 sizeof(detail::MtxCacheMap) / sizeof(math::MTX34) + 1;
169
170protected:
171 void ScnMdlSmpl_CalcPosture(ulong param, const math::MTX34* pParent);
172
173 void ScnMdlSmpl_G3DPROC_GATHER_SCNOBJ(ulong param,
174 IScnObjGather* pCollection);
175 void ScnMdlSmpl_G3DPROC_CALC_WORLD(ulong param, const math::MTX34* pParent);
176 void ScnMdlSmpl_G3DPROC_CALC_MAT(ulong param, void* pInfo);
177 void ScnMdlSmpl_G3DPROC_CALC_VIEW(ulong param, const math::MTX34* pCamera);
178 void ScnMdlSmpl_G3DPROC_DRAW_OPA(ulong param, void* pInfo);
179 void ScnMdlSmpl_G3DPROC_DRAW_XLU(ulong param, void* pInfo);
180
181 void ScnMdlSmpl_G3DPROC_UPDATEFRAME(ulong /* param */, void* /* pInfo */) {
182 UpdateFrame();
183 }
184
185private:
186 ResMdl mResMdl; // at 0xE8
187 math::MTX34* mpWorldMtxArray; // at 0xEC
188 ulong* mpWorldMtxAttribArray; // at 0xF0
189 math::MTX34* mpViewPosMtxArray; // at 0xF4
190 math::MTX33* mpViewNrmMtxArray; // at 0xF8
191 math::MTX34* mpViewTexMtxArray; // at 0xFC
192 u8 mNumView; // at 0x100
193 u8 mCurView; // at 0x101
194 u16 mNumViewMtx; // at 0x102
195 ulong mFlagScnMdlSimple; // at 0x104
196
197 const u8* mpByteCodeCalc; // at 0x108
198 const u8* mpByteCodeMix; // at 0x10C
199 const u8* mpByteCodeDrawOpa; // at 0x110
200 const u8* mpByteCodeDrawXlu; // at 0x114
201 ResMdlDrawMode mDrawMode; // at 0x118
202
203 ICalcWorldCallback* mpCalcWorldCallback; // at 0x11C
204 u8 mCwcbTiming; // at 0x120
205 u8 mCwcbDeleteOption; // at 0x121
206 u16 mCwcbNodeID; // at 0x122
207
208 AnmObjChr* mpAnmObjChr; // at 0x124
209 AnmObjVis* mpAnmObjVis; // at 0x128
210 AnmObjMatClr* mpAnmObjMatClr; // at 0x12C
211 AnmObjTexPat* mpAnmObjTexPat; // at 0x130
212 AnmObjTexSrt* mpAnmObjTexSrt; // at 0x134
213
214 NW4R_G3D_RTTI_DECL_DERIVED(ScnMdlSimple, ScnLeaf);
215};
216
217} // namespace g3d
218} // namespace nw4r
219
220#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10