Robotran C Documentation
MbsRead.hh
Go to the documentation of this file.
1 
6 #ifdef OPEN_GL
7 
8 #ifndef _MBS_READ_HH_
9 #define _MBS_READ_HH_
10 
11 #include <vector>
12 #include <libxml/tree.h>
13 #include <string>
14 
15 namespace OpenGLMbs{
16 
17 // forward declaration
18 class Mbs3DComponent;
19 class Base3D;
20 class AnchorPoint3D;
21 class Joint3D;
22 class Body3D;
23 
24 class MbsShape3D;
25 
26 class MbsViewPoint;
27 
28 class MbsPointLight;
29 class MbsSpotLight;
30 class MbsDirLight;
31 
32 class MbsWorld3D;
33 
36 class MbsRead
37 {
38  public:
39  MbsRead(MbsWorld3D *world_3d);
40  ~MbsRead();
41 
42  Base3D* AddSingleMbs(const char* mbs_filename);
43 
44  private:
45  MbsWorld3D *world_3d;
46 
47  // function prototypes
48  xmlNodePtr FirstNode(xmlNodePtr node, const char* node_name);
49  xmlNodePtr FirstNodeLevel2(xmlNodePtr node, const char* name_1, const char* name_2);
50  xmlNodePtr FirstNodeLevel3(xmlNodePtr node, const char* name_1, const char* name_2, const char* name_3);
51 
52  void ListNodes(xmlNodePtr parent_node, const char* node_name, std::vector<xmlNodePtr> &node_list);
53 
54  int IntNode(xmlNodePtr node, xmlDocPtr doc);
55  float FloatNode(xmlNodePtr node, xmlDocPtr doc);
56  float FloatAttr(xmlAttr* attr, xmlDocPtr doc);
57  float FloatChild(xmlNodePtr parent_node, xmlDocPtr doc, const char *child_name);
58  void XYZChild(xmlNodePtr parent_node, xmlDocPtr doc, float &x, float &y, float &z);
59  void AttChild(xmlNodePtr parent_node, xmlDocPtr doc, float &x, float &y, float &z);
60  void RGBAttr(xmlNodePtr node, xmlDocPtr doc, float &R_col, float &G_col, float &B_col);
61 
62  AnchorPoint3D* PointExtract(xmlNodePtr point_node, xmlDocPtr doc, Body3D *cur_body);
63  Joint3D* JointExtract(xmlNodePtr joint_node, xmlDocPtr doc, Mbs3DComponent *parent, std::vector<Joint3D*> &joint_list);
64  MbsShape3D* ShapeExtract(xmlNodePtr shape_node, xmlDocPtr doc, Body3D *cur_body, std::string prj_path);
65  MbsViewPoint* ViewPointExtract(xmlNodePtr view_node, xmlDocPtr doc, Base3D *base);
66  MbsPointLight* PointLightExtract(xmlNodePtr light_node, xmlDocPtr doc, Base3D *base);
67  MbsSpotLight* SpotLightExtract(xmlNodePtr light_node, xmlDocPtr doc, Base3D *base);
68  MbsDirLight* DirLightExtract(xmlNodePtr light_node, xmlDocPtr doc, Base3D *base);
69 
70  Mbs3DComponent* ParentLocate(xmlNodePtr node, xmlDocPtr doc, Base3D *base);
71 };
72 
73 }
74 #endif
75 #endif
MbsSpotLight.hh
MbsSpotLight class.
MbsCone.hh
MbsCone class.
OpenGLMbs
Definition: MpegFrameCaptureOptions.hh:6
MbsWorld3D.hh
MbsWorld3D class.
MbsPointLight.hh
MbsPointLight class.
MbsShape3D.hh
MbsShape3D class.
MbsBox.hh
MbsBox class.
MbsInline.hh
MbsInline class.
Joint3D.hh
Joint3D class.
MbsDirLight.hh
MbsDirLight class.
MbsCylinder.hh
MbsCylinder class.
Body3D.hh
Body3D class.
Mbs3DComponent.hh
Mbs3DComponent class.
Base3D.hh
Base3D class.
MbsViewPoint.hh
MbsViewPoint class.
MbsRead.hh
MbsRead class.
MbsShape3D
MbsSphere.hh
MbsSphere class.
AnchorPoint3D.hh
AnchorPoint3D class.