OSGPolygon.h

Go to the documentation of this file.
00001 /* $Id: OSGPolygon.h,v 1.1 2002/10/23 10:06:05 cvs Exp $ */
00002 
00003 #ifndef __OSG_POLYGON_H
00004 #define __OSG_POLYGON_H
00005 
00006 #include <esg/geometry/_Surface.h>
00007 #include <esg/Leaf.h>
00008 #include <osg/Array>
00009 #include <osg/PrimitiveSet>
00010 #include <osg/Geometry>
00011 #include <GL/gl.h>
00012 
00013 
00014 namespace esg {
00015 
00022 class ESG_OSG_EXPORT OSGPolygon : public _Surface {
00023 protected:
00024     GLint                           _firstVertexOfPrimitive;
00025     GLint                           _firstVertex;
00026     osg::PrimitiveSet::Type         _primitiveType;
00027     osg::PrimitiveSet::Mode         _vertexMode;
00028     osg::Vec3Array *                _globalVertexArray;
00029     osg::PrimitiveSet *             _pDrawArray;
00030     osg::Vec3Array *                _globalNormalArray;
00031     osg::Geometry::AttributeBinding _normal_binding;
00032 
00033 protected:
00034     virtual void    _duplicate_attributes (const Geometry&);
00035     virtual Vector3 _get_vertex           (unsigned) const;
00036     virtual Vector3 _get_vert_normal      (unsigned) const;
00037 
00038     OSGPolygon () {}
00039 
00040 public:
00041     OSGPolygon(GLint /*first vertex of primitive */,
00042                            GLint /*first v. of polygon relativ to primitive */,
00043                            osg::PrimitiveSet::Type /* primitive type */,
00044                            osg::PrimitiveSet::Mode /* vertex mode */,
00045                            osg::Vec3Array * /* global array of vertices  */,
00046                            osg::PrimitiveSet * /* original draw array */,
00047                            osg::Vec3Array * /* global array of normals */,
00048                            osg::Geometry::AttributeBinding);
00049 
00050     virtual SceneGraphObject* clone () const;
00051     virtual Geometry* clone (const Matrix4*) const;
00052 
00053     virtual Vector3 getVertex        (unsigned) const;
00054     virtual Vector3 getVertNormal    (unsigned) const;
00055     virtual Vector2 getVertUVCoord   (unsigned) const { return Vector2(); }
00056     virtual bool    haveVertNormals  (void)     const;
00057     virtual bool    haveVertUVCoords (void)     const { return false; }
00058 
00059     /*
00060      * new methods
00061      */
00062     osg::Vec3Array*         globalVertexArray (void) { return _globalVertexArray; }
00063     GLint                   firstVertex           (void) const { return _firstVertex; }
00064     GLint                   firstVertexOfPrimitive(void) const { return _firstVertexOfPrimitive;}
00065     osg::PrimitiveSet::Mode vertexMode   (void) const { return _vertexMode; }
00066     osg::PrimitiveSet*      drawArray    (void) const { return _pDrawArray; }
00067     osg::PrimitiveSet::Type primitiveType(void) const { return _primitiveType;}
00068     osg::Vec3Array*         globalNormalArray(void) { return _globalNormalArray; }
00069     osg::Geometry::AttributeBinding normalBinding (void) const { return _normal_binding; }
00070 
00071 };
00072 
00073 };
00074 
00075 #endif // __OSG_POLYGON_H

Generated on Wed Jun 28 12:24:28 2006 for esg by  doxygen 1.4.6