OpenBarnyard
 
Loading...
Searching...
No Matches
T2Texture_DX8.cpp
Go to the documentation of this file.
1#include "ToshiPCH.h"
2#include "T2Texture_DX8.h"
3
5
6//-----------------------------------------------------------------------------
7// Enables memory debugging.
8// Note: Should be the last include!
9//-----------------------------------------------------------------------------
10#include "Core/TMemoryDebugOn.h"
11
13
14// $Barnyard: FUNCTION 00615bc0
16{
18
19 TASSERT( m_pData != TNULL && m_uiDataSize != 0 );
20
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}
64
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}
79
81{
82 return m_ImageInfo.MipLevels;
83}
84
86{
87 return m_ImageInfo.Height;
88}
89
91{
92 return m_ImageInfo.Width;
93}
94
95const D3DXIMAGE_INFO& T2Texture::GetImageInfo() const
96{
97 return m_ImageInfo;
98}
99
100void T2Texture::SetData( const void* a_pData, TUINT a_uiDataSize )
101{
102 m_pData = a_pData;
103 m_uiDataSize = a_uiDataSize;
104}
105
107{
108 Unload();
109}
110
112{
113 m_uiDataSize = 0;
114 m_pData = TNULL;
115 m_Unk1 = 0;
116 m_Unk2 = 0;
118}
119
#define TASSERT(X,...)
Definition Defines.h:138
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
#define TOSHI_NAMESPACE_START
Definition Defines.h:47
#define TOSHI_NAMESPACE_END
Definition Defines.h:50
#define TPROFILER_SCOPE()
Definition Profiler.h:17
unsigned int TUINT
Definition Typedefs.h:8
#define TNULL
Definition Typedefs.h:23
IDirect3DVolumeTexture8 * m_pD3DVolumeTexture
const D3DXIMAGE_INFO & GetImageInfo() const
TUINT GetMipLevels() const
HRESULT Load()
IDirect3DCubeTexture8 * m_pD3DCubeTexture
TUINT GetWidth() const
TUINT GetHeight() const
IDirect3DTexture8 * m_pD3DTexture
void SetData(const void *a_pData, TUINT a_uiDataSize)
DirectX 8 implementation of the render interface Handles DirectX 8 specific rendering functionality a...
static TFORCEINLINE TRenderInterface * GetSingleton()
Definition TSingleton.h:49