ReversePrimitiveFunctor 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. #ifndef OSGUTIL_REVERSEPRIMITIVEFUNCTOR
  14. #define OSGUTIL_REVERSEPRIMITIVEFUNCTOR 1
  15. #include <osg/PrimitiveSet>
  16. #include <osg/Notify>
  17. #include <osgUtil/Export>
  18. namespace osgUtil {
  19. class OSGUTIL_EXPORT ReversePrimitiveFunctor : public osg::PrimitiveIndexFunctor
  20. {
  21. public:
  22. virtual ~ReversePrimitiveFunctor() {}
  23. osg::PrimitiveSet * getReversedPrimitiveSet() { return _reversedPrimitiveSet.get(); }
  24. virtual void setVertexArray(unsigned int , const osg::Vec2* ) {}
  25. virtual void setVertexArray(unsigned int , const osg::Vec3* ) {}
  26. virtual void setVertexArray(unsigned int , const osg::Vec4* ) {}
  27. virtual void setVertexArray(unsigned int , const osg::Vec2d* ) {}
  28. virtual void setVertexArray(unsigned int , const osg::Vec3d* ) {}
  29. virtual void setVertexArray(unsigned int , const osg::Vec4d* ) {}
  30. virtual void drawArrays(GLenum mode,GLint first,GLsizei count);
  31. virtual void drawElements(GLenum mode,GLsizei count, const GLubyte* indices);
  32. virtual void drawElements(GLenum mode,GLsizei count, const GLushort* indices);
  33. virtual void drawElements(GLenum mode,GLsizei count, const GLuint* indices);
  34. /// Mimics the OpenGL \c glBegin() function.
  35. virtual void begin(GLenum mode);
  36. virtual void vertex(unsigned int /*pos*/);
  37. virtual void end();
  38. osg::ref_ptr<osg::PrimitiveSet> _reversedPrimitiveSet;
  39. private:
  40. bool _running;
  41. };
  42. } // end osgUtil namespace
  43. #endif // ** OSGUTIL_REVERSEFACEVISITOR ** //