Xface Core Library: XEngine::TextureManager Class Reference

XFace / XEngine / XMath

XEngine::TextureManager Class Reference
[XEngine]

#include <TextureManager.h>

List of all members.


Detailed Description

Author:
Koray Balci
Version:
1.0
Date:
May 2003
Textures (ITexture instances) are loaded, stored and managed through here. All the textures are stored in a hash map (currently) with a string representing the name as the key of the hash. TextureManager is a singleton class.

Here is a sample usage for loading a texture;

                TextureManager::getInstance()->load("..\\john_lo_obj02.bmp", "john_lo_obj02");
                // this is optional but good to do, associate the texture to a Drawable
                Drawable* pDrawable = new Drawable;
                pDrawable->setTexName("john_lo_obj00");

And here is how we access the loaded texture (from RendererGL);

                const ITexture* pTexture = TextureManager::getInstance()->getTexture(pDrawable->getTexName());


Public Member Functions

const ITextureload (const std::string &filename, const std::string &texname)
void unLoad (const ITexture *pTexture)
void unLoad (const std::string &name)
void destroyAll ()
void registerTexture (const ITexture *pTexture)
void unregisterTexture (const ITexture *pTexture)
const ITexturegetTexture (const std::string &name) const

Static Public Member Functions

static void releaseInstance ()
static TextureManagergetInstance ()

Member Function Documentation

void XEngine::TextureManager::destroyAll  ) 
 

Destroys all of the textures in the storage.

TextureManager * XEngine::TextureManager::getInstance  )  [static]
 

Singleton class accessor for the one and only instance of this class.

const ITexture * XEngine::TextureManager::getTexture const std::string &  name  )  const
 

Retrieves a texture with the name passed.

Returns:
0 if unsucessful, a valid pointer to ITexture if successful.

const ITexture * XEngine::TextureManager::load const std::string &  filename,
const std::string &  texname
 

Loads a texture from a file, creates an ITexture instance, binds the texture to it, and registers it to texture storage.

Parameters:
filename Name of the image file to be used as a texture.
texname Name of the texture object to be created and binded to texture.

void XEngine::TextureManager::registerTexture const ITexture pTexture  ) 
 

Registers a texture object to the storage.

void XEngine::TextureManager::releaseInstance  )  [static]
 

Releases the one and only instance.

void XEngine::TextureManager::unLoad const std::string &  name  ) 
 

Unloads the texture completely and removes it from the storage.

Parameters:
name Name of the texture object in the storage.

void XEngine::TextureManager::unLoad const ITexture pTexture  ) 
 

Unloads the texture completely and removes it from the storage.

Parameters:
pTexture A valid, existant ITexture instance.

void XEngine::TextureManager::unregisterTexture const ITexture pTexture  ) 
 

Removes a texture from the storage.


The documentation for this class was generated from the following files:
Generated on Mon Aug 28 15:39:26 2006 for Xface Core Library by  doxygen 1.4.6-NO