SceneLoader Class Reference

Global singleton class used as a wrapper around file loader classes. More...

#include <SceneNode.h>

List of all members.

Public Member Functions

unsigned addLoader (FileLoader *fileLoader, std::string name)
 Register new file loader.
Scene * loadScene (const char *filename, bool recenter=false)
 Load file and return it as a scene.
Object * load (const char *filename)
 Load file and return as a simple object.

Static Public Member Functions

static SceneLoaderinstance ()
 Get the singleton instance.

Private Attributes

std::map< std::string,
FileLoader * > 
loaderMap
 Maps the file extension to file loader.

Static Private Attributes

static SceneLoaderobjInstance = 0


Detailed Description

Global singleton class used as a wrapper around file loader classes.

All file loaders must register them selves with this class. As it is singleton it can be succesfully complted during global variable initialization. Assigning the addLoader method to a dummy global variable results in automaticaly registering file loader at program initialization time. The is singleton correctly destroyed at program exit, so all registered file loader classes destructors are called.


Member Function Documentation

unsigned SceneLoader::addLoader ( FileLoader fileLoader,
std::string  name 
)

Register new file loader.

Creates new instance if not already initialized.

Returns:
Nothing. This is here, so it can be used as dummy global variable initializer.

static SceneLoader* SceneLoader::instance (  )  [inline, static]

Get the singleton instance.

Creates new instance if not already initialized.

Returns:
The SceneLoader singelton instance.

Object * SceneLoader::load ( const char *  filename  ) 

Load file and return as a simple object.

Parameters:
filename Path to the file containing the scene.

Scene * SceneLoader::loadScene ( const char *  filename,
bool  recenter = false 
)

Load file and return it as a scene.

The object in the file is loaded and returned as part of the scene. If file contains no materials the default material is inserted. The center of object can be optionaly moved to cooridinates origin.

Parameters:
filename Path to the file containing the scene.
recenter Move the center of object to origin.
Returns:
The loaded scene


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

Generated on Fri Jan 23 00:21:49 2009 for Raytracer by  doxygen 1.5.7.1