From 0a78919807e6aa92af647553600011be082787d4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 9 Feb 2012 15:08:30 +0000 Subject: [PATCH] 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." --- src/osgText/TextBase.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/osgText/TextBase.cpp b/src/osgText/TextBase.cpp index 090752d39..e2da209ed 100644 --- a/src/osgText/TextBase.cpp +++ b/src/osgText/TextBase.cpp @@ -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); }