#include <ObjectLoader.h>
Public Member Functions | |
ObjectLoader (std::string path, MaterialLoader *mats=0) | |
virtual | ~ObjectLoader () |
Object * | getObject () |
bool | nextFrame () |
bool | goToFrame (const int &n) |
std::vector < Triangle * > * | getTriangles () |
Private Member Functions | |
void | init () |
void | initMaterials () |
void | updateMesh () |
void | initStatic () |
void | initAffine () |
void | initDynamic () |
void | updateMatrix () |
Private Attributes | |
MaterialLoader * | materials |
SolidObject * | object |
std::string | name |
AnimType | aType |
std::string | material |
std::vector< Vertex > | vertices |
std::vector< Triangle * > | tris |
std::vector < Primitive * > | primitives |
bool | initialised |
Supports loading of static meshes, affine animated meshes (provide a worldmatrix for every frame) and dynamic meshes which are rebuilt every frame.
Definition at line 31 of file ObjectLoader.h.
rcrt::ObjectLoader::ObjectLoader | ( | std::string | path, | |
MaterialLoader * | mats = 0 | |||
) |
Definition at line 11 of file ObjectLoader.cpp.
rcrt::ObjectLoader::~ObjectLoader | ( | ) | [virtual] |
void rcrt::ObjectLoader::init | ( | ) | [private] |
Definition at line 21 of file ObjectLoader.cpp.
References rcrt::AFFINE, aType, rcrt::DYNAMIC, rcrt::MaterialLoader::getMaterial(), initAffine(), initDynamic(), initialised, initMaterials(), material, materials, name, rcrt::XMLLoader::nextStartTag(), rcrt::XMLLoader::parser, and rcrt::STATIC.
Referenced by goToFrame(), and nextFrame().
void rcrt::ObjectLoader::initMaterials | ( | ) | [private] |
Definition at line 63 of file ObjectLoader.cpp.
References material, rcrt::XMLLoader::nextStartTag(), and rcrt::XMLLoader::parser.
Referenced by init().
void rcrt::ObjectLoader::updateMesh | ( | ) | [private] |
Definition at line 83 of file ObjectLoader.cpp.
References rcrt::XMLLoader::currentFrame, rcrt::XMLLoader::eof, rcrt::XMLLoader::nextStartTag(), object, rcrt::XMLLoader::parser, primitives, tris, and vertices.
Referenced by goToFrame(), initAffine(), and nextFrame().
void rcrt::ObjectLoader::initStatic | ( | ) | [private] |
void rcrt::ObjectLoader::initAffine | ( | ) | [private] |
Definition at line 235 of file ObjectLoader.cpp.
References name, updateMatrix(), and updateMesh().
Referenced by init().
void rcrt::ObjectLoader::initDynamic | ( | ) | [private] |
void rcrt::ObjectLoader::updateMatrix | ( | ) | [private] |
Definition at line 196 of file ObjectLoader.cpp.
References rcrt::XMLLoader::eof, name, rcrt::XMLLoader::nextStartTag(), rcrt::XMLLoader::parser, and rcrt::toString().
Referenced by goToFrame(), and initAffine().
Object * rcrt::ObjectLoader::getObject | ( | ) |
bool rcrt::ObjectLoader::nextFrame | ( | ) | [virtual] |
Loads info from next frame. If on starting tag of frame, load this one, else go to next frame starting tag and load from that.
Implements rcrt::XMLLoader.
Definition at line 247 of file ObjectLoader.cpp.
References rcrt::XMLLoader::currentFrame, rcrt::XMLLoader::eof, init(), initialised, rcrt::XMLLoader::nextStartTag(), rcrt::XMLLoader::parser, and updateMesh().
bool rcrt::ObjectLoader::goToFrame | ( | const int & | n | ) | [virtual] |
Loads info of frame n.
Implements rcrt::XMLLoader.
Definition at line 268 of file ObjectLoader.cpp.
References rcrt::AFFINE, aType, rcrt::XMLLoader::currentFrame, rcrt::DYNAMIC, rcrt::XMLLoader::eof, init(), initialised, rcrt::XMLLoader::nextStartTag(), rcrt::XMLLoader::parser, rcrt::STATIC, updateMatrix(), and updateMesh().
vector< Triangle * > * rcrt::ObjectLoader::getTriangles | ( | ) |
MaterialLoader* rcrt::ObjectLoader::materials [private] |
SolidObject* rcrt::ObjectLoader::object [private] |
Definition at line 35 of file ObjectLoader.h.
Referenced by getObject(), updateMesh(), and ~ObjectLoader().
std::string rcrt::ObjectLoader::name [private] |
Definition at line 36 of file ObjectLoader.h.
Referenced by init(), initAffine(), initDynamic(), and updateMatrix().
AnimType rcrt::ObjectLoader::aType [private] |
std::string rcrt::ObjectLoader::material [private] |
std::vector<Vertex> rcrt::ObjectLoader::vertices [private] |
std::vector<Triangle*> rcrt::ObjectLoader::tris [private] |
std::vector<Primitive*> rcrt::ObjectLoader::primitives [private] |
bool rcrt::ObjectLoader::initialised [private] |