"L. Spiro Engine"
|
A texture manager. More...
#include <LSGTextureManager.h>
Classes | |
struct | LSG_TEXTURE_DATA |
struct | LSG_TEXTURE_DATA_COMBINED |
Public Member Functions | |
CSharedStdTexPtr LSE_CALL | CreateSharedTexFromMemory (LSUINT32 _ui32Crc1, LSUINT32 _ui32Crc2, const LSUINT8 *_pui8Data, LSUINTPTR _uiptrLen, const LSG_TEX_PARMS &_tpParms) |
CSharedStdTexPtr LSE_CALL | CreateSharedTexFromFile (const LSCHAR *_pcPath, const LSG_TEX_PARMS &_tpParms) |
CSharedStdTexPtr LSE_CALL | CreateNormalMapFromBumpTexture (LSUINT32 _ui32Crc1, LSUINT32 _ui32Crc2, const CSharedStdTexPtr _sstpBumpTexture, LSBOOL _bWrapX=true, LSBOOL _bWrapY=true) |
CSharedStdTexPtr LSE_CALL | CombineRgbAlphaTextures (LSUINT32 _ui32CrcRgb1, LSUINT32 _ui32CrcRgb2, const CSharedStdTexPtr _sstpRgbTexture, LSUINT32 _ui32CrcAlpha1, LSUINT32 _ui32CrcAlpha2, const CSharedStdTexPtr _sstpAlphaTexture, const LSG_TEX_PARMS &_tpParms) |
LSVOID LSE_CALL | Release () |
LSVOID LSE_CALL | ReleaseUnreferenced () |
Protected Types | |
typedef struct lsg::CTextureManager::LSG_TEXTURE_DATA * | LPLSG_TEXTURE_DATA |
typedef struct lsg::CTextureManager::LSG_TEXTURE_DATA | LPCLSG_TEXTURE_DATA |
typedef struct lsg::CTextureManager::LSG_TEXTURE_DATA_COMBINED * | LPLSG_TEXTURE_DATA_COMBINED |
typedef struct lsg::CTextureManager::LSG_TEXTURE_DATA_COMBINED | LPCLSG_TEXTURE_DATA_COMBINED |
Protected Attributes | |
CMap< LSG_TEXTURE_DATA, CSharedStdTexPtr > | m_mSharedData |
CMap< LSG_TEXTURE_DATA, LSG_TEXTURE_DATA > | m_mBumpConversions |
CMap < LSG_TEXTURE_DATA_COMBINED, LSG_TEXTURE_DATA > | m_mCombinedTextures |
A texture manager.
Class CTextureManager Description: A texture manager. It handles sharing of textures and prevents duplicate textures from being stored.
typedef struct lsg::CTextureManager::LSG_TEXTURE_DATA * lsg::CTextureManager::LPLSG_TEXTURE_DATA [protected] |
The sorting key for the shared texture map used by this class. When file names match exactly, the key is considered a match. Otherwise, the key is considered a match if both CRC values match.
typedef struct lsg::CTextureManager::LSG_TEXTURE_DATA_COMBINED * lsg::CTextureManager::LPLSG_TEXTURE_DATA_COMBINED [protected] |
The sorting key for the shared texture map used by this class. When both sets of texture data are the same, there is a match.
CSharedStdTexPtr LSE_CALL lsg::CTextureManager::CombineRgbAlphaTextures | ( | LSUINT32 | _ui32CrcRgb1, |
LSUINT32 | _ui32CrcRgb2, | ||
const CSharedStdTexPtr | _sstpRgbTexture, | ||
LSUINT32 | _ui32CrcAlpha1, | ||
LSUINT32 | _ui32CrcAlpha2, | ||
const CSharedStdTexPtr | _sstpAlphaTexture, | ||
const LSG_TEX_PARMS & | _tpParms | ||
) |
Gets a shared texture created by combining an RGB texture with an alpha texture.
_ui32CrcRgb1 | The first CRC value of the RGB texture. |
_ui32CrcRgb2 | The second CRC value of the RGB texture. |
_sstpRgbTexture | The RGB texture. |
_ui32CrcAlpha1 | The first CRC value of the alpha texture. |
_ui32CrcAlpha2 | The second CRC value of the alpha texture. |
_sstpAlphaTexture | The alpha texture. |
_tpParms | Parameters to use to create the texture if it does not already exist. |
CSharedStdTexPtr LSE_CALL lsg::CTextureManager::CreateNormalMapFromBumpTexture | ( | LSUINT32 | _ui32Crc1, |
LSUINT32 | _ui32Crc2, | ||
const CSharedStdTexPtr | _sstpBumpTexture, | ||
LSBOOL | _bWrapX = true , |
||
LSBOOL | _bWrapY = true |
||
) |
Gets a shared texture given an existing bump texture and its CRC pairs. The bump texture is converted to shared normal map which is returned.
_ui32Crc1 | The first CRC value. |
_ui32Crc2 | The second CRC value. |
_sstpBumpTexture | The bump texture to convert to a normal map. |
_bWrapX | If true, the normal map is calculated with wrapping at the horizontal borders. |
_bWrapY | If true, the normal map is calculated with wrapping at the vertical borders. |
CSharedStdTexPtr LSE_CALL lsg::CTextureManager::CreateSharedTexFromFile | ( | const LSCHAR * | _pcPath, |
const LSG_TEX_PARMS & | _tpParms | ||
) |
Gets a shared texture given a file path and some filtering parameters.
_pcPath | The path of the file to load. |
_tpParms | Parameters to use to create the texture if it does not already exist. |
CSharedStdTexPtr LSE_CALL lsg::CTextureManager::CreateSharedTexFromMemory | ( | LSUINT32 | _ui32Crc1, |
LSUINT32 | _ui32Crc2, | ||
const LSUINT8 * | _pui8Data, | ||
LSUINTPTR | _uiptrLen, | ||
const LSG_TEX_PARMS & | _tpParms | ||
) |
Gets a shared texture given two CRC values and some in-memory initialization data. The in-memory data is used to create a new texture should no matching texture already exist.
_ui32Crc1 | The first CRC value. |
_ui32Crc2 | The second CRC value. |
_pui8Data | The memory image of the image to create if necessary. |
_uiptrLen | Length of the data to which _pui8Data points. |
_tpParms | Parameters to use to create the texture if it does not already exist. |
LSVOID LSE_CALL lsg::CTextureManager::Release | ( | ) |
Decreases the reference count on all shared pointers. Any that reach a 0 reference count will be removed from the list.
LSVOID LSE_CALL lsg::CTextureManager::ReleaseUnreferenced | ( | ) |
Removes all shared pointers with a reference count of 1. By having a 1 reference count, the pointers are not referenced outside of the manager.
CMap<LSG_TEXTURE_DATA, LSG_TEXTURE_DATA> lsg::CTextureManager::m_mBumpConversions [protected] |
Map of converted bump textures.
CMap<LSG_TEXTURE_DATA_COMBINED, LSG_TEXTURE_DATA> lsg::CTextureManager::m_mCombinedTextures [protected] |
Map of combined textures.
CMap<LSG_TEXTURE_DATA, CSharedStdTexPtr> lsg::CTextureManager::m_mSharedData [protected] |
Map of shared textures. The keys are LSG_TEXTURE_DATA structures and the values are CSharedStdTexPtr.