OpenBarnyard
 
Loading...
Searching...
No Matches
T2Texture Class Reference

#include <T2Texture_DX8.h>

Public Member Functions

 T2Texture ()
 
 ~T2Texture ()
 
void SetData (const void *a_pData, TUINT a_uiDataSize)
 
void GetData (const void *&a_rData, TUINT &a_rDataSize)
 
HRESULT Load ()
 
void Unload ()
 
const D3DXIMAGE_INFO & GetImageInfo () const
 
TUINT GetWidth () const
 
TUINT GetHeight () const
 
TUINT GetMipLevels () const
 
IDirect3DTexture8 * GetD3DTexture ()
 
IDirect3DVolumeTexture8 * GetD3DVolumeTexture ()
 
IDirect3DCubeTexture8 * GetD3DCubeTexture ()
 

Detailed Description

Definition at line 8 of file T2Texture_DX8.h.

Constructor & Destructor Documentation

◆ T2Texture()

T2Texture::T2Texture ( )

Definition at line 111 of file T2Texture_DX8.cpp.

112{
113 m_uiDataSize = 0;
114 m_pData = TNULL;
115 m_Unk1 = 0;
116 m_Unk2 = 0;
118}
#define TNULL
Definition Typedefs.h:23
IDirect3DTexture8 * m_pD3DTexture

◆ ~T2Texture()

T2Texture::~T2Texture ( )

Definition at line 106 of file T2Texture_DX8.cpp.

107{
108 Unload();
109}

Member Function Documentation

◆ GetD3DCubeTexture()

IDirect3DCubeTexture8 * T2Texture::GetD3DCubeTexture ( )
inline

Definition at line 31 of file T2Texture_DX8.h.

31{ return m_pD3DCubeTexture; }
IDirect3DCubeTexture8 * m_pD3DCubeTexture

◆ GetD3DTexture()

IDirect3DTexture8 * T2Texture::GetD3DTexture ( )
inline

Definition at line 29 of file T2Texture_DX8.h.

29{ return m_pD3DTexture; }

◆ GetD3DVolumeTexture()

IDirect3DVolumeTexture8 * T2Texture::GetD3DVolumeTexture ( )
inline

Definition at line 30 of file T2Texture_DX8.h.

30{ return m_pD3DVolumeTexture; }
IDirect3DVolumeTexture8 * m_pD3DVolumeTexture

◆ GetData()

void T2Texture::GetData ( const void *& a_rData,
TUINT & a_rDataSize )
inline

Definition at line 15 of file T2Texture_DX8.h.

16 {
17 a_rData = m_pData;
18 a_rDataSize = m_uiDataSize;
19 }

◆ GetHeight()

TUINT T2Texture::GetHeight ( ) const

Definition at line 85 of file T2Texture_DX8.cpp.

86{
87 return m_ImageInfo.Height;
88}

◆ GetImageInfo()

const D3DXIMAGE_INFO & T2Texture::GetImageInfo ( ) const

Definition at line 95 of file T2Texture_DX8.cpp.

96{
97 return m_ImageInfo;
98}

◆ GetMipLevels()

TUINT T2Texture::GetMipLevels ( ) const

Definition at line 80 of file T2Texture_DX8.cpp.

81{
82 return m_ImageInfo.MipLevels;
83}

◆ GetWidth()

TUINT T2Texture::GetWidth ( ) const

Definition at line 90 of file T2Texture_DX8.cpp.

91{
92 return m_ImageInfo.Width;
93}

◆ Load()

HRESULT T2Texture::Load ( )

Definition at line 15 of file T2Texture_DX8.cpp.

16{
18
19 TASSERT( m_pData != TNULL && m_uiDataSize != 0 );
20
21 auto pRender = TSTATICCAST( TRenderD3DInterface, TRenderInterface::GetSingleton() );
22 auto pD3DDevice = pRender->GetDirect3DDevice();
23
24 HRESULT hRes = D3DXGetImageInfoFromFileInMemory( m_pData, m_uiDataSize, &m_ImageInfo );
25
26 if ( hRes == S_OK )
27 {
28 if ( m_ImageInfo.ResourceType == D3DRTYPE_TEXTURE )
29 {
30 return D3DXCreateTextureFromFileInMemory(
31 pD3DDevice,
32 m_pData,
33 m_uiDataSize,
35 );
36 }
37 else
38 {
39 if ( m_ImageInfo.ResourceType == D3DRTYPE_VOLUMETEXTURE )
40 {
41 return D3DXCreateVolumeTextureFromFileInMemory(
42 pD3DDevice,
43 m_pData,
44 m_uiDataSize,
46 );
47 }
48 else if ( m_ImageInfo.ResourceType == D3DRTYPE_CUBETEXTURE )
49 {
50 return D3DXCreateCubeTextureFromFileInMemory(
51 pD3DDevice,
52 m_pData,
53 m_uiDataSize,
55 );
56 }
57
58 return D3DERR_WRONGTEXTUREFORMAT;
59 }
60 }
61
62 return hRes;
63}
#define TASSERT(X,...)
Definition Defines.h:138
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
#define TPROFILER_SCOPE()
Definition Profiler.h:17
static TFORCEINLINE TRenderInterface * GetSingleton()
Definition TSingleton.h:49

◆ SetData()

void T2Texture::SetData ( const void * a_pData,
TUINT a_uiDataSize )

Definition at line 100 of file T2Texture_DX8.cpp.

101{
102 m_pData = a_pData;
103 m_uiDataSize = a_uiDataSize;
104}

◆ Unload()

void T2Texture::Unload ( )

Definition at line 65 of file T2Texture_DX8.cpp.

66{
67 if ( m_pD3DTexture )
68 {
69 m_pD3DTexture->Release();
71 }
72
73 if ( m_pData )
74 {
75 delete m_pData;
76 m_pData = TNULL;
77 }
78}

Member Data Documentation

◆ m_pD3DCubeTexture

IDirect3DCubeTexture8* T2Texture::m_pD3DCubeTexture

Definition at line 43 of file T2Texture_DX8.h.

◆ m_pD3DTexture

IDirect3DTexture8* T2Texture::m_pD3DTexture

Definition at line 41 of file T2Texture_DX8.h.

◆ m_pD3DVolumeTexture

IDirect3DVolumeTexture8* T2Texture::m_pD3DVolumeTexture

Definition at line 42 of file T2Texture_DX8.h.


The documentation for this class was generated from the following files: