2002-06-05 17:39:04 +08:00
|
|
|
#include <osg/OccluderNode>
|
|
|
|
|
|
|
|
using namespace osg;
|
|
|
|
|
|
|
|
OccluderNode::OccluderNode()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
OccluderNode::OccluderNode(const OccluderNode& node,const CopyOp& copyop):
|
|
|
|
Group(node,copyop),
|
|
|
|
_occluder(dynamic_cast<ConvexPlanerOccluder*>(copyop(node._occluder.get())))
|
|
|
|
{
|
|
|
|
}
|
2002-06-19 23:18:47 +08:00
|
|
|
|
|
|
|
const bool OccluderNode::computeBound() const
|
|
|
|
{
|
|
|
|
bool result = Group::computeBound();
|
|
|
|
|
|
|
|
if (getOccluder())
|
|
|
|
{
|
|
|
|
BoundingBox bb;
|
|
|
|
const ConvexPlanerPolygon::VertexList& vertexList = getOccluder()->getOccluder().getVertexList();
|
|
|
|
for(ConvexPlanerPolygon::VertexList::const_iterator itr=vertexList.begin();
|
|
|
|
itr!=vertexList.end();
|
|
|
|
++itr)
|
|
|
|
{
|
|
|
|
bb.expandBy(*itr);
|
|
|
|
}
|
|
|
|
if (bb.valid())
|
|
|
|
{
|
|
|
|
_bsphere.expandBy(bb);
|
|
|
|
_bsphere_computed=true;
|
|
|
|
result = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|