VboManager Class Reference

#include <VboManager.h>

Inheritance diagram for VboManager:

EventListener Object

List of all members.

Public Member Functions

void registerObject (const string &filename)
 Registers a texture for use in the Texture Manager.
void unregisterObject (const string &filename)
 Unregisters a texture.
void processEvent (SDL_Event &event)
 A method to deal with SDL_Event.
struct vboEntrygetEntry (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 VboManagergetInstance ()
 The singleton getter.

Private Member Functions

void createStandardMesh (struct vboEntry *entry)
 Creates a standard mesh if no file is available.
void loadBmm (struct vboEntry *entry)
 Loads raw data from a bmm file.
void calculateNormals (struct vboEntry *entry)
 Calculates the normals for each vertex in an entry.
void createVbo (struct vboEntry *entry)
 Creates VBOs from raw data.
void loadObject (struct vboEntry *entry)
 Loads a triangle mesh from file to OpenGL.
void reload ()
 Restores VBO's on resizes.
 VboManager ()
 The constructor.
 VboManager (const VboManager &source)
 The copy constructor.
 ~VboManager ()
 The destructor.

Private Attributes

vector< vboEntry * > objects
 The place to store all information about loaded textures.

Static Private Attributes

static VboManagerinstance = 0
 The singleton instance.


Constructor & Destructor Documentation

VboManager::VboManager (  )  [private]

The constructor.

Initializes the texture manager.

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

The copy constructor.

Should not be called.

VboManager::~VboManager (  )  [private]

The destructor.

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


Member Function Documentation

void VboManager::createStandardMesh ( struct vboEntry entry  )  [private]

Creates a standard mesh if no file is available.

Creates the raw data for a square plane in the x/z-plane sized 100.0 world units centered at the origin.

Parameters:
entry The entry in which to load the raw data

void VboManager::loadBmm ( struct vboEntry entry  )  [private]

Loads raw data from a bmm file.

void VboManager::calculateNormals ( struct vboEntry entry  )  [private]

Calculates the normals for each vertex in an entry.

Calculates the normals for each vertex based on the normals of each adjacent triangle.

void VboManager::createVbo ( struct vboEntry entry  )  [private]

Creates VBOs from raw data.

void VboManager::loadObject ( struct vboEntry entry  )  [private]

Loads a triangle mesh from file to OpenGL.

Loads bmm-Meshes. These meshes have a local coordinate system that is oriented as follows: x-Axis is the facing direction of the mesh, y-Axis is the top-direction of the mesh and z-Axis is right from the viewpoint of the mesh. Note that the normals saved witin the file will be replaced by freshly calculated ones.

Parameters:
meshFilename The mesh to be loaded (must be a proper bmm, otherwise fatal runtime errors will occur).

void VboManager::reload (  )  [private]

Restores VBO's on resizes.

VboManager * VboManager::getInstance (  )  [static]

The singleton getter.

The only way to access the manager

void VboManager::registerObject ( const string &  filename  ) 

Registers a texture for use in the Texture Manager.

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

Parameters:
filename Must be a valid filename otherwise a default image will be loaded.

void VboManager::unregisterObject ( const string &  filename  ) 

Unregisters a texture.

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

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

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

A method to deal with SDL_Event.

Implements EventListener.

struct vboEntry * VboManager::getEntry ( const string &  filename  )  [read]

string VboManager::toString (  )  const [virtual]

Returns a textual representation.

Returns:
a string descriping the run-time object

Implements EventListener.

string VboManager::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 VboManager::classId (  )  const [virtual]

Returns the class id of the object.

Returns:
an id of the object's class

Implements EventListener.


Member Data Documentation

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

The singleton instance.

vector<vboEntry*> VboManager::objects [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