2003-01-22 00:45:36 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
|
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
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),
|
2002-08-29 19:02:01 +08:00
|
|
|
_occluder(dynamic_cast<ConvexPlanarOccluder*>(copyop(node._occluder.get())))
|
2002-06-05 17:39:04 +08:00
|
|
|
{
|
|
|
|
}
|
2002-06-19 23:18:47 +08:00
|
|
|
|
2002-09-02 20:31:35 +08:00
|
|
|
bool OccluderNode::computeBound() const
|
2002-06-19 23:18:47 +08:00
|
|
|
{
|
|
|
|
bool result = Group::computeBound();
|
|
|
|
|
|
|
|
if (getOccluder())
|
|
|
|
{
|
|
|
|
BoundingBox bb;
|
2002-08-29 19:02:01 +08:00
|
|
|
const ConvexPlanarPolygon::VertexList& vertexList = getOccluder()->getOccluder().getVertexList();
|
|
|
|
for(ConvexPlanarPolygon::VertexList::const_iterator itr=vertexList.begin();
|
2002-06-19 23:18:47 +08:00
|
|
|
itr!=vertexList.end();
|
|
|
|
++itr)
|
|
|
|
{
|
|
|
|
bb.expandBy(*itr);
|
|
|
|
}
|
|
|
|
if (bb.valid())
|
|
|
|
{
|
|
|
|
_bsphere.expandBy(bb);
|
|
|
|
_bsphere_computed=true;
|
|
|
|
result = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|