Canvas: Provide sane default bounding box (For Image & Text)

This commit is contained in:
Thomas Geymayer 2013-01-09 12:11:19 +01:00
parent 8a9693a28e
commit ea8023e51f

View File

@ -405,7 +405,15 @@ namespace canvas
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
osg::BoundingBox Element::getTransformedBounds(const osg::Matrix& m) const osg::BoundingBox Element::getTransformedBounds(const osg::Matrix& m) const
{ {
if( !_drawable )
return osg::BoundingBox(); return osg::BoundingBox();
osg::BoundingBox transformed;
const osg::BoundingBox& bb = _drawable->getBound();
for(int i = 0; i < 4; ++i)
transformed.expandBy( m * bb.corner(i) );
return transformed;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------