vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GeometryLoader.h
Go to the documentation of this file.
1 #ifndef GEOMETRY_LOADER_H
2 #define GEOMETRY_LOADER_H
3 #include <vrecko/Ability.h>
4 #include <osg/Node>
5 #include <osg/Geode>
6 #include <osg/Geometry>
7 
8 using namespace vrecko;
9 
10 /*
11  This class load vertexarrays from osg node into structure
12 */
13 
14 namespace APFFDEditor {
15 
17  public:
19  ~GeometryLoader();
20  struct Geometry {
21  osg::Geometry * SetNode;
22  //osg::Vec3Array* pVertexArray;
23  osg::Vec3Array* pVertexStartArray;
24  osg::Vec3* pVertexRelposition;
25  osg::Matrix transformMatrix;
26  };
27  inline Geometry* getGeometry(unsigned long index){if (geometryArray) return (&geometryArray[index]); else return NULL;}
28  virtual bool loadGeometry(osg::Node *pNode);
29  unsigned long getGeometriesCount(void){return geometries_count;}
30  protected:
31 
32  inline void allocateGeometryArray(int count) {
33  geometryArray = new Geometry[count]; geometries_count = count;
34  }
35  inline void deallocateGeometryArray() { if (geometryArray) { delete[] (geometryArray); } }
37  bool loadGeometryHelper(osg::Node *pNode, osg::Matrix &transform, unsigned long &geometry_pos);
38  bool getOSGInitCounts(osg::Node *pNode, unsigned long &pGeometriesCount);
39  virtual void destroyGeometry();
40  unsigned long geometries_count;
41 
42  };
43 
44 }
45 
46 #endif