NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_resnode.h
1#ifndef NW4R_G3D_RES_RES_NODE_H
2#define NW4R_G3D_RES_RES_NODE_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/g3d/res/g3d_rescommon.h>
6
7#include <nw4r/math.h>
8
9namespace nw4r {
10namespace g3d {
11
12// Forward declarations
13struct ChrAnmResult;
14
15/******************************************************************************
16 *
17 * Common types
18 *
19 ******************************************************************************/
21 enum Billboard {
22 BILLBOARD_OFF,
23 BILLBOARD_STD,
24 BILLBOARD_PERSP_STD,
25 BILLBOARD_ROT,
26 BILLBOARD_PERSP_ROT,
27 BILLBOARD_Y_OFF,
28 BILLBOARD_PERSP_Y,
29
30 NUM_BILLBOARD,
31 };
32};
33
34/******************************************************************************
35 *
36 * ResNode
37 *
38 ******************************************************************************/
40 enum Flag {
41 FLAG_IDENTITY = (1 << 0),
42 FLAG_TRANS_ZERO = (1 << 1),
43 FLAG_ROT_ZERO = (1 << 2),
44 FLAG_SCALE_ONE = (1 << 3),
45 FLAG_SCALE_UNIFORM = (1 << 4),
46
47 // Maya Scale Compensation
48 FLAG_SSC_APPLY = (1 << 5),
49 FLAG_SSC_PARENT = (1 << 6),
50
51 // Softimage Hierarchical Scaling
52 FLAG_XSI_SCALING = (1 << 7),
53
54 FLAG_VISIBLE = (1 << 8),
55 FLAG_GEOMETRY = (1 << 9),
56 FLAG_BILLBOARD_PARENT = (1 << 10)
57 };
58
59 ulong size; // at 0x0
60 s32 toResMdlData; // at 0x4
61 s32 name; // at 0x8
62 ulong id; // at 0xC
63 ulong mtxID; // at 0x10
64 ulong flags; // at 0x14
65 Billboard bbmode; // at 0x18
66 ulong bbref_nodeid; // at 0x1C
67 math::_VEC3 scale; // at 0x20
68 math::_VEC3 rot; // at 0x2C
69 math::_VEC3 translate; // at 0x38
70 math::_VEC3 volume_min; // at 0x44
71 math::_VEC3 volume_max; // at 0x50
72 s32 toParentNode; // at 0x5C
73 s32 toChildNode; // at 0x60
74 s32 toNextSibling; // at 0x64
75 s32 toPrevSibling; // at 0x68
76 s32 toResUserData; // at 0x6C
77 math::_MTX34 modelMtx; // at 0x70
78 math::_MTX34 invModelMtx; // at 0xA0
79};
80
81class ResNode : public ResCommon<ResNodeData>, public ResNodeDataTypedef {
82public:
83 NW4R_G3D_RESOURCE_FUNC_DEF(ResNode);
84
85 void PatchChrAnmResult(ChrAnmResult* pResult) const;
86 void CalcChrAnmResult(ChrAnmResult* pResult) const;
87
88 ResName GetResName() const {
89 const ResNodeData& r = ref();
90
91 if (r.name != 0) {
92 return NW4R_G3D_OFS_TO_RESNAME(&r, r.name);
93 }
94
95 return ResName(NULL);
96 }
97
98 ulong GetID() const {
99 if (IsValid()) {
100 return ptr()->id;
101 }
102
103 return 0;
104 }
105
106 ulong GetMtxID() const {
107 if (IsValid()) {
108 return ptr()->mtxID;
109 }
110
111 return 0;
112 }
113
114 bool IsVisible() const {
115 if (IsValid()) {
116 return ptr()->flags & ResNodeData::FLAG_VISIBLE;
117 }
118
119 return false;
120 }
121
122 void SetVisibility(bool visible) {
123 if (!IsValid()) {
124 return;
125 }
126
127 if (visible) {
128 ptr()->flags |= ResNodeData::FLAG_VISIBLE;
129 } else {
130 ptr()->flags &= ~ResNodeData::FLAG_VISIBLE;
131 }
132 }
133
134 Billboard GetBillboardMode() const {
135 if (IsValid()) {
136 return ptr()->bbmode;
137 }
138
139 return BILLBOARD_OFF;
140 }
141
142 const math::VEC3& GetTranslate() const {
143 return ref().translate;
144 }
145
146 ResNode GetParentNode() {
147 return ofs_to_obj<ResNode>(ref().toParentNode);
148 }
149 ResNode GetParentNode() const {
150 return ofs_to_obj<ResNode>(ref().toParentNode);
151 }
152
153 ResNode GetChildNode() {
154 return ofs_to_obj<ResNode>(ref().toChildNode);
155 }
156 ResNode GetChildNode() const {
157 return ofs_to_obj<ResNode>(ref().toChildNode);
158 }
159
160 ResNode GetNextSibling() {
161 return ofs_to_obj<ResNode>(ref().toNextSibling);
162 }
163 ResNode GetNextSibling() const {
164 return ofs_to_obj<ResNode>(ref().toNextSibling);
165 }
166
167 ResNode GetPrevSibling() {
168 return ofs_to_obj<ResNode>(ref().toPrevSibling);
169 }
170 ResNode GetPrevSibling() const {
171 return ofs_to_obj<ResNode>(ref().toPrevSibling);
172 }
173
174 void EndEdit() {}
175};
176
177} // namespace g3d
178} // namespace nw4r
179
180#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10