NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
g3d_restex.h
1#ifndef NW4R_G3D_RES_RES_TEX_H
2#define NW4R_G3D_RES_RES_TEX_H
3#include <nw4r/types_nw4r.h>
4
5#include <nw4r/g3d/res/g3d_rescommon.h>
6
7#include <revolution/GX.h>
8
9namespace nw4r {
10namespace g3d {
11
12struct ResTexData {
13 enum Flag {
14 FLAG_CIFMT = (1 << 0),
15 };
16
17 ResBlockHeaderData header; // at 0x0
18 ulong revision; // at 0x8
19 s32 toResFileData; // at 0xC
20 s32 toTexData; // at 0x10
21 s32 name; // at 0x14
22 ulong flag; // at 0x18
23 u16 width; // at 0x1C
24 u16 height; // at 0x1E
25 union {
26 GXTexFmt fmt;
27 GXCITexFmt cifmt;
28 }; // at 0x20
29 ulong mipmap_level; // at 0x24
30 f32 min_lod; // at 0x28
31 f32 max_lod; // at 0x2C
32 s32 original_path; // at 0x30
33 s32 toResUserData; // at 0x34
34};
35
36class ResTex : public ResCommon<ResTexData> {
37public:
38 static const ulong SIGNATURE = 'TEX0';
39 static const int REVISION = 1;
40
41public:
42 NW4R_G3D_RESOURCE_FUNC_DEF(ResTex);
43
44 void Init();
45
46 ulong GetRevision() const {
47 return ref().revision;
48 }
49
50 bool CheckRevision() const {
51 return GetRevision() == REVISION;
52 }
53
54 bool GetTexObjParam(void** ppTexData, u16* pWidth, u16* pHeight,
55 GXTexFmt* pFormat, f32* pMinLod, f32* pMaxLod,
56 GXBool* pMipMap) const;
57
58 bool GetTexObjCIParam(void** ppTexData, u16* pWidth, u16* pHeight,
59 GXCITexFmt* pFormatCI, f32* pMinLod, f32* pMaxLod,
60 GXBool* pMipMap) const;
61
62 bool IsCIFmt() const {
63 return ref().flag & ResTexData::FLAG_CIFMT;
64 }
65
66 u16 GetWidth() const {
67 return ref().width;
68 }
69 u16 GetHeight() const {
70 return ref().height;
71 }
72
73 const void* GetTexData() const {
74 return ofs_to_ptr<void>(ref().toTexData);
75 }
76};
77
78} // namespace g3d
79} // namespace nw4r
80
81#endif
3D graphics drawing library.
Definition g3d_3dsmax.h:10