From David Callu, "fixed bounding box bug"

This commit is contained in:
Robert Osfield 2008-06-18 10:46:05 +00:00
parent d7e9e5e495
commit 7dc3ad4b5e
2 changed files with 20 additions and 0 deletions

View File

@ -126,6 +126,9 @@ public:
// // forcefully unloaded.
friend class Font3D;
virtual osg::BoundingBox computeBound() const;
protected:
virtual ~Text3D() {}

View File

@ -400,7 +400,24 @@ void Text3D::computeGlyphRepresentation()
osg::BoundingBox Text3D::computeBound() const
{
osg::BoundingBox bbox;
if (_textBB.valid())
{
for(unsigned int i=0;i<_autoTransformCache.size();++i)
{
osg::Matrix& matrix = _autoTransformCache[i]._matrix;
bbox.expandBy(osg::Vec3(_textBB.xMin(),_textBB.yMin(),_textBB.zMin())*matrix);
// bbox.expandBy(osg::Vec3(_textBB.xMax(),_textBB.yMin(),_textBB.zMin())*matrix);
bbox.expandBy(osg::Vec3(_textBB.xMax(),_textBB.yMax(),_textBB.zMax())*matrix);
// bbox.expandBy(osg::Vec3(_textBB.xMin(),_textBB.yMax(),_textBB.zMin())*matrix);
}
}
return bbox;
}