From 7f3d46e110bb05e3721785124dd08bc9cd055d11 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 28 Apr 2005 05:58:20 +0000 Subject: [PATCH] Added check to see if autoTransformCache had been initialized before using it in the computeBound. --- src/osgText/Text.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/osgText/Text.cpp b/src/osgText/Text.cpp index 5cb69fd88..60b920a95 100644 --- a/src/osgText/Text.cpp +++ b/src/osgText/Text.cpp @@ -231,11 +231,18 @@ bool Text::computeBound() const 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.zMin())*matrix); - _bbox.expandBy(osg::Vec3(_textBB.xMin(),_textBB.yMax(),_textBB.zMin())*matrix); + if (_autoTransformCache[i]._traversalNumber<0 && (_characterSizeMode!=OBJECT_COORDS || _autoRotateToScreen)) + { + // _autoTransformCache is not valid so don't take it into accoumt when compute bounding volume. + } + else + { + 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.zMin())*matrix); + _bbox.expandBy(osg::Vec3(_textBB.xMin(),_textBB.yMax(),_textBB.zMin())*matrix); + } } }