ShaderManager Class Reference

#include <ShaderManager.h>

Inheritance diagram for ShaderManager:

EventListener Object

List of all members.

Public Member Functions

void registerShader (const string &filename)
 Registers a shader for use in the Shader Manager.
void unregisterShader (const string &filename)
 Unregisters a shader.
void unregisterShader (struct shaderEntry *const data)
 Unregisters a shader.
void processEvent (SDL_Event &event)
 A method to deal with SDL_Event.
struct shaderEntrygetEntry (const string &filename)
virtual string toString () const
 Returns a textual representation.
virtual string className () const
 Returns the class name of the object.
virtual enum classId classId () const
 Returns the class id of the object.

Static Public Member Functions

static ShaderManagergetInstance ()
 The singleton getter.

Private Member Functions

 ShaderManager ()
 The constructor.
 ShaderManager (const ShaderManager &source)
 The copy constructor.
 ~ShaderManager ()
 The destructor.
char * loadSource (const char *filename)
 reads a textfile
void loadShader (struct shaderEntry *entry)
 Loads a shader from file to OpenGL.
void reload ()
 Reloads textures after resize.

Private Attributes

vector< shaderEntry * > shaders
 The place to store all information about loaded textures.

Static Private Attributes

static ShaderManagerinstance = 0
 The singleton instance.


Constructor & Destructor Documentation

ShaderManager::ShaderManager (  )  [private]

The constructor.

Initializes the shader manager.

ShaderManager::ShaderManager ( const ShaderManager source  )  [private]

The copy constructor.

Should not be called.

ShaderManager::~ShaderManager (  )  [private]

The destructor.

Destroyes the shader manager and frees all memory occupied by shaders. Should only be called for program termination.


Member Function Documentation

char * ShaderManager::loadSource ( const char *  filename  )  [private]

reads a textfile

Reads a textfile from disk

Parameters:
filename The file to be read.

void ShaderManager::loadShader ( struct shaderEntry entry  )  [private]

Loads a shader from file to OpenGL.

Creates a shader from file

void ShaderManager::reload (  )  [private]

Reloads textures after resize.

Reloads all used shader from disk to graphics card memory

ShaderManager * ShaderManager::getInstance (  )  [static]

The singleton getter.

The only way to access the manager

void ShaderManager::registerShader ( const string &  filename  ) 

Registers a shader for use in the Shader Manager.

Adds a shader if not already present, otherwise increases its count.

Parameters:
filename Must be a valid filename (without suffix) otherwise we got a problem

void ShaderManager::unregisterShader ( const string &  filename  ) 

Unregisters a shader.

Removes a shader from memory if no longer used by other objects, otherwise decreases its count.

Parameters:
filename Must be a filename (without suffix) already registered otherwise the call will have no effect.

void ShaderManager::unregisterShader ( struct shaderEntry *const   data  ) 

Unregisters a shader.

void ShaderManager::processEvent ( SDL_Event &  event  )  [virtual]

A method to deal with SDL_Event.

Implements EventListener.

struct shaderEntry * ShaderManager::getEntry ( const string &  filename  )  [read]

string ShaderManager::toString (  )  const [virtual]

Returns a textual representation.

Returns:
a string descriping the run-time object

Implements EventListener.

string ShaderManager::className (  )  const [virtual]

Returns the class name of the object.

Returns:
a string with the name of the object's class

Implements EventListener.

enum classId ShaderManager::classId (  )  const [virtual]

Returns the class id of the object.

Returns:
an id of the object's class

Implements EventListener.


Member Data Documentation

ShaderManager * ShaderManager::instance = 0 [static, private]

The singleton instance.

vector<shaderEntry*> ShaderManager::shaders [private]

The place to store all information about loaded textures.


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

Generated on Mon Jul 7 13:30:35 2008 for Firefly by  doxygen 1.5.6