GFXTextureManager Class Reference#include <gfxTextureManager.h>
Inheritance diagram for GFXTextureManager:
[legend]List of all members.
|
Public Types |
| | AA_MATCH_BACKBUFFER = -1 |
| enum | { AA_MATCH_BACKBUFFER = -1
} |
Public Member Functions |
| | GFXTextureManager () |
| virtual | ~GFXTextureManager () |
| U32 | getTotalVideoMemory () |
| virtual bool | validateTextureQuality (GFXTextureProfile *profile, U32 &width, U32 &height) |
| | Update width and height based on available resources.
|
| U32 | getBitmapScalePower (GFXTextureProfile *profile) |
| virtual GFXTextureObject * | createTexture (GBitmap *bmp, const String &resourceName, GFXTextureProfile *profile, bool deleteBmp) |
| virtual GFXTextureObject * | createTexture (DDSFile *dds, GFXTextureProfile *profile, bool deleteDDS) |
| virtual GFXTextureObject * | createTexture (const Torque::Path &path, GFXTextureProfile *profile) |
| virtual GFXTextureObject * | createTexture (U32 width, U32 height, void *pixels, GFXFormat format, GFXTextureProfile *profile) |
| virtual GFXTextureObject * | createTexture (U32 width, U32 height, U32 depth, void *pixels, GFXFormat format, GFXTextureProfile *profile) |
| virtual GFXTextureObject * | createTexture (U32 width, U32 height, GFXFormat format, GFXTextureProfile *profile, U32 numMipLevels, S32 antialiasLevel) |
| void | deleteTexture (GFXTextureObject *texture) |
| void | reloadTexture (GFXTextureObject *texture) |
| void | reloadTextureResource (const char *filename) |
|
Texture necromancy in three easy steps:
- If you want to destroy the texture manager, call kill().
- If you want to switch resolutions, or otherwise reset the device, call zombify().
- When you want to bring the manager back from zombie state, call resurrect().
|
| void | kill () |
| void | zombify () |
| void | resurrect () |
| void | registerTexCallback (GFXTexEventCallback, void *userData, S32 &handle) |
| void | unregisterTexCallback (S32 handle) |
Static Public Member Functions |
| static void | init () |
| | Set up some global script interface stuff.
|
Protected Types |
| | Living |
| | Zombie |
| | Dead |
| enum | TextureManagerState {
Living,
Zombie,
Dead
} |
Protected Member Functions |
| GFXTextureObject * | hashFind (const String &name) |
| void | hashInsert (GFXTextureObject *object) |
| void | hashRemove (GFXTextureObject *object) |
| virtual void | freeTexture (GFXTextureObject *texture, bool zombify=false) |
| | Frees the API handles to the texture, for D3D this is a release call.
|
| virtual void | refreshTexture (GFXTextureObject *texture) |
| void | _validateTextureMemory () |
| void | _linkTexture (GFXTextureObject *obj) |
| void | _validateTexParams (const U32 width, const U32 height, const GFXTextureProfile *profile, U32 &inOutNumMips, GFXFormat &inOutFormat) |
| GFXTextureObject * | _lookupTexture (const char *filename, const GFXTextureProfile *profile) |
| GFXTextureObject * | _lookupTexture (const DDSFile *ddsFile, const GFXTextureProfile *profile) |
|
| virtual GFXTextureObject * | _createTexture (U32 height, U32 width, U32 depth, GFXFormat format, GFXTextureProfile *profile, U32 numMipLevels, bool forceMips=false, S32 antialiasLevel=0)=0 |
| | Allocate a texture with the internal API.
|
| virtual bool | _loadTexture (GFXTextureObject *texture, DDSFile *dds)=0 |
| | Load a texture from a proper DDSFile instance.
|
| virtual bool | _loadTexture (GFXTextureObject *texture, GBitmap *bmp)=0 |
| | Load data into a texture from a GBitmap using the internal API.
|
| virtual bool | _loadTexture (GFXTextureObject *texture, void *raw)=0 |
| | Load data into a texture from a raw buffer using the internal API.
|
| virtual bool | _refreshTexture (GFXTextureObject *texture)=0 |
| | Refresh a texture using the internal API.
|
| virtual bool | _freeTexture (GFXTextureObject *texture, bool zombify=false)=0 |
| | Free a texture (but do not delete the GFXTextureObject) using the internal API.
|
| virtual U32 | _getTotalVideoMemory ()=0 |
| | Returns available VRAM in bytes.
|
Protected Attributes |
| bool | mAboveTextureThreshold |
| bool | mValidTextureQualityInfo |
| GFXTextureObject * | mListHead |
| GFXTextureObject * | mListTail |
| GFXTextureObject ** | mHashTable |
| U32 | mHashCount |
| enum GFXTextureManager::TextureManagerState | mTextureManagerState |
Private Member Functions |
| void | _resourceFileChanged (ResourceBase::Signature sig, ResourceBase &base, const Torque::Path &path) |
Private Attributes |
| U32 | mHandleCount |
| Vector< CallbackData > | mEventCallbackList |
Classes |
| struct | CallbackData |
Member Enumeration Documentation
Constructor & Destructor Documentation
| GFXTextureManager::GFXTextureManager |
( |
|
) |
|
| virtual GFXTextureManager::~GFXTextureManager |
( |
|
) |
[virtual] |
Member Function Documentation
| static void GFXTextureManager::init |
( |
|
) |
[static] |
Set up some global script interface stuff.
| U32 GFXTextureManager::getTotalVideoMemory |
( |
|
) |
[inline] |
Update width and height based on available resources.
We provide a simple interface for managing texture memory usage. Specifically, if the total video memory is below a certain threshold, we scale all texture resolutions down by a specific factor (you can specify different scale factors for different types of textures).
- Note:
- The base GFXTextureManager class provides all the logic to do this scaling. Subclasses need only implement getTotalVideoMemory().
- Parameters:
-
| type | Type of the requested texture. This is used to determine scaling factors. |
| width | Requested width - is changed to the actual width that should be used. |
| height | Requested height - is changed to the actual height that should be used. |
- Returns:
- True if the texture request should be granted, false otherwise.
| void GFXTextureManager::reloadTextureResource |
( |
const char * |
filename |
) |
|
| void GFXTextureManager::kill |
( |
|
) |
|
| void GFXTextureManager::zombify |
( |
|
) |
|
| void GFXTextureManager::resurrect |
( |
|
) |
|
| void GFXTextureManager::unregisterTexCallback |
( |
S32 |
handle |
) |
|
Frees the API handles to the texture, for D3D this is a release call.
- Note:
- freeTexture MUST NOT DELETE THE TEXTURE OBJECT
Allocate a texture with the internal API.
- Parameters:
-
| height | Height of the texture. |
| width | Width of the texture. |
| depth | Depth of the texture. (Will normally be 1 unless we are doing a cubemap or volumetexture.) |
| format | Pixel format of the texture. |
| profile | Profile for the texture. |
| numMipLevels | If not-NULL, then use that many mips. If NULL create the full mip chain |
| antialiasLevel,Use | GFXTextureManager::AA_MATCH_BACKBUFFER to match the backbuffer settings (for render targets that want to share the backbuffer z buffer. 0 for no antialiasing, > 0 for levels that match the GFXVideoMode struct. |
Implemented in GFXD3D8TextureManager, GFXD3D9TextureManager, and GFXGLTextureManager.
| virtual bool GFXTextureManager::_refreshTexture |
( |
GFXTextureObject * |
texture |
) |
[protected, pure virtual] |
| virtual bool GFXTextureManager::_freeTexture |
( |
GFXTextureObject * |
texture, |
|
|
bool |
zombify = false | |
|
) |
| | [protected, pure virtual] |
| virtual U32 GFXTextureManager::_getTotalVideoMemory |
( |
|
) |
[protected, pure virtual] |
| void GFXTextureManager::_validateTextureMemory |
( |
|
) |
[protected] |
Member Data Documentation
|