xoreos  0.0.5
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Graphics::Aurora::TextureManager Class Reference

The global Aurora texture manager. More...

#include <textureman.h>

Inheritance diagram for Graphics::Aurora::TextureManager:
Inheritance graph
[legend]
Collaboration diagram for Graphics::Aurora::TextureManager:
Collaboration graph
[legend]

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 ()
 

Detailed Description

The global Aurora texture manager.

Definition at line 43 of file textureman.h.

Member Enumeration Documentation

◆ TextureMode

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.

Constructor & Destructor Documentation

◆ TextureManager()

Graphics::Aurora::TextureManager::TextureManager ( )

Definition at line 83 of file textureman.cpp.

◆ ~TextureManager()

Graphics::Aurora::TextureManager::~TextureManager ( )

Definition at line 86 of file textureman.cpp.

References clear().

Here is the call graph for this function:

Member Function Documentation

◆ activeTexture()

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().

Here is the caller graph for this function:

◆ add()

TextureHandle Graphics::Aurora::TextureManager::add ( Texture texture,
Common::UString  name = "" 
)

◆ addBogusTexture()

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.

◆ assign()

void Graphics::Aurora::TextureManager::assign ( TextureHandle texture,
const TextureHandle from 
)
private

◆ clear()

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().

Here is the caller graph for this function:

◆ get()

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.

Here is the call graph for this function:

◆ getIfExist()

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.

◆ hasTexture()

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.

◆ release()

void Graphics::Aurora::TextureManager::release ( TextureHandle texture)
private

◆ reloadAll()

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.

Here is the call graph for this function:

◆ reset()

void Graphics::Aurora::TextureManager::reset ( )

Completely reset the texture rendering.

Definition at line 248 of file textureman.cpp.

References activeTexture(), and Graphics::Aurora::kTextureUnitCount.

Here is the call graph for this function:

◆ set() [1/2]

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().

Here is the call graph for this function:

◆ set() [2/2]

void Graphics::Aurora::TextureManager::set ( )

Reset the current texture unit to an empty texture.

Definition at line 265 of file textureman.cpp.

◆ setDeswizzleSBM()

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.

◆ startRecordNewTextures()

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.

◆ stopRecordNewTextures()

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.

Friends And Related Function Documentation

◆ TextureHandle

friend class TextureHandle
friend

Definition at line 119 of file textureman.h.

Referenced by add(), get(), and getIfExist().

Member Data Documentation

◆ _bogusTextures

std::set<Common::UString> Graphics::Aurora::TextureManager::_bogusTextures
private

Definition at line 109 of file textureman.h.

Referenced by add(), addBogusTexture(), clear(), get(), getIfExist(), and hasTexture().

◆ _deswizzleSBM

bool Graphics::Aurora::TextureManager::_deswizzleSBM
private

Definition at line 106 of file textureman.h.

Referenced by clear(), get(), and setDeswizzleSBM().

◆ _mutex

Common::Mutex Graphics::Aurora::TextureManager::_mutex
private

◆ _newTextureNames

std::list<Common::UString> Graphics::Aurora::TextureManager::_newTextureNames
private

Definition at line 114 of file textureman.h.

Referenced by add(), clear(), get(), startRecordNewTextures(), and stopRecordNewTextures().

◆ _recordNewTextures

bool Graphics::Aurora::TextureManager::_recordNewTextures
private

Definition at line 113 of file textureman.h.

Referenced by add(), clear(), get(), startRecordNewTextures(), and stopRecordNewTextures().

◆ _textures

TextureMap Graphics::Aurora::TextureManager::_textures
private

Definition at line 107 of file textureman.h.

Referenced by add(), clear(), get(), getIfExist(), hasTexture(), release(), and reloadAll().


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