00001 #ifndef _ANIMDATA_H_
00002 #define _ANIMDATA_H_
00003
00004
00005 #include <vector>
00006
00007
00008 #include "../../csl/base/gmlsmartobject.h"
00009 #include "../../csl/base/gmlref.h"
00010 #include "../../csl/math/gmlvector3.h"
00011 #include "../../csl/utils3d/gmlcamera.h"
00012
00013 namespace pug
00014 {
00015 class xml_node;
00016 }
00017
00018 namespace cganim
00019 {
00020
00021
00022 class AnimObject;
00023
00081 class AnimationData: public gml::SmartObject
00082 {
00083 public:
00084
00086 AnimationData();
00087
00089 void Load(const std::string& filename);
00090
00092 bool IsLoaded() const;
00093
00094
00096 int GetNObjects() const;
00097
00099 const AnimObject* GetAnimObject(int i) const;
00100
00102 AnimObject* GetAnimObject(int i);
00103
00105 gml::Camera* GetCamera();
00106
00108 int GetNLights() const;
00109
00111 gml::Vector3d GetLightPosition(int i) const;
00112
00113 private:
00114
00115 void ParseXML(pug::xml_node node);
00116 void ParseSphere(pug::xml_node node);
00117 void ParseRectangle(pug::xml_node node);
00118 void ParseCamera(pug::xml_node node);
00119 void ParseLight(pug::xml_node node);
00120
00121
00122
00123
00125 void ParseAnimObjectCommonAttributes(pug::xml_node node, AnimObject* obj);
00126
00128 gml::Vector3d ParseVector(const std::string& str);
00130 bool ParseVelocity(pug::xml_node node, gml::Vector3d& out_velocity);
00132 bool ParseMass(pug::xml_node node, double& out_mass);
00134 bool ParseColor(pug::xml_node node, gml::Vector3d& out_color);
00136 bool ParseTexture(pug::xml_node node, std::string& out_tex_path);
00138 bool ParseSemiTransp(pug::xml_node node, double& out_matte);
00140 bool ParseSpecular(pug::xml_node node, double& out_specular);
00141 private:
00142
00144 bool m_loaded;
00145
00147 std::vector<gml::Ref<AnimObject> > m_loaded_objects;
00148
00150 gml::Ref<gml::Camera> m_camera;
00151
00153 std::vector<gml::Vector3d> m_lights;
00154 };
00155 }
00156
00157 #endif