Further work on Bound class/Node::getBound() and Drawable::getBound() and usage in OSG codebase

This commit is contained in:
Robert Osfield 2014-05-14 16:01:40 +00:00
parent ff21af2b0d
commit 74f91037a7
30 changed files with 239 additions and 213 deletions

View File

@ -303,7 +303,7 @@ bool DePee::createHUD()
osg::BoundingBox bb; osg::BoundingBox bb;
for(unsigned int i=0;i<geode->getNumDrawables();++i) for(unsigned int i=0;i<geode->getNumDrawables();++i)
{ {
bb.expandBy(geode->getDrawable(i)->getBound()); bb.expandBy(geode->getDrawable(i)->getBoundingBox());
} }
osg::Geometry* geom = new osg::Geometry; osg::Geometry* geom = new osg::Geometry;

View File

@ -151,7 +151,7 @@ osg::Camera* createHUD()
osg::BoundingBox bb; osg::BoundingBox bb;
for(unsigned int i=0;i<geode->getNumDrawables();++i) for(unsigned int i=0;i<geode->getNumDrawables();++i)
{ {
bb.expandBy(geode->getDrawable(i)->getBound()); bb.expandBy(geode->getDrawable(i)->getBoundingBox());
} }
osg::Geometry* geom = new osg::Geometry; osg::Geometry* geom = new osg::Geometry;

View File

@ -82,7 +82,11 @@ public:
// an attempt to return a reasonable bounding box. Still does not prevent clipping of the heat map. // an attempt to return a reasonable bounding box. Still does not prevent clipping of the heat map.
virtual const osg::BoundingBox& getBoundingBox() const {return m_bounds;} virtual const osg::BoundingBox& getBoundingBox() const {return m_bounds;}
virtual osg::BoundingBox computeBoundingBox() const {return m_bounds;} virtual osg::BoundingBox computeBoundingBox() const {return m_bounds;}
#ifdef OSG_USE_BOUND
virtual osg::Bound getBound() const { return osg::Bound(m_bounds, m_bounds); }
#else
virtual const osg::BoundingSphere& getBound() const {return m_bsphere;} virtual const osg::BoundingSphere& getBound() const {return m_bsphere;}
#endif
protected: protected:
osg::BoundingBox m_bounds; osg::BoundingBox m_bounds;

View File

@ -187,7 +187,7 @@ void PosterIntersector::reset()
void PosterIntersector::intersect( osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable ) void PosterIntersector::intersect( osgUtil::IntersectionVisitor& iv, osg::Drawable* drawable )
{ {
if ( !_polytope.contains(drawable->getBound()) ) return; if ( !_polytope.contains(drawable->getBoundingBox()) ) return;
if ( iv.getDoDummyTraversal() ) return; if ( iv.getDoDummyTraversal() ) return;
// Find and collect all paged LODs in the node path // Find and collect all paged LODs in the node path

View File

@ -304,7 +304,7 @@ osg::Group* createHUDText()
text->setText("text->setFont(0); // inbuilt font."); text->setText("text->setFont(0); // inbuilt font.");
geode->addDrawable(text); geode->addDrawable(text);
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
{ {
@ -321,7 +321,7 @@ osg::Group* createHUDText()
"unable to load \"fonts/arial.ttf\""); "unable to load \"fonts/arial.ttf\"");
geode->addDrawable(text); geode->addDrawable(text);
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
{ {
@ -338,7 +338,7 @@ osg::Group* createHUDText()
"text->setFont(\"fonts/times.ttf\");": "text->setFont(\"fonts/times.ttf\");":
"unable to load \"fonts/times.ttf\""); "unable to load \"fonts/times.ttf\"");
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
cursor.x() = margin*2.0f; cursor.x() = margin*2.0f;
@ -358,7 +358,7 @@ osg::Group* createHUDText()
"unable to load \"fonts/dirtydoz.ttf\""); "unable to load \"fonts/dirtydoz.ttf\"");
geode->addDrawable(text); geode->addDrawable(text);
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
{ {
@ -375,7 +375,7 @@ osg::Group* createHUDText()
"unable to load \"fonts/fudd.ttf\""); "unable to load \"fonts/fudd.ttf\"");
geode->addDrawable(text); geode->addDrawable(text);
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
return rootNode; return rootNode;

View File

@ -300,7 +300,7 @@ osg::Group* createHUDText()
text->setText("text->setFont(0); // inbuilt font."); text->setText("text->setFont(0); // inbuilt font.");
geode->addDrawable(text); geode->addDrawable(text);
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
{ {
@ -317,7 +317,7 @@ osg::Group* createHUDText()
"unable to load \"fonts/arial.ttf\""); "unable to load \"fonts/arial.ttf\"");
geode->addDrawable(text); geode->addDrawable(text);
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
{ {
@ -334,7 +334,7 @@ osg::Group* createHUDText()
"text->setFont(\"fonts/times.ttf\");": "text->setFont(\"fonts/times.ttf\");":
"unable to load \"fonts/times.ttf\""); "unable to load \"fonts/times.ttf\"");
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
cursor.x() = margin*2.0f; cursor.x() = margin*2.0f;
@ -354,7 +354,7 @@ osg::Group* createHUDText()
"unable to load \"fonts/dirtydoz.ttf\""); "unable to load \"fonts/dirtydoz.ttf\"");
geode->addDrawable(text); geode->addDrawable(text);
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
{ {
@ -371,7 +371,7 @@ osg::Group* createHUDText()
"unable to load \"fonts/fudd.ttf\""); "unable to load \"fonts/fudd.ttf\"");
geode->addDrawable(text); geode->addDrawable(text);
cursor.x() = text->getBound().xMax() + spacing ; cursor.x() = text->getBoundingBox().xMax() + spacing ;
} }
return rootNode; return rootNode;

View File

@ -271,12 +271,13 @@ class OSG_EXPORT CullingSet : public Referenced
return false; return false;
} }
#ifdef OSG_USE_BOUND
inline bool isCulled(const Bound& bound) inline bool isCulled(const Bound& bound)
{ {
if (bound.bb) return isCulled(*bound.bb); if (bound.bb) return isCulled(*bound.bb);
else return isCulled(*bound.bs); else return isCulled(*bound.bs);
} }
#endif
inline void pushCurrentMask() inline void pushCurrentMask()
{ {
_frustum.pushCurrentMask(); _frustum.pushCurrentMask();

View File

@ -128,6 +128,20 @@ class OSG_EXPORT Drawable : public Node
/** Set the initial bounding volume to use when computing the overall bounding volume.*/ /** Set the initial bounding volume to use when computing the overall bounding volume.*/
const BoundingBox& getInitialBound() const { return _initialBound; } const BoundingBox& getInitialBound() const { return _initialBound; }
#ifdef OSG_USE_BOUND
virtual Bound getBound() const
{
if(!_boundingSphereComputed) getBoundingBox();
return Bound(_boundingSphere, _boundingBox);
}
#else
inline const BoundingSphere& getBound() const
{
if(!_boundingSphereComputed) getBoundingBox();
return _boundingSphere;
}
#endif
/** Get BoundingBox of Drawable. /** Get BoundingBox of Drawable.
* If the BoundingBox is not up to date then its updated via an internal call to computeBond(). * If the BoundingBox is not up to date then its updated via an internal call to computeBond().
*/ */

View File

@ -437,7 +437,7 @@ class OSG_EXPORT Node : public Object
/** Get the bounding sphere of node. /** Get the bounding sphere of node.
Using lazy evaluation computes the bounding sphere if it is 'dirty'.*/ Using lazy evaluation computes the bounding sphere if it is 'dirty'.*/
#ifdef OSG_USE_BOUND #ifdef OSG_USE_BOUND
inline Bound getBound() const virtual Bound getBound() const
{ {
if(!_boundingSphereComputed) if(!_boundingSphereComputed)
{ {
@ -452,7 +452,7 @@ class OSG_EXPORT Node : public Object
return Bound(_boundingSphere); return Bound(_boundingSphere);
} }
#else #else
inline BoundingSphere getBound() const inline const BoundingSphere& getBound() const
{ {
if(!_boundingSphereComputed) if(!_boundingSphereComputed)
{ {

View File

@ -317,7 +317,7 @@ BoundingSphere Billboard::computeBound() const
for( i = 0; i < ngsets; i++ ) for( i = 0; i < ngsets; i++ )
{ {
const Drawable *gset = _drawables[i].get(); const Drawable *gset = _drawables[i].get();
const BoundingBox& bbox = gset->getBound(); const BoundingBox& bbox = gset->getBoundingBox();
bsphere._center += bbox.center(); bsphere._center += bbox.center();
bsphere._center += _positionList[i]; bsphere._center += _positionList[i];
@ -329,7 +329,7 @@ BoundingSphere Billboard::computeBound() const
for( i = 0; i < ngsets; ++i ) for( i = 0; i < ngsets; ++i )
{ {
const Drawable *gset = _drawables[i].get(); const Drawable *gset = _drawables[i].get();
const BoundingBox& bbox = gset->getBound(); const BoundingBox& bbox = gset->getBoundingBox();
Vec3 local_center = bsphere._center-_positionList[i]; Vec3 local_center = bsphere._center-_positionList[i];
for(unsigned int c=0;c<8;++c) for(unsigned int c=0;c<8;++c)
{ {

View File

@ -77,7 +77,7 @@ void ComputeBoundsVisitor::apply(osg::Geode& geode)
void ComputeBoundsVisitor::applyDrawable(osg::Drawable* drawable) void ComputeBoundsVisitor::applyDrawable(osg::Drawable* drawable)
{ {
applyBoundingBox(drawable->getBound()); applyBoundingBox(drawable->getBoundingBox());
} }
void ComputeBoundsVisitor::applyBoundingBox(const osg::BoundingBox& bbox) void ComputeBoundsVisitor::applyBoundingBox(const osg::BoundingBox& bbox)

View File

@ -204,7 +204,7 @@ BoundingSphere Geode::computeBound() const
itr!=_drawables.end(); itr!=_drawables.end();
++itr) ++itr)
{ {
_bbox.expandBy((*itr)->getBound()); _bbox.expandBy((*itr)->getBoundingBox());
} }
if (_bbox.valid()) if (_bbox.valid())

View File

@ -369,7 +369,8 @@ BoundingSphere Group::computeBound() const
const osg::Transform* transform = (*itr)->asTransform(); const osg::Transform* transform = (*itr)->asTransform();
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF) if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF)
{ {
bb.expandBy((*itr)->getBound()); const osg::BoundingSphere& bs = (*itr)->getBound();
bb.expandBy(bs);
} }
} }

View File

@ -110,7 +110,7 @@ bool BuildKdTree::build(KdTree::BuildOptions& options, osg::Geometry* geometry)
if (vertices->size() <= options._targetNumTrianglesPerLeaf) return false; if (vertices->size() <= options._targetNumTrianglesPerLeaf) return false;
_bb = geometry->getBound(); _bb = geometry->getBoundingBox();
_kdTree.setVertices(vertices); _kdTree.setVertices(vertices);
unsigned int estimatedSize = (unsigned int)(2.0*float(vertices->size())/float(options._targetNumTrianglesPerLeaf)); unsigned int estimatedSize = (unsigned int)(2.0*float(vertices->size())/float(options._targetNumTrianglesPerLeaf));

View File

@ -196,7 +196,10 @@ BoundingSphere Switch::computeBound() const
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF) if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF)
{ {
if( _values[pos] == true ) if( _values[pos] == true )
bb.expandBy(_children[pos]->getBound()); {
const osg::BoundingSphere& bs = _children[pos]->getBound();
bb.expandBy(bs);
}
} }
} }
@ -213,7 +216,10 @@ BoundingSphere Switch::computeBound() const
if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF) if (!transform || transform->getReferenceFrame()==osg::Transform::RELATIVE_RF)
{ {
if( _values[pos] == true ) if( _values[pos] == true )
bsphere.expandRadiusBy(static_cast<const BoundingSphere&>(_children[pos]->getBound())); {
const osg::BoundingSphere& bs = _children[pos]->getBound();
bsphere.expandRadiusBy(bs);
}
} }
} }
return bsphere; return bsphere;

View File

@ -654,7 +654,7 @@ protected:
{ {
for (unsigned int i=0; i<billboard->getNumDrawables(); ++i) for (unsigned int i=0; i<billboard->getNumDrawables(); ++i)
{ {
osg::BoundingBox bb = billboard->getDrawable(i)->getBound(); const osg::BoundingBox& bb = billboard->getDrawable(i)->getBoundingBox();
billboard->setPosition(i,bb.center()); billboard->setPosition(i,bb.center());
osgUtil::TransformAttributeFunctor tf(osg::Matrix::translate(-bb.center())); osgUtil::TransformAttributeFunctor tf(osg::Matrix::translate(-bb.center()));
@ -1168,7 +1168,7 @@ protected:
{ {
for (unsigned int i=0; i<billboard->getNumDrawables(); ++i) for (unsigned int i=0; i<billboard->getNumDrawables(); ++i)
{ {
osg::BoundingBox bb = billboard->getDrawable(i)->getBound(); const osg::BoundingBox& bb = billboard->getDrawable(i)->getBoundingBox();
billboard->setPosition(i,bb.center()); billboard->setPosition(i,bb.center());
osgUtil::TransformAttributeFunctor tf(osg::Matrix::translate(-bb.center())); osgUtil::TransformAttributeFunctor tf(osg::Matrix::translate(-bb.center()));

View File

@ -4,7 +4,7 @@ WriterCompareTriangle::WriterCompareTriangle(const osg::Geode& geode,
unsigned int nbVertices) unsigned int nbVertices)
: geode(geode) : geode(geode)
{ {
cutscene(nbVertices, geode.getDrawable(0)->asGeometry()->getBound()); cutscene(nbVertices, geode.getDrawable(0)->asGeometry()->getBoundingBox());
} }
bool bool

View File

@ -1074,7 +1074,7 @@ void* labelRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf)
{ {
osg::Group* group = new osg::Group; osg::Group* group = new osg::Group;
osg::BoundingBox box = text->getBound(); const osg::BoundingBox& box = text->getBoundingBox();
float shift = box.radius()+1.f; float shift = box.radius()+1.f;
// front // front
@ -1518,8 +1518,8 @@ void* geomRead::Parse(trpgToken /*tok*/,trpgReadBuffer &buf)
case trpgBillboard::Individual: case trpgBillboard::Individual:
{ {
// compute center of billboard geometry // compute center of billboard geometry
const osg::BoundingBox& bbox = geometry->getBound(); const osg::BoundingBox& bbox = geometry->getBoundingBox();
osg::Vec3 center ((bbox._min + bbox._max) * 0.5f); osg::Vec3 center (bbox.center());
// make billboard geometry coordinates relative to computed center // make billboard geometry coordinates relative to computed center
osg::Matrix matrix; osg::Matrix matrix;

View File

@ -80,7 +80,7 @@ bool PickEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
cloned_ea->setTouchData(NULL); cloned_ea->setTouchData(NULL);
// reproject mouse-coord // reproject mouse-coord
const osg::BoundingBox bb(hitr->drawable->getBound()); const osg::BoundingBox bb(hitr->drawable->getBoundingBox());
const osg::Vec3& p(hitr->localIntersectionPoint); const osg::Vec3& p(hitr->localIntersectionPoint);
float transformed_x = (p.x() - bb.xMin()) / (bb.xMax() - bb.xMin()); float transformed_x = (p.x() - bb.xMin()) / (bb.xMax() - bb.xMin());
@ -106,7 +106,7 @@ bool PickEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
// reproject touch-points // reproject touch-points
const osg::BoundingBox bb(hitr->drawable->getBound()); const osg::BoundingBox bb(hitr->drawable->getBoundingBox());
osg::Camera* camera = viewer->getCamera(); osg::Camera* camera = viewer->getCamera();
osg::Matrix matrix = osg::computeLocalToWorld(hitr->nodePath, false) * camera->getViewMatrix() * camera->getProjectionMatrix(); osg::Matrix matrix = osg::computeLocalToWorld(hitr->nodePath, false) * camera->getViewMatrix() * camera->getProjectionMatrix();

View File

@ -833,7 +833,7 @@ void SlideShowConstructor::addBullet(const std::string& bullet, PositionData& po
text->setText(bullet); text->setText(bullet);
osg::BoundingBox bb = text->getBound(); const osg::BoundingBox& bb = text->getBoundingBox();
// note, this increment is only "correct" when text is on the plane of the slide.. // note, this increment is only "correct" when text is on the plane of the slide..
// will need to make this more general later. // will need to make this more general later.
@ -882,7 +882,7 @@ void SlideShowConstructor::addParagraph(const std::string& paragraph, PositionDa
} }
text->setText(paragraph); text->setText(paragraph);
osg::BoundingBox bb = text->getBound(); const osg::BoundingBox& bb = text->getBoundingBox();
// note, this increment is only "correct" when text is on the plane of the slide.. // note, this increment is only "correct" when text is on the plane of the slide..
// will need to make this more general later. // will need to make this more general later.

View File

@ -264,7 +264,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
// Stay as long as possible in model space to minimize matrix ops // Stay as long as possible in model space to minimize matrix ops
if( rl && rl->_modelview == modelview && rl->_projection == projection ){ if( rl && rl->_modelview == modelview && rl->_projection == projection ){
bb.expandBy( rl->_drawable->getBound() ); bb.expandBy( rl->_drawable->getBoundingBox() );
} else { } else {
if( bb.valid() ) { if( bb.valid() ) {
// Conditions to avoid matrix multiplications // Conditions to avoid matrix multiplications
@ -292,7 +292,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
bbResult.expandBy( bb.corner( i ) * *ptrModelToWorld ); bbResult.expandBy( bb.corner( i ) * *ptrModelToWorld );
} }
if( !rl ) break; if( !rl ) break;
bb = rl->_drawable->getBound(); bb = rl->_drawable->getBoundingBox();
modelview = rl->_modelview; modelview = rl->_modelview;
projection = rl->_projection; projection = rl->_projection;
} }
@ -331,7 +331,7 @@ osg::BoundingBox MinimalCullBoundsShadowMap::ViewData::ComputeRenderLeavesBounds
if(rl->_modelview == NULL ) if(rl->_modelview == NULL )
rl->_drawable->dirtyBound(); rl->_drawable->dirtyBound();
bb = rl->_drawable->getBound(); bb = rl->_drawable->getBoundingBox();
if( !bb.valid() ) continue; if( !bb.valid() ) continue;
// Stay as long as possible in model space to minimize matrix ops // Stay as long as possible in model space to minimize matrix ops

View File

@ -285,7 +285,7 @@ public:
{ {
if (node.getDrawable(i)) if (node.getDrawable(i))
{ {
updateBound(node.getDrawable(i)->getBound()); updateBound(node.getDrawable(i)->getBoundingBox());
} }
} }
@ -1870,7 +1870,7 @@ struct RenderLeafBounds
// OSG_INFO<<"Reusing light_mvp "<<light_mvp<<std::endl; // OSG_INFO<<"Reusing light_mvp "<<light_mvp<<std::endl;
} }
const osg::BoundingBox& bb = renderLeaf->_drawable->getBound(); const osg::BoundingBox& bb = renderLeaf->_drawable->getBoundingBox();
if (bb.valid()) if (bb.valid())
{ {
// OSG_NOTICE<<"checked extents of "<<renderLeaf->_drawable->getName()<<std::endl; // OSG_NOTICE<<"checked extents of "<<renderLeaf->_drawable->getName()<<std::endl;

View File

@ -738,7 +738,7 @@ bool CullVisitor::updateCalculatedNearFar(const osg::Matrix& matrix,const osg::B
bool CullVisitor::updateCalculatedNearFar(const osg::Matrix& matrix,const osg::Drawable& drawable, bool isBillboard) bool CullVisitor::updateCalculatedNearFar(const osg::Matrix& matrix,const osg::Drawable& drawable, bool isBillboard)
{ {
const osg::BoundingBox& bb = drawable.getBound(); const osg::BoundingBox& bb = drawable.getBoundingBox();
value_type d_near, d_far; value_type d_near, d_far;
@ -981,7 +981,7 @@ void CullVisitor::apply(osg::Drawable& drawable)
{ {
RefMatrix& matrix = *getModelViewMatrix(); RefMatrix& matrix = *getModelViewMatrix();
const BoundingBox &bb =drawable.getBound(); const BoundingBox &bb =drawable.getBoundingBox();
if( drawable.getCullCallback() ) if( drawable.getCullCallback() )
{ {
@ -1085,7 +1085,7 @@ void CullVisitor::apply(Billboard& node)
node.computeMatrix(*billboard_matrix,eye_local,pos); node.computeMatrix(*billboard_matrix,eye_local,pos);
if (_computeNearFar && drawable->getBound().valid()) updateCalculatedNearFar(*billboard_matrix,*drawable,true); if (_computeNearFar && drawable->getBoundingBox().valid()) updateCalculatedNearFar(*billboard_matrix,*drawable,true);
float depth = distance(pos,modelview); float depth = distance(pos,modelview);
/* /*
if (_computeNearFar) if (_computeNearFar)

View File

@ -590,7 +590,7 @@ bool IntersectVisitor::intersect(Drawable& drawable)
IntersectState* cis = _intersectStateStack.back().get(); IntersectState* cis = _intersectStateStack.back().get();
const BoundingBox& bb = drawable.getBound(); const BoundingBox& bb = drawable.getBoundingBox();
for(IntersectState::LineSegmentList::iterator sitr=cis->_segList.begin(); for(IntersectState::LineSegmentList::iterator sitr=cis->_segList.begin();
sitr!=cis->_segList.end(); sitr!=cis->_segList.end();

View File

@ -312,7 +312,7 @@ void LineSegmentIntersector::intersect(osgUtil::IntersectionVisitor& iv, osg::Dr
if (reachedLimit()) return; if (reachedLimit()) return;
osg::Vec3d s(_start), e(_end); osg::Vec3d s(_start), e(_end);
if ( !intersectAndClip( s, e, drawable->getBound() ) ) return; if ( !intersectAndClip( s, e, drawable->getBoundingBox() ) ) return;
if (iv.getDoDummyTraversal()) return; if (iv.getDoDummyTraversal()) return;

View File

@ -2876,7 +2876,7 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Geode* geode, unsigned int
unsigned int i; unsigned int i;
for(i=0; i<geode->getNumDrawables(); ++i) for(i=0; i<geode->getNumDrawables(); ++i)
{ {
bb.expandBy(geode->getDrawable(i)->getBound().center()); bb.expandBy(geode->getDrawable(i)->getBoundingBox().center());
} }
float radius = bb.radius(); float radius = bb.radius();

View File

@ -108,7 +108,7 @@ void RayIntersector::intersect(IntersectionVisitor& iv, Drawable* drawable)
// clip ray to finite line segment // clip ray to finite line segment
Vec3d s(_start), e; Vec3d s(_start), e;
if (!intersectAndClip(s, _direction, e, drawable->getBound())) return; if (!intersectAndClip(s, _direction, e, drawable->getBoundingBox())) return;
// dummy traversal // dummy traversal
if (iv.getDoDummyTraversal()) return; if (iv.getDoDummyTraversal()) return;

View File

@ -151,7 +151,7 @@ void HelpHandler::setUpScene(osgViewer::ViewerBase* viewer)
label->setPosition(pos); label->setPosition(pos);
label->setText(_applicationUsage->getDescription()); label->setText(_applicationUsage->getDescription());
pos.x() = label->getBound().xMax(); pos.x() = label->getBoundingBox().xMax();
pos.y() -= characterSize*2.5f; pos.y() -= characterSize*2.5f;
} }

View File

@ -1149,7 +1149,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
frameRateLabel->setPosition(pos); frameRateLabel->setPosition(pos);
frameRateLabel->setText("Frame Rate: "); frameRateLabel->setText("Frame Rate: ");
pos.x() = frameRateLabel->getBound().xMax(); pos.x() = frameRateLabel->getBoundingBox().xMax();
osg::ref_ptr<osgText::Text> frameRateValue = new osgText::Text; osg::ref_ptr<osgText::Text> frameRateValue = new osgText::Text;
geode->addDrawable( frameRateValue.get() ); geode->addDrawable( frameRateValue.get() );
@ -1347,7 +1347,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
averageLabel->setPosition(pos); averageLabel->setPosition(pos);
averageLabel->setText("DatabasePager time to merge new tiles - average: "); averageLabel->setText("DatabasePager time to merge new tiles - average: ");
pos.x() = averageLabel->getBound().xMax(); pos.x() = averageLabel->getBoundingBox().xMax();
osg::ref_ptr<osgText::Text> averageValue = new osgText::Text; osg::ref_ptr<osgText::Text> averageValue = new osgText::Text;
_statsGeode->addDrawable( averageValue.get() ); _statsGeode->addDrawable( averageValue.get() );
@ -1358,7 +1358,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
averageValue->setPosition(pos); averageValue->setPosition(pos);
averageValue->setText("1000"); averageValue->setText("1000");
pos.x() = averageValue->getBound().xMax() + 2.0f*_characterSize; pos.x() = averageValue->getBoundingBox().xMax() + 2.0f*_characterSize;
osg::ref_ptr<osgText::Text> minLabel = new osgText::Text; osg::ref_ptr<osgText::Text> minLabel = new osgText::Text;
@ -1370,7 +1370,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
minLabel->setPosition(pos); minLabel->setPosition(pos);
minLabel->setText("min: "); minLabel->setText("min: ");
pos.x() = minLabel->getBound().xMax(); pos.x() = minLabel->getBoundingBox().xMax();
osg::ref_ptr<osgText::Text> minValue = new osgText::Text; osg::ref_ptr<osgText::Text> minValue = new osgText::Text;
_statsGeode->addDrawable( minValue.get() ); _statsGeode->addDrawable( minValue.get() );
@ -1381,7 +1381,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
minValue->setPosition(pos); minValue->setPosition(pos);
minValue->setText("1000"); minValue->setText("1000");
pos.x() = minValue->getBound().xMax() + 2.0f*_characterSize; pos.x() = minValue->getBoundingBox().xMax() + 2.0f*_characterSize;
osg::ref_ptr<osgText::Text> maxLabel = new osgText::Text; osg::ref_ptr<osgText::Text> maxLabel = new osgText::Text;
_statsGeode->addDrawable( maxLabel.get() ); _statsGeode->addDrawable( maxLabel.get() );
@ -1392,7 +1392,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
maxLabel->setPosition(pos); maxLabel->setPosition(pos);
maxLabel->setText("max: "); maxLabel->setText("max: ");
pos.x() = maxLabel->getBound().xMax(); pos.x() = maxLabel->getBoundingBox().xMax();
osg::ref_ptr<osgText::Text> maxValue = new osgText::Text; osg::ref_ptr<osgText::Text> maxValue = new osgText::Text;
_statsGeode->addDrawable( maxValue.get() ); _statsGeode->addDrawable( maxValue.get() );
@ -1403,7 +1403,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
maxValue->setPosition(pos); maxValue->setPosition(pos);
maxValue->setText("1000"); maxValue->setText("1000");
pos.x() = maxValue->getBound().xMax(); pos.x() = maxValue->getBoundingBox().xMax();
osg::ref_ptr<osgText::Text> requestsLabel = new osgText::Text; osg::ref_ptr<osgText::Text> requestsLabel = new osgText::Text;
_statsGeode->addDrawable( requestsLabel.get() ); _statsGeode->addDrawable( requestsLabel.get() );
@ -1414,7 +1414,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
requestsLabel->setPosition(pos); requestsLabel->setPosition(pos);
requestsLabel->setText("requests: "); requestsLabel->setText("requests: ");
pos.x() = requestsLabel->getBound().xMax(); pos.x() = requestsLabel->getBoundingBox().xMax();
osg::ref_ptr<osgText::Text> requestList = new osgText::Text; osg::ref_ptr<osgText::Text> requestList = new osgText::Text;
_statsGeode->addDrawable( requestList.get() ); _statsGeode->addDrawable( requestList.get() );
@ -1425,7 +1425,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
requestList->setPosition(pos); requestList->setPosition(pos);
requestList->setText("0"); requestList->setText("0");
pos.x() = requestList->getBound().xMax() + 2.0f*_characterSize;; pos.x() = requestList->getBoundingBox().xMax() + 2.0f*_characterSize;;
osg::ref_ptr<osgText::Text> compileLabel = new osgText::Text; osg::ref_ptr<osgText::Text> compileLabel = new osgText::Text;
_statsGeode->addDrawable( compileLabel.get() ); _statsGeode->addDrawable( compileLabel.get() );
@ -1436,7 +1436,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
compileLabel->setPosition(pos); compileLabel->setPosition(pos);
compileLabel->setText("tocompile: "); compileLabel->setText("tocompile: ");
pos.x() = compileLabel->getBound().xMax(); pos.x() = compileLabel->getBoundingBox().xMax();
osg::ref_ptr<osgText::Text> compileList = new osgText::Text; osg::ref_ptr<osgText::Text> compileList = new osgText::Text;
_statsGeode->addDrawable( compileList.get() ); _statsGeode->addDrawable( compileList.get() );
@ -1447,7 +1447,7 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase* viewer)
compileList->setPosition(pos); compileList->setPosition(pos);
compileList->setText("0"); compileList->setText("0");
pos.x() = maxLabel->getBound().xMax(); pos.x() = maxLabel->getBoundingBox().xMax();
_statsGeode->setCullCallback(new PagerCallback(dp, minValue.get(), maxValue.get(), averageValue.get(), requestList.get(), compileList.get(), 1000.0)); _statsGeode->setCullCallback(new PagerCallback(dp, minValue.get(), maxValue.get(), averageValue.get(), requestList.get(), compileList.get(), 1000.0));
} }
@ -1626,7 +1626,7 @@ void StatsHandler::createTimeStatsLine(const std::string& lineLabel,
label->setPosition(pos); label->setPosition(pos);
label->setText(lineLabel + ": "); label->setText(lineLabel + ": ");
pos.x() = label->getBound().xMax(); pos.x() = label->getBoundingBox().xMax();
osg::ref_ptr<osgText::Text> value = new osgText::Text; osg::ref_ptr<osgText::Text> value = new osgText::Text;
_statsGeode->addDrawable( value.get() ); _statsGeode->addDrawable( value.get() );

View File

@ -141,7 +141,7 @@ void Label::setShadow(point_type offset) {
} }
XYCoord Label::getTextSize() const { XYCoord Label::getTextSize() const {
osg::BoundingBox bb = _text->getBound(); const osg::BoundingBox& bb = _text->getBoundingBox();
return XYCoord( return XYCoord(
osg::round(bb.xMax() - bb.xMin()), osg::round(bb.xMax() - bb.xMin()),