#include <SceneNode.h>
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 SceneLoader * | instance () |
Get the singleton instance. | |
Private Attributes | |
std::map< std::string, FileLoader * > | loaderMap |
Maps the file extension to file loader. | |
Static Private Attributes | |
static SceneLoader * | objInstance = 0 |
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.
unsigned SceneLoader::addLoader | ( | FileLoader * | fileLoader, | |
std::string | name | |||
) |
Register new file loader.
Creates new instance if not already initialized.
static SceneLoader* SceneLoader::instance | ( | ) | [inline, static] |
Get the singleton instance.
Creates new instance if not already initialized.
Object * SceneLoader::load | ( | const char * | filename | ) |
Load file and return as a simple object.
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.
filename | Path to the file containing the scene. | |
recenter | Move the center of object to origin. |