OMToolkit  1.0
The polygonal mesh processing tool.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OMGeometry.h
Go to the documentation of this file.
1 //==============================================================================
14 #ifndef _OM_GEOMETRY_H_
15 #define _OM_GEOMETRY_H_
16 
17 #include <OpenMesh\Tools\Utils\Timer.hh>
18 #include <OMToolkit\OMErrorLog.h>
19 #include <MDSTk\Base\mdsGlobalLog.h>
20 #include <OpenMesh\Core\IO\exporter\ExporterT.hh>
21 #include <OMToolkit\OMTypes.h>
22 
23 #include <osg/Geometry>
24 
25 namespace osg
26 {
27 
32 template <class Mesh>
33 class OMGeometry : public Geometry
34 {
35  public:
39  typedef unsigned char AttributeBinding;
40 
44  static const AttributeBinding NORMAL_NONE = 1;
45 
51 
57 
61  static const AttributeBinding COLOR_NONE = 8;
62 
68 
73  static const AttributeBinding COLOR_PER_FACE = 32;
74 
82  OMGeometry(Mesh mesh, AttributeBinding binding = NORMAL_PER_FACE | COLOR_PER_VERTEX, Vec4 &defaultColor = Vec4(0.5, 0.5, 0.5, 1.0));
83 
88  bool isLoadedOk();
89 
90  private:
91 
95  bool loaded_done;
96 
102  bool LoadVertices(Mesh mesh);
103 
109  bool LoadFaces(Mesh mesh);
110 
119  bool LoadColor(Mesh mesh, osg::Vec4 &defaultColor = Vec4(1.0, 1.0, 1.0, 1.0), Geometry::AttributeBinding binding = Geometry::BIND_PER_VERTEX);
120 
128  bool LoadNormals(Mesh mesh, Geometry::AttributeBinding binding = Geometry::BIND_PER_PRIMITIVE);
129  }; // class OMGeometry
130 
132 }
133 #endif