From Colin McDonald, "The bounding box returned by getBound() for Text which is not
auto-rotated (e.g. HUD text) is not always correct, because it doesn't take account of the base line offsets added by the various alignment options such as CENTER_TOP, CENTER_BOTTOM etc. The attached src/osgText/TextBase.cpp fixes the problem."
This commit is contained in:
@@ -302,8 +302,9 @@ osg::BoundingBox TextBase::computeBound() const
|
||||
else
|
||||
{
|
||||
osg::Matrix matrix;
|
||||
matrix.makeTranslate(_position);
|
||||
matrix.preMultRotate(_rotation);
|
||||
matrix.makeTranslate(-_offset);
|
||||
matrix.postMultRotate(_rotation);
|
||||
matrix.postMultTranslate(_position);
|
||||
bbox.expandBy(osg::Vec3(_textBB.xMin(),_textBB.yMin(),_textBB.zMin())*matrix);
|
||||
bbox.expandBy(osg::Vec3(_textBB.xMax(),_textBB.yMax(),_textBB.zMax())*matrix);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user