NW4F G3d
Loading...
Searching...
No Matches
g3d_ResTexture.h
Go to the documentation of this file.
1#ifndef NW_G3D_RES_RESTEXTURE_H_
2#define NW_G3D_RES_RESTEXTURE_H_
3
4#include <nw/g3d/g3d_config.h>
5#include <nw/g3d/fnd/g3d_GfxObject.h>
6#include <nw/g3d/res/g3d_ResCommon.h>
7#include <nw/g3d/res/g3d_ResDictionary.h>
8#include <nw/g3d/res/g3d_Binding.h>
9#include <nw/g3d/res/g3d_ResUserData.h>
10
11namespace nw { namespace g3d { namespace res {
12
13class BindCallback;
14class ResFile;
15
30
32{
34
35public:
36 enum Signature { SIGNATURE = NW_G3D_MAKE_U8X4_AS_U32('F', 'T', 'E', 'X') };
37
38 void Setup();
39 void Cleanup();
40
41 size_t GetBaseSize() const { return GetGfxTexture()->GetBaseSize(); }
42
43 size_t GetMipSize() const { return GetGfxTexture()->GetMipSize(); }
44
45 void* GetData() { return ref().ofsData.to_ptr(); }
46
47 const void* GetData() const { return ref().ofsData.to_ptr(); }
48
49 void* GetMipData() { return ref().ofsMipData.to_ptr(); }
50
51 const void* GetMipData() const { return ref().ofsMipData.to_ptr(); }
52
53 GfxTexture* GetGfxTexture() { return GfxTexture::DownCast(&ref().gfxTexture); }
54
55 const GfxTexture* GetGfxTexture() const { return GfxTexture::DownCast(&ref().gfxTexture); }
56
59
60 NW_G3D_RES_FIELD_DIC_DECL(ResUserData, UserData)
61};
62
68
70{
72
73public:
74 bool IsBound() const { return ref().ofsRefData != 0; }
75
76 BindResult Bind(const ResFile* pFile);
77
78 void ForceBind(const ResTexture* pTarget);
79
80 void Release();
81
84};
85
86} } } // namespace nw::g3d::res
87
88#endif // NW_G3D_RES_RESTEXTURE_H_
Definition g3d_GfxObject.h:176
Definition g3d_ResCommon.h:93
Definition g3d_ResFile.h:131
Definition g3d_Binding.h:16
Definition g3d_ResCommon.h:62
Definition g3d_ResFile.h:62
Definition g3d_ResTexture.h:70
BindResult Bind(const ResFile *pFile)
Definition g3d_ResTexture.cpp:24
bool IsBound() const
Definition g3d_ResTexture.h:74
void ForceBind(const ResTexture *pTarget)
Definition g3d_ResTexture.cpp:44
Definition g3d_ResTexture.h:32
const GfxTexture * GetGfxTexture() const
Definition g3d_ResTexture.h:55
Signature
Definition g3d_ResTexture.h:36
@ SIGNATURE
Definition g3d_ResTexture.h:36
GfxTexture * GetGfxTexture()
Definition g3d_ResTexture.h:53
const void * GetData() const
Definition g3d_ResTexture.h:47
void * GetData()
Definition g3d_ResTexture.h:45
size_t GetMipSize() const
Definition g3d_ResTexture.h:43
void * GetMipData()
Definition g3d_ResTexture.h:49
void Setup()
Definition g3d_ResTexture.cpp:7
const void * GetMipData() const
Definition g3d_ResTexture.h:51
void Cleanup()
Definition g3d_ResTexture.cpp:16
size_t GetBaseSize() const
Definition g3d_ResTexture.h:41
#define NW_G3D_RES_COMMON(class_name)
Definition g3d_ResCommon.h:30
#define NW_G3D_RES_FIELD_STRING_DECL(name)
Definition g3d_ResDefs.h:137
#define NW_G3D_RES_FIELD_DIC_DECL(type, name)
Definition g3d_ResDefs.h:51
#define NW_G3D_RES_FIELD_DEREFERENCE_DECL(type)
Definition g3d_ResDefs.h:129
#define NW_G3D_MAKE_U8X4_AS_U32(a, b, c, d)
Definition g3d_defs.h:90
Definition g3d_defs.h:122
Definition g3d_GfxManage.cpp:10
Definition g3d_GfxObject.h:169
Definition g3d_ResCommon.h:179
Definition g3d_ResTexture.h:17
u16 reserved
Definition g3d_ResTexture.h:28
BinString ofsPath
Definition g3d_ResTexture.h:22
GfxTexture_t gfxTexture
Definition g3d_ResTexture.h:19
u16 numUserData
Definition g3d_ResTexture.h:27
Offset ofsMipData
Definition g3d_ResTexture.h:24
BinString ofsName
Definition g3d_ResTexture.h:21
BinaryBlockHeader blockHeader
Definition g3d_ResTexture.h:18
Offset ofsUserDataDic
Definition g3d_ResTexture.h:25
Offset ofsData
Definition g3d_ResTexture.h:23
Definition g3d_ResTexture.h:64
BinString ofsName
Definition g3d_ResTexture.h:65
Offset ofsRefData
Definition g3d_ResTexture.h:66