NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_scnroot.h
1#ifndef NW4R_G3D_SCN_ROOT_H
2#define NW4R_G3D_SCN_ROOT_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/g3d/g3d_camera.h>
6#include <nw4r/g3d/g3d_fog.h>
7#include <nw4r/g3d/g3d_light.h>
8#include <nw4r/g3d/g3d_scnobj.h>
9#include <nw4r/g3d/g3d_state.h>
10
11namespace nw4r {
12namespace g3d {
13
14// Forward declarations
15class AnmScn;
16
17/******************************************************************************
18 *
19 * ScnRoot
20 *
21 ******************************************************************************/
22class ScnRoot : public ScnGroup {
23public:
24 enum ScnRootFlag { SCNROOTFLAG_FORCE_RESMDLDRAWMODE = (1 << 0) };
25
26public:
27 static ScnRoot* Construct(MEMAllocator* pAllocator, size_t* pSize,
28 size_t maxChildren, size_t maxScnObj, size_t numLightObj,
29 size_t numLightSet);
30
31 static ScnRoot* Construct(MEMAllocator* pAllocator, size_t* pSize,
32 size_t maxChildren, size_t maxScnObj) {
33 return Construct(pAllocator, pSize, maxChildren, maxScnObj,
34 G3DState::NUM_LIGHT, G3DState::NUM_LIGHT_SET);
35 }
36
37 ScnRoot(MEMAllocator* pAllocator, IScnObjGather* pGather,
38 ScnObj** ppChildrenBuf, ulong maxChildren, ulong numLight,
39 ulong numLightSet, LightObj* pLightObjBuf, AmbLightObj* pAmbObjBuf,
40 LightSetData* pLightSetBuf);
41
42 virtual void G3dProc(ulong task, ulong param, void* pInfo); // at 0xC
43 virtual ~ScnRoot(); // at 0x10
44
45 Camera GetCamera(int idx);
46 Camera GetCurrentCamera();
47 void SetCurrentCamera(int idx);
48
49 Fog GetFog(int idx);
50 LightSet GetLightSet(int idx);
51
52 void UpdateFrame();
53 void SetGlbSettings();
54
55 void CalcAnmScn();
56 void CalcWorld();
57 void CalcMaterial();
58 void CalcVtx();
59 void CalcView();
60
61 void GatherDrawScnObj();
62 void ZSort();
63 void DrawOpa();
64 void DrawXlu();
65
66 ulong TestScnRootFlag(ScnRootFlag flag) const {
67 return (mScnRootFlags & flag) != 0;
68 }
69 void SetScnRootFlag(ScnRootFlag flag, ulong on) {
70 if (on) {
71 mScnRootFlags |= flag;
72 } else {
73 mScnRootFlags &= ~flag;
74 }
75 }
76
77 int GetCurrentCameraID() const {
78 return mCurrentCameraID;
79 }
80
81 LightSetting& GetLightSetting() {
82 return mLightSetting;
83 }
84
85private:
86 IScnObjGather* mpCollection; // at 0xE8
87 ResMdlDrawMode mDrawMode; // at 0xEC
88 ulong mScnRootFlags; // at 0xF0
89 u8 mCurrentCameraID; // at 0xF4
90 u8 PADDING_0xF5; // at 0xF5
91 u8 PADDING_0xF6; // at 0xF6
92 u8 PADDING_0xF7; // at 0xF7
93 CameraData mCamera[G3DState::NUM_CAMERA]; // at 0xF8
94 FogData mFog[G3DState::NUM_FOG]; // at 0x2278
95 LightSetting mLightSetting; // at 0x2878
96 AnmScn* mpAnmScn; // at 0x2888
97
98 NW4R_G3D_RTTI_DECL_DERIVED(ScnRoot, ScnGroup);
99};
100
101/******************************************************************************
102 *
103 * ScnObjGather
104 *
105 ******************************************************************************/
106class ScnObjGather : public IScnObjGather {
107public:
108 ScnObjGather(ScnObj** ppBufOpa, ScnObj** ppBufXlu, ulong capacity);
109
110 virtual ~ScnObjGather() {} // at 0x8
111
112 virtual CullingStatus Add(ScnObj* pObj, bool opa, bool xlu); // at 0xC
113 virtual void Clear() {
114 mNumScnObjOpa = mNumScnObjXlu = 0;
115 } // at 0x10
116
117 virtual void ZSort(); // at 0x14
118
119 virtual void Sort(); // at 0x18
120 virtual void Sort(LessThanFunc pOpaFunc,
121 LessThanFunc pXluFunc); // at 0x1C
122
123 virtual void DrawOpa(ResMdlDrawMode* pForceMode); // at 0x20
124 virtual void DrawXlu(ResMdlDrawMode* pForceMode); // at 0x24
125
126protected:
127 ScnObj** mpArrayOpa; // at 0x4
128 ScnObj** mpArrayXlu; // at 0x8
129 ulong mSizeScnObj; // at 0xC
130 ulong mNumScnObjOpa; // at 0x10
131 ulong mNumScnObjXlu; // at 0x14
132};
133
134} // namespace g3d
135} // namespace nw4r
136
137#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10