Added new Node/Drawable::s/getInitialBound and Node/Drawable::s/getComputeBoundCallback

methods and reimplement computeBound so that it passes back a bounding volume rather
than modifying the local one.
This commit is contained in:
Robert Osfield
2005-05-12 14:03:22 +00:00
parent ad2bd31ac8
commit bf4d63f6ea
52 changed files with 337 additions and 377 deletions

View File

@@ -80,15 +80,15 @@ void LightPointNode::removeLightPoint(unsigned int pos)
dirtyBound();
}
bool LightPointNode::computeBound() const
osg::BoundingSphere LightPointNode::computeBound() const
{
_bsphere.init();
osg::BoundingSphere bsphere;
bsphere.init();
_bbox.init();
if (_lightPointList.empty())
{
_bsphere_computed=true;
return false;
return bsphere;
}
@@ -101,21 +101,19 @@ bool LightPointNode::computeBound() const
}
_bsphere.set(_bbox.center(),0.0f);
bsphere.set(_bbox.center(),0.0f);
for(itr=_lightPointList.begin();
itr!=_lightPointList.end();
++itr)
{
osg::Vec3 dv(itr->_position-_bsphere.center());
osg::Vec3 dv(itr->_position-bsphere.center());
float radius = dv.length()+itr->_radius;
if (_bsphere.radius()<radius) _bsphere.radius()=radius;
if (bsphere.radius()<radius) bsphere.radius()=radius;
}
_bsphere.radius()+=1.0f;
_bsphere_computed=true;
return true;
bsphere.radius()+=1.0f;
return bsphere;
}