NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_resanmshp.h
1#ifndef NW4R_G3D_RES_RES_ANM_SHP_H
2#define NW4R_G3D_RES_RES_ANM_SHP_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/g3d/res/g3d_resanm.h>
6#include <nw4r/g3d/res/g3d_rescommon.h>
7#include <nw4r/g3d/res/g3d_resvtx.h>
8
9namespace nw4r {
10namespace g3d {
11
12/******************************************************************************
13 *
14 * BlendVtx
15 *
16 ******************************************************************************/
18 ResVtxPos resVtxPos; // at 0x0
19 ResVtxNrm resVtxNrm; // at 0x4
20 ResVtxClr resVtxClr; // at 0x8
21
22 friend bool operator==(const ShpAnmVtxSet& rLhs, const ShpAnmVtxSet& rRhs);
23};
24
25inline bool operator==(const ShpAnmVtxSet& rLhs, const ShpAnmVtxSet& rRhs) {
26 return rLhs.resVtxPos == rRhs.resVtxPos &&
27 rLhs.resVtxNrm == rRhs.resVtxNrm && rLhs.resVtxClr == rRhs.resVtxClr;
28}
29
30struct BlendVtx {
31 ShpAnmVtxSet vtxSet; // at 0x0
32 f32 weight; // at 0xC
33};
34
35/******************************************************************************
36 *
37 * ShpAnmResult
38 *
39 ******************************************************************************/
41 enum Flag {
42 FLAG_ANM_EXISTS = (1 << 0),
43 FLAG_ANM_VTXPOS = (1 << 1),
44 FLAG_ANM_VTXNRM = (1 << 2),
45 FLAG_ANM_VTXCLR = (1 << 3),
46 };
47
48 static const int MAX_KEY_SHAPE = 32;
49
50 ulong flags; // at 0x0
51 ulong numKeyShape; // at 0x4
52 ShpAnmVtxSet baseShapeVtxSet; // at 0x8
53 f32 baseShapeWeight; // at 0x14
54 BlendVtx keyShape[MAX_KEY_SHAPE]; // at 0x18
55};
56
57/******************************************************************************
58 *
59 * ResAnmShp
60 *
61 ******************************************************************************/
63 enum Flag {
64 FLAG_ANM_EXISTS = (1 << 0),
65 FLAG_ANM_VTXPOS = (1 << 1),
66 FLAG_ANM_VTXNRM = (1 << 2),
67 FLAG_ANM_VTXCLR = (1 << 3),
68 };
69
70 ulong flags; // at 0x0
71 s32 name; // at 0x4
72 u16 baseShapeVtxIdx; // at 0x8
73 u16 numKeyShape; // at 0xA
74 ulong constFlags; // at 0xC
75 s32 toAnmIdxToVtxIdxTable; // at 0x10
76 ResAnmData anms[1]; // at 0x14
77};
78
80 u16 numFrame; // at 0x0
81 u16 numVtxName; // at 0x2
82 AnmPolicy policy; // at 0x4
83};
84
86 ResBlockHeaderData header; // at 0x0
87 ulong revision; // at 0x8
88 s32 toResFileData; // at 0xC
89 s32 toShpDataDic; // at 0x10
90 s32 toVtxNameArray; // at 0x14
91 s32 name; // at 0x18
92 s32 original_path; // at 0x1C
93 ResAnmShpInfoData info; // at 0x20
94};
95
96class ResAnmShp : public ResCommon<ResAnmShpData> {
97public:
98 static const ulong SIGNATURE = 'SHP0';
99 static const int REVISION = 3;
100
101public:
102 NW4R_G3D_RESOURCE_FUNC_DEF(ResAnmShp);
103
104 ulong GetRevision() const {
105 return ref().revision;
106 }
107
108 bool CheckRevision() const {
109 return GetRevision() == REVISION;
110 }
111
112 void GetAnmResult(ShpAnmResult* pResult, ulong idx, f32 frame,
113 const ShpAnmVtxSet* pShapeArray) const;
114
115 const ResAnmShpAnmData* GetShapeAnm(int idx) const {
116 return static_cast<ResAnmShpAnmData*>(
117 ofs_to_obj<ResDic>(ref().toShpDataDic)[idx]);
118 }
119 const ResAnmShpAnmData* GetShapeAnm(ulong idx) const {
120 return static_cast<ResAnmShpAnmData*>(
121 ofs_to_obj<ResDic>(ref().toShpDataDic)[idx]);
122 }
123
124 ulong GetShapeAnmNumEntries() const {
125 return ofs_to_obj<ResDic>(ref().toShpDataDic).GetNumData();
126 }
127
128 const s32* GetVtxNameArray() const {
129 return ofs_to_ptr<s32>(ref().toVtxNameArray);
130 }
131
132 int GetNumFrame() const {
133 return ref().info.numFrame;
134 }
135
136 int GetNumVtxNames() const {
137 return ref().info.numVtxName;
138 }
139
140 AnmPolicy GetAnmPolicy() const {
141 return ref().info.policy;
142 }
143};
144
145} // namespace g3d
146} // namespace nw4r
147
148#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10