Added Text::getCharacterCorners(...) method to help applications that want to find out the positions of characters being rendered.

This commit is contained in:
Robert Osfield
2017-11-21 13:41:57 +00:00
parent d60b9714fe
commit 7f97b9f999
3 changed files with 23 additions and 4 deletions

View File

@@ -1301,6 +1301,21 @@ void Text::accept(osg::PrimitiveFunctor& pf) const
}
}
bool Text::getCharacterCorners(unsigned int index, osg::Vec3& bottomLeft, osg::Vec3& bottomRight, osg::Vec3& topLeft, osg::Vec3& topRight) const
{
if (_coords) return false;
if ((index*4+4)>static_cast<unsigned int>(_coords->size())) return false;
unsigned int base = index*4;
topLeft = (*_coords)[base];
bottomLeft = (*_coords)[base+1];
bottomRight = (*_coords)[base+2];
topRight = (*_coords)[base+3];
return true;
}
void Text::resizeGLObjectBuffers(unsigned int maxSize)
{
TextBase::resizeGLObjectBuffers(maxSize);