NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_resanmtexsrt.h
1#ifndef NW4R_G3D_RES_RES_ANM_TEX_SRT_H
2#define NW4R_G3D_RES_RES_ANM_TEX_SRT_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_resdict.h>
8
9namespace nw4r {
10namespace g3d {
11
12/******************************************************************************
13 *
14 * Common types
15 *
16 ******************************************************************************/
18 static const int NUM_OF_MAT_TEX_MTX = 8;
19 static const int NUM_OF_IND_TEX_MTX = 3;
20 static const int NUM_OF_TEX_MTX = NUM_OF_MAT_TEX_MTX + NUM_OF_IND_TEX_MTX;
21};
22
24 enum TexMatrixMode {
25 TEXMATRIXMODE_MAYA,
26 TEXMATRIXMODE_XSI,
27 TEXMATRIXMODE_3DSMAX
28 };
29};
30
31/******************************************************************************
32 *
33 * TexSrtAnmResult
34 *
35 ******************************************************************************/
37 enum Flag {
38 FLAG_ANM_EXISTS = (1 << 0),
39 FLAG_SCALE_ONE = (1 << 1),
40 FLAG_ROT_ZERO = (1 << 2),
41 FLAG_TRANS_ZERO = (1 << 3),
42
43 FLAGSET_IDENTITY = (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3),
44 NUM_OF_FLAGS = 4
45 };
46
47 f32 Su; // at 0x0
48 f32 Sv; // at 0x4
49 f32 R; // at 0x8
50 f32 Tu; // at 0xC
51 f32 Tv; // at 0x10
52};
53
55 enum Flag {
56 FLAG_ANM_EXISTS = (1 << 0),
57 FLAG_SCALE_ONE = (1 << 1),
58 FLAG_ROT_ZERO = (1 << 2),
59 FLAG_TRANS_ZERO = (1 << 3),
60
61 // Four bits in 'flags' for each animation
62 NUM_OF_FLAGS = 4
63 };
64
65 ulong flags; // at 0x0
66 ulong indFlags; // at 0x4
67 TexMatrixMode texMtxMode; // at 0x8
68 TexSrt srt[NUM_OF_TEX_MTX]; // at 0xC
69};
70
71/******************************************************************************
72 *
73 * ResAnmTexSrt
74 *
75 ******************************************************************************/
77 enum Flag {
78 FLAG_ANM_EXISTS = (1 << 0),
79 FLAG_SCALE_ONE = (1 << 1),
80 FLAG_ROT_ZERO = (1 << 2),
81 FLAG_TRANS_ZERO = (1 << 3),
82
83 FLAG_SCALE_UNIFORM = (1 << 4),
84 FLAG_SCALE_U_CONST = (1 << 5),
85 FLAG_SCALE_V_CONST = (1 << 6),
86
87 FLAG_ROT_CONST = (1 << 7),
88 FLAG_TRANS_U_CONST = (1 << 8),
89 FLAG_TRANS_V_CONST = (1 << 9),
90 };
91
92 ulong flags; // at 0x0
93 ResAnmData anms[1]; // at 0x4
94};
95
97 enum Flag {
98 FLAG_ANM_EXISTS = (1 << 0),
99
100 NUM_OF_FLAGS = 1
101 };
102
103 s32 name; // at 0x0
104 ulong flags; // at 0x4
105 ulong indFlags; // at 0x8
106 s32 toResAnmTexSrtTexData[1]; // at 0xC
107};
108
110 u16 numFrame; // at 0x0
111 u16 numMaterial; // at 0x2
112 TexMatrixMode texMtxMode; // at 0x4
113 AnmPolicy policy; // at 0x8
114};
115
117 ResBlockHeaderData header; // at 0x0
118 ulong revision; // at 0x8
119 s32 toResFileData; // at 0xC
120 s32 toTexSrtDataDic; // at 0x10
121 s32 toResUserData; // at 0x14
122 s32 name; // at 0x18
123 s32 original_path; // at 0x1C
124 ResAnmTexSrtInfoData info; // at 0x20
125};
126
127class ResAnmTexSrt : public ResCommon<ResAnmTexSrtData> {
128public:
129 static const ulong SIGNATURE = 'SRT0';
130 static const int REVISION = 4;
131
132public:
133 NW4R_G3D_RESOURCE_FUNC_DEF(ResAnmTexSrt);
134
135 ulong GetRevision() const {
136 return ref().revision;
137 }
138
139 bool CheckRevision() const {
140 return GetRevision() == REVISION;
141 }
142
143 void GetAnmResult(TexSrtAnmResult* pResult, ulong idx, f32 frame) const;
144
145 const ResAnmTexSrtMatData* GetMatAnm(int idx) const {
146 return static_cast<ResAnmTexSrtMatData*>(
147 ofs_to_obj<ResDic>(ref().toTexSrtDataDic)[idx]);
148 }
149 const ResAnmTexSrtMatData* GetMatAnm(ulong idx) const {
150 return static_cast<ResAnmTexSrtMatData*>(
151 ofs_to_obj<ResDic>(ref().toTexSrtDataDic)[idx]);
152 }
153
154 int GetNumFrame() const {
155 return ref().info.numFrame;
156 }
157
158 int GetNumMaterial() const {
159 return ref().info.numMaterial;
160 }
161
162 AnmPolicy GetAnmPolicy() const {
163 return ref().info.policy;
164 }
165};
166
167} // namespace g3d
168} // namespace nw4r
169
170#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10