xoreos
0.0.5
|
The global Aurora texture manager. More...
#include <textureman.h>
Public Types | |
enum | TextureMode { kModeDiffuse, kModeEnvironmentMapReflective } |
The mode/usage of a specific texture. More... | |
Public Member Functions | |
TextureManager () | |
~TextureManager () | |
void | clear () |
Remove and delete all managed textures. More... | |
void | addBogusTexture (const Common::UString &name) |
Add the name of a texture that doesn't really exist. More... | |
void | setDeswizzleSBM (bool deswizzle) |
Do we need to deswizzle SBM images? More... | |
bool | hasTexture (const Common::UString &name) |
Does this named managed texture exist? More... | |
TextureHandle | add (Texture *texture, Common::UString name="") |
Add this texture to the TextureManager. More... | |
TextureHandle | get (Common::UString name) |
Retrieve this named texture, loading it if it's not yet managed. More... | |
TextureHandle | getIfExist (const Common::UString &name) |
Retrieve this named texture, returning an empty handle if it's not managed. More... | |
void | startRecordNewTextures () |
Start recording all names of newly created textures. More... | |
void | stopRecordNewTextures (std::list< Common::UString > &newTextures) |
Stop the recording of texture names, and return a list of previously recorded names. More... | |
void | reloadAll () |
Reload and rebuild all managed textures, if possible. More... | |
void | set (const TextureHandle &handle, TextureMode mode=kModeDiffuse) |
Bind this texture to the current texture unit. More... | |
void | set () |
Reset the current texture unit to an empty texture. More... | |
void | reset () |
Completely reset the texture rendering. More... | |
void | activeTexture (size_t n) |
Set this texture unit as the current one. More... | |
Private Member Functions | |
void | assign (TextureHandle &texture, const TextureHandle &from) |
void | release (TextureHandle &texture) |
Private Attributes | |
bool | _deswizzleSBM |
TextureMap | _textures |
std::set< Common::UString > | _bogusTextures |
Common::Mutex | _mutex |
bool | _recordNewTextures |
std::list< Common::UString > | _newTextureNames |
Friends | |
class | TextureHandle |
Additional Inherited Members | |
Static Public Member Functions inherited from Common::Singleton< TextureManager > | |
static TextureManager & | instance () |
static void | destroy () |
Protected Types inherited from Common::Singleton< TextureManager > | |
typedef TextureManager | SingletonBaseType |
Protected Member Functions inherited from Common::Singleton< TextureManager > | |
Singleton () | |
virtual | ~Singleton () |
The global Aurora texture manager.
Definition at line 43 of file textureman.h.
The mode/usage of a specific texture.
Enumerator | |
---|---|
kModeDiffuse | A standard diffuse texture. |
kModeEnvironmentMapReflective | A reflective environment map. |
Definition at line 46 of file textureman.h.
Graphics::Aurora::TextureManager::TextureManager | ( | ) |
Definition at line 83 of file textureman.cpp.
Graphics::Aurora::TextureManager::~TextureManager | ( | ) |
Definition at line 86 of file textureman.cpp.
References clear().
void Graphics::Aurora::TextureManager::activeTexture | ( | size_t | n | ) |
Set this texture unit as the current one.
Definition at line 327 of file textureman.cpp.
References ARRAYSIZE, GfxMan, and Graphics::Aurora::kTextureUnit.
Referenced by reset().
TextureHandle Graphics::Aurora::TextureManager::add | ( | Texture * | texture, |
Common::UString | name = "" |
||
) |
Add this texture to the TextureManager.
If name is empty, generate a random one.
Definition at line 126 of file textureman.cpp.
References _bogusTextures, _mutex, _newTextureNames, _recordNewTextures, _textures, Common::UString::c_str(), Common::UString::empty(), Common::generateIDRandomString(), Common::ScopedPtrBase< T, Deallocator >::get(), Common::ScopedPtrBase< T, Deallocator >::release(), and TextureHandle.
void Graphics::Aurora::TextureManager::addBogusTexture | ( | const Common::UString & | name | ) |
Add the name of a texture that doesn't really exist.
An empty TextureHandle is returned when this texture is requested.
Definition at line 105 of file textureman.cpp.
References _bogusTextures, and _mutex.
|
private |
Definition at line 207 of file textureman.cpp.
References Graphics::Aurora::TextureHandle::_empty, Graphics::Aurora::TextureHandle::_it, and _mutex.
void Graphics::Aurora::TextureManager::clear | ( | ) |
Remove and delete all managed textures.
Definition at line 90 of file textureman.cpp.
References _bogusTextures, _deswizzleSBM, _mutex, _newTextureNames, _recordNewTextures, and _textures.
Referenced by ~TextureManager().
TextureHandle Graphics::Aurora::TextureManager::get | ( | Common::UString | name | ) |
Retrieve this named texture, loading it if it's not yet managed.
Definition at line 152 of file textureman.cpp.
References _bogusTextures, _deswizzleSBM, _mutex, _newTextureNames, _recordNewTextures, _textures, Graphics::Aurora::Texture::create(), Common::generateIDRandomString(), Graphics::Aurora::Texture::isDynamic(), Graphics::Aurora::ManagedTexture::texture, and TextureHandle.
TextureHandle Graphics::Aurora::TextureManager::getIfExist | ( | const Common::UString & | name | ) |
Retrieve this named texture, returning an empty handle if it's not managed.
Definition at line 178 of file textureman.cpp.
References _bogusTextures, _mutex, _textures, and TextureHandle.
bool Graphics::Aurora::TextureManager::hasTexture | ( | const Common::UString & | name | ) |
Does this named managed texture exist?
Definition at line 115 of file textureman.cpp.
References _bogusTextures, _mutex, and _textures.
|
private |
Definition at line 217 of file textureman.cpp.
References Graphics::Aurora::TextureHandle::_empty, Graphics::Aurora::TextureHandle::_it, _mutex, and _textures.
void Graphics::Aurora::TextureManager::reloadAll | ( | ) |
Reload and rebuild all managed textures, if possible.
Definition at line 231 of file textureman.cpp.
References _mutex, _textures, Common::exceptionDispatcherWarning(), GfxMan, and RequestMan.
void Graphics::Aurora::TextureManager::reset | ( | ) |
Completely reset the texture rendering.
Definition at line 248 of file textureman.cpp.
References activeTexture(), and Graphics::Aurora::kTextureUnitCount.
void Graphics::Aurora::TextureManager::set | ( | const TextureHandle & | handle, |
TextureMode | mode = kModeDiffuse |
||
) |
Bind this texture to the current texture unit.
Definition at line 276 of file textureman.cpp.
References Graphics::Aurora::TextureHandle::_it, Graphics::Aurora::TextureHandle::empty(), kModeDiffuse, kModeEnvironmentMapReflective, and warning().
void Graphics::Aurora::TextureManager::set | ( | ) |
Reset the current texture unit to an empty texture.
Definition at line 265 of file textureman.cpp.
void Graphics::Aurora::TextureManager::setDeswizzleSBM | ( | bool | deswizzle | ) |
Do we need to deswizzle SBM images?
The Xbox version of Jade Empire contains swizzled SBM images, used for the font glyphs. Unfortunately, we can't tell from the SBM image alone whether it needs deswizzling, so the engine needs to tell the TextureManage, which needs to tell the Texture, which tells the image decoder.
Definition at line 111 of file textureman.cpp.
References _deswizzleSBM.
void Graphics::Aurora::TextureManager::startRecordNewTextures | ( | ) |
Start recording all names of newly created textures.
Definition at line 191 of file textureman.cpp.
References _mutex, _newTextureNames, and _recordNewTextures.
void Graphics::Aurora::TextureManager::stopRecordNewTextures | ( | std::list< Common::UString > & | newTextures | ) |
Stop the recording of texture names, and return a list of previously recorded names.
Definition at line 198 of file textureman.cpp.
References _mutex, _newTextureNames, and _recordNewTextures.
|
friend |
Definition at line 119 of file textureman.h.
Referenced by add(), get(), and getIfExist().
|
private |
Definition at line 109 of file textureman.h.
Referenced by add(), addBogusTexture(), clear(), get(), getIfExist(), and hasTexture().
|
private |
Definition at line 106 of file textureman.h.
Referenced by clear(), get(), and setDeswizzleSBM().
|
private |
Definition at line 111 of file textureman.h.
Referenced by add(), addBogusTexture(), assign(), clear(), get(), getIfExist(), hasTexture(), release(), reloadAll(), startRecordNewTextures(), and stopRecordNewTextures().
|
private |
Definition at line 114 of file textureman.h.
Referenced by add(), clear(), get(), startRecordNewTextures(), and stopRecordNewTextures().
|
private |
Definition at line 113 of file textureman.h.
Referenced by add(), clear(), get(), startRecordNewTextures(), and stopRecordNewTextures().
|
private |
Definition at line 107 of file textureman.h.
Referenced by add(), clear(), get(), getIfExist(), hasTexture(), release(), and reloadAll().