2002-07-17 04:07:32 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield
|
2002-05-29 07:43:22 +08:00
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
#ifndef OSG_CONVEXPLANAROCCLUDER
|
|
|
|
#define OSG_CONVEXPLANAROCCLUDER 1
|
2002-05-29 07:43:22 +08:00
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
#include <osg/ConvexPlanarPolygon>
|
2002-06-20 00:06:03 +08:00
|
|
|
#include <osg/Object>
|
2002-05-29 07:43:22 +08:00
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
|
|
|
class OccluderVolume;
|
|
|
|
|
2002-06-03 23:39:41 +08:00
|
|
|
/** A class for representing convex clipping volumes made up.
|
2002-05-29 07:43:22 +08:00
|
|
|
* When adding planes, their normals should point inwards (into the volume) */
|
2002-08-29 19:02:01 +08:00
|
|
|
class SG_EXPORT ConvexPlanarOccluder : public Object
|
2002-05-29 07:43:22 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
ConvexPlanarOccluder():Object() {}
|
|
|
|
ConvexPlanarOccluder(const ConvexPlanarOccluder& cpo,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
2002-06-20 00:06:03 +08:00
|
|
|
Object(cpo,copyop),
|
|
|
|
_occluder(cpo._occluder),
|
|
|
|
_holeList(cpo._holeList) {}
|
2002-05-29 07:43:22 +08:00
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
META_Object(osg,ConvexPlanarOccluder)
|
2002-05-29 07:43:22 +08:00
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
void setOccluder(const ConvexPlanarPolygon& cpp) { _occluder = cpp; }
|
2002-05-29 07:43:22 +08:00
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
ConvexPlanarPolygon& getOccluder() { return _occluder; }
|
2002-05-29 07:43:22 +08:00
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
const ConvexPlanarPolygon& getOccluder() const { return _occluder; }
|
2002-05-29 07:43:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
typedef std::vector<ConvexPlanarPolygon> HoleList;
|
2002-05-29 07:43:22 +08:00
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
void addHole(const ConvexPlanarPolygon& cpp) { _holeList.push_back(cpp); }
|
2002-05-29 07:43:22 +08:00
|
|
|
|
|
|
|
HoleList& getHoleList() { return _holeList; }
|
|
|
|
|
|
|
|
const HoleList& getHoleList() const { return _holeList; }
|
|
|
|
|
|
|
|
void computeAttributes();
|
|
|
|
|
|
|
|
void computeBound(BoundingBox& bb) const;
|
|
|
|
|
|
|
|
void computeBound(BoundingSphere& bs) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
~ConvexPlanarOccluder() {}
|
2002-05-29 07:43:22 +08:00
|
|
|
|
2002-08-29 19:02:01 +08:00
|
|
|
ConvexPlanarPolygon _occluder;
|
2002-05-29 07:43:22 +08:00
|
|
|
HoleList _holeList;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end of namespace
|
|
|
|
|
|
|
|
#endif
|