ConvexPlanarOccluder 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 OSG_CONVEXPLANAROCCLUDER
  14. #define OSG_CONVEXPLANAROCCLUDER 1
  15. #include <osg/ConvexPlanarPolygon>
  16. #include <osg/Object>
  17. namespace osg {
  18. class OccluderVolume;
  19. /** A class for representing convex clipping volumes made up of several ConvexPlanarPolygon. */
  20. class OSG_EXPORT ConvexPlanarOccluder : public Object
  21. {
  22. public:
  23. ConvexPlanarOccluder():Object() {}
  24. ConvexPlanarOccluder(const ConvexPlanarOccluder& cpo,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
  25. Object(cpo,copyop),
  26. _occluder(cpo._occluder),
  27. _holeList(cpo._holeList) {}
  28. META_Object(osg,ConvexPlanarOccluder);
  29. void setOccluder(const ConvexPlanarPolygon& cpp) { _occluder = cpp; }
  30. ConvexPlanarPolygon& getOccluder() { return _occluder; }
  31. const ConvexPlanarPolygon& getOccluder() const { return _occluder; }
  32. typedef std::vector<ConvexPlanarPolygon> HoleList;
  33. void addHole(const ConvexPlanarPolygon& cpp) { _holeList.push_back(cpp); }
  34. void setHoleList(const HoleList& holeList) { _holeList=holeList; }
  35. HoleList& getHoleList() { return _holeList; }
  36. const HoleList& getHoleList() const { return _holeList; }
  37. protected:
  38. ~ConvexPlanarOccluder(); // {}
  39. ConvexPlanarPolygon _occluder;
  40. HoleList _holeList;
  41. };
  42. } // end of namespace
  43. #endif