Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray3D::cXTextureFile Class Reference

#include <cXTextureFile.h>

Inheritance diagram for Gray3D::cXTextureFile:
Gray3D::cDXTextureBase Gray3D::cXResourceFile Gray3D::cDXBase Gray::cRefBase IUnknown

Public Member Functions

 cXTextureFile (const FILECHAR_t *pstrTexPath, size_t nTextureFileSize=0, TEXTURELOAD_t dwFlags=TEXTURELOAD_NOP)
 
virtual ~cXTextureFile (void)
 
bool isResourceLoaded () const noexcept override
 
 STDMETHOD_ (cString, get_Name)() const
 
virtual HRESULT InitDeviceObjects (cDXDevice *pDXDev)
 
virtual HRESULT DeleteDeviceObjects ()
 
virtual bool UpdateOrigSize ()
 
- Public Member Functions inherited from Gray3D::cDXTextureBase
 cDXTextureBase (PIXELS_t cx=0, PIXELS_t cy=0)
 
virtual ~cDXTextureBase ()
 
PIXELS_t get_OrigSizeX () const noexcept
 
PIXELS_t get_OrigSizeY () const noexcept
 
cWinSize get_OrigSize ()
 
bool isLoaded () const noexcept
 
ID3DTextureget_DXTexture ()
 Load on demand? More...
 
HRESULT UpdateDescSize ()
 
bool GetDescSize (SIZE *pSize)
 The allocated size. More...
 
bool IsFullOpaque () const noexcept
 
- Public Member Functions inherited from Gray3D::cDXBase
 cDXBase (cDXDevice *pDXDev=nullptr) noexcept
 
virtual ~cDXBase ()
 
ID3DDeviceget_D3DDev () const noexcept
 
bool isInitDevice () const noexcept
 
bool isLostDevice () const noexcept
 
virtual HRESULT OnResetDeviceX ()
 
virtual HRESULT OnLostDeviceX ()
 
 UNITTEST_FRIEND (cDXBase)
 
- Public Member Functions inherited from Gray3D::cXResourceFile
 cXResourceFile (const FILECHAR_t *pszFileName)
 
virtual ~cXResourceFile ()
 
cStringF get_FilePath () const
 
void put_FilePath (const FILECHAR_t *pszFileName)
 
 STDMETHOD_ (cString, get_Name)() const
 
cStringF get_FullPath () const
 
cStringF MakePeerPath (const FILECHAR_t *pszName) const
 
void put_LoadedState (HRESULT hResLoad)
 
virtual HRESULT LoadResource ()
 
- Public Member Functions inherited from Gray::cRefBase
 cRefBase (int iRefCount=0) noexcept
 
virtual ~cRefBase ()
 
int get_RefCount () const noexcept
 
HASHCODE_t get_HashCode () const noexcept
 
 STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept
 
virtual void onFinalRelease ()
 
bool isValidObj () const noexcept
 
 STDMETHOD_ (ULONG, AddRef)(void) override
 
 STDMETHOD_ (ULONG, Release)(void) override
 
STDMETHOD() QueryInterface (const IID &riid, void __RPC_FAR *__RPC_FAR *ppvObject) override
 
void IncRefCount ()
 
void DecRefCount ()
 
bool isStaticConstruct () const noexcept
 
void StaticConstruct ()
 
void StaticDestruct ()
 
bool isDestructing () noexcept
 
void SetDestructing ()
 

Static Public Member Functions

static HRESULT FindTextureFile (cStringF &sFilePath, cFileStatus *pRetStatus=nullptr)
 
- Static Public Member Functions inherited from Gray3D::cXResourceFile
static HRESULT GRAYCALL OnFAIL (HRESULT hRes)
 static. so we can trap all errors here. More...
 

Public Attributes

const size_t m_nTextureFileSize
 size of this texture file, for total textures loaded statistics. More...
 
int m_iBatchGeneration
 USE_ITEM_BATCHMESHMAT. More...
 
cArrayPtr< CObjectm_aBatchUsers
 cDXMeshMaterialX or CSceneTreeDef type objects in scene using this texture. More...
 
- Public Attributes inherited from Gray3D::cDXTextureBase
cWinSize m_SizeOrig
 PIXELS_t size i intended it to be, may not be allocated/aligned size. before TEXTURELOAD_FILTER. More...
 
- Public Attributes inherited from Gray3D::cDXBase
cDXDevicem_pDXDev
 What device is this attached to (or should be)? InitDeviceObjects() was called and DeleteDeviceObjects() was not. More...
 
cIUnkPtr< ID3DDevicem_pD3DDev
 

Static Public Attributes

static ITERATE_t sm_nAllocs = 0
 count total textures loaded. More...
 
static size_t sm_nAllocTotalBytes = 0
 count total More...
 
static int sm_iBatchGeneration = 1
 

Protected Attributes

const TEXTURELOAD_t m_dwFlags
 use D3DXCreateTextureFromFile() else use a no Filter version to avoid stretching More...
 
- Protected Attributes inherited from Gray3D::cDXTextureBase
cIUnkPtr< ID3DTexturem_pDXTexture
 
cWinSize m_SizeDesc
 allocated size for the texture. may be rounded up to power of 2 (if TEXTURELOAD_FILTER) More...
 
bool m_IsFullOpaque
 alpha mask doesn't exist or is all ones. render this faster if assumed to be opaque. D3DFMT_X8R8G8B8 vs D3DFMT_A8R8G8B8 More...
 
- Protected Attributes inherited from Gray3D::cXResourceFile
HRESULT m_hResLoad
 0=loaded OK, <0 = it failed to load for some reason! OLE_E_BLANK = have not yet tried to load. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Gray3D::cDXTextureBase
HRESULT UpdateFullOpaqueHint ()
 
- Static Protected Attributes inherited from Gray3D::cXResourceFile
static cStringF s_sFileLoading
 name of file loading for debug. More...
 

Detailed Description

A texture loaded from a resource file for use with DirectX. Load in system memory and/or video memory. Managed via cXTextureMgr possibly Disposable. retain the ability to reload this if it is disposed/unloaded. .dds .jpg .png .tga .bmp MIME_EXT_bmp

Note
Load actual texture on demand. InitDeviceObjects. may unload and reload.
a texture is not the same as a surface in that a texture might have MIP maps. (multiple surfaces) ASSUME: Loaded by cXTextureMgr::LoadTextureFile()

Constructor & Destructor Documentation

◆ cXTextureFile()

Gray3D::cXTextureFile::cXTextureFile ( const FILECHAR_t pstrTexPath,
size_t  nTextureFileSize = 0,
TEXTURELOAD_t  dwFlags = TEXTURELOAD_NOP 
)

◆ ~cXTextureFile()

Gray3D::cXTextureFile::~cXTextureFile ( void  )
virtual

Member Function Documentation

◆ DeleteDeviceObjects()

HRESULT Gray3D::cXTextureFile::DeleteDeviceObjects ( )
virtual

Reimplemented from Gray3D::cDXTextureBase.

◆ FindTextureFile()

HRESULT Gray3D::cXTextureFile::FindTextureFile ( cStringF sFilePath,
cFileStatus pRetStatus = nullptr 
)
static

rsFilePath = full path of the file. Don't care if the file exactly does not exist?

Returns
< 0 = can't find it. >= 0 = type of file. index of ext rsFilePath = the full path of the new texture.

◆ InitDeviceObjects()

HRESULT Gray3D::cXTextureFile::InitDeviceObjects ( cDXDevice pDXDev)
virtual

Load the texture file on demand. virtual HRESULT LoadResource();

Note
Do we really want to load the texture if we just resized the window? Or should we just load on demand?
pDev = nullptr might be ok if we are just loading into memory.

Reimplemented from Gray3D::cDXBase.

◆ isResourceLoaded()

bool Gray3D::cXTextureFile::isResourceLoaded ( ) const
inlineoverridevirtualnoexcept

Reimplemented from Gray3D::cXResourceFile.

◆ STDMETHOD_()

Gray3D::cXTextureFile::STDMETHOD_ ( cString  ,
get_Name   
) const
inlinevirtual

◆ UpdateOrigSize()

bool Gray3D::cXTextureFile::UpdateOrigSize ( )
virtual

read size from the file directly. Not necessarily the same as GetDescSize(). Maybe filtered (Stretched).

Note
i don't even have to load the image yet !

Reimplemented from Gray3D::cDXTextureBase.

Member Data Documentation

◆ m_aBatchUsers

cArrayPtr<CObject> Gray3D::cXTextureFile::m_aBatchUsers

cDXMeshMaterialX or CSceneTreeDef type objects in scene using this texture.

◆ m_dwFlags

const TEXTURELOAD_t Gray3D::cXTextureFile::m_dwFlags
protected

use D3DXCreateTextureFromFile() else use a no Filter version to avoid stretching

◆ m_iBatchGeneration

int Gray3D::cXTextureFile::m_iBatchGeneration

USE_ITEM_BATCHMESHMAT.

◆ m_nTextureFileSize

const size_t Gray3D::cXTextureFile::m_nTextureFileSize

size of this texture file, for total textures loaded statistics.

◆ sm_iBatchGeneration

int Gray3D::cXTextureFile::sm_iBatchGeneration = 1
static

◆ sm_nAllocs

ITERATE_t Gray3D::cXTextureFile::sm_nAllocs = 0
static

count total textures loaded.

◆ sm_nAllocTotalBytes

size_t Gray3D::cXTextureFile::sm_nAllocTotalBytes = 0
static

count total


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