Added computation of the bounding volume of osg::OccluderNodes.

Added support for osg::BoundingSphere::expandBy*(osg::BoundingBox) and have
added osg::BoundingSphere/Box::valid() which deprecates isValid(), this
is to be more consistent with other classes in the OSG.
This commit is contained in:
Robert Osfield
2002-06-19 15:18:47 +00:00
parent 21beb236d2
commit b12e36cede
4 changed files with 84 additions and 26 deletions

View File

@@ -11,3 +11,27 @@ OccluderNode::OccluderNode(const OccluderNode& node,const CopyOp& copyop):
_occluder(dynamic_cast<ConvexPlanerOccluder*>(copyop(node._occluder.get())))
{
}
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;
}