PolygonStipple 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. // -*- Mode: c++ -*-
  14. #ifndef OSG_POLYGONSTIPPLE
  15. #define OSG_POLYGONSTIPPLE 1
  16. #include <osg/StateAttribute>
  17. #ifndef GL_POLYGON_STIPPLE
  18. #define GL_POLYGON_STIPPLE 0x0B42
  19. #endif
  20. namespace osg
  21. {
  22. class OSG_EXPORT PolygonStipple : public StateAttribute
  23. {
  24. public :
  25. PolygonStipple();
  26. PolygonStipple(const GLubyte* mask);
  27. /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
  28. PolygonStipple(const PolygonStipple& lw,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
  29. META_StateAttribute(osg, PolygonStipple, POLYGONSTIPPLE);
  30. /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
  31. virtual int compare(const StateAttribute& sa) const;
  32. virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
  33. {
  34. usage.usesMode(GL_POLYGON_STIPPLE);
  35. return true;
  36. }
  37. /** set the mask up, copying 128 bytes (32x32 bitfield) from mask into the local _mask.*/
  38. void setMask(const GLubyte* mask);
  39. /** get a pointer to the mask.*/
  40. inline const GLubyte* getMask() const {return _mask;}
  41. virtual void apply(State& state) const;
  42. protected :
  43. virtual ~PolygonStipple();
  44. GLubyte _mask[128];
  45. };
  46. }
  47. #endif