288
288
if (!bbox.valid())
290
// provide a fallback in cases where no bounding box has been been setup so far
291
if (_characterSizeMode!=OBJECT_COORDS || _autoRotateToScreen)
290
// Provide a fallback in cases where no bounding box has been been setup so far.
291
// Note, assume a scaling of 1.0 for _characterSizeMode!=OBJECT_COORDS as the
292
// for screen space coordinates size modes we don't know what scale will be used until
293
// the text is actually rendered, but we haven't to assume something otherwise the
294
// text label will be culled by view or small feature culling on first frame.
295
if (_autoRotateToScreen)
293
// default to a zero size.
294
bbox.set(_position, _position);
297
// use bounding sphere encompassing the maximum size of the text centered on the _position
298
double radius = _textBB.radius();
299
osg::Vec3 diagonal(radius, radius, radius);
300
bbox.set(_position-diagonal, _position+diagonal);