#include <animdata.h>
Public Member Functions | |
AnimationData () | |
Default constructor. | |
void | Load (const std::string &filename) |
Load source animation data from given filename. | |
bool | IsLoaded () const |
Return true if the file is already loaded. | |
int | GetNObjects () const |
Return total number of objects. | |
const AnimObject * | GetAnimObject (int i) const |
Return i-th object. | |
AnimObject * | GetAnimObject (int i) |
Return i-th object. | |
gml::Camera * | GetCamera () |
Return camera. | |
int | GetNLights () const |
Return number of lights in the scene. | |
gml::Vector3d | GetLightPosition (int i) const |
Return position of i-th point light. |
Usage:
// include GML lib required include #include "../csl/base/gmlcommon.h" // include animdata headers #include "../animdata/include/animdata.h" #include "../animdata/include/exception.h" #include "../animdata/include/sphere.h" #include "../animdata/include/rectangle.h" using namespace gml; using namespace cganim; ... AnimationData* anim_data = new AnimationData; try { anim_data->Load("..\\demos\\simple.cganim"); } catch(IOException& ex) { printf("Loading error: %s", ex.What().c_str()); return -1; } for(int i = 0; i < anim_data->GetNObjects(); ++i) { AnimObject* obj = anim_data->GetAnimObject(i); Sphere* sphere = dynamic_cast<Sphere*>(obj); if (sphere != NULL) { printf("Sphere object found\n"); continue; } Rectangle* rect = dynamic_cast<Rectangle*>(obj); if (rect != NULL) { printf("Rect object found\n"); continue; }; } delete anim_data;