Adopted the matrix transformation code from Text

This commit is contained in:
Robert Osfield 2019-07-15 16:16:45 +01:00
parent 59f417f1e0
commit 02d91a3eea

View File

@ -56,7 +56,21 @@ void Text3D::accept(osg::PrimitiveFunctor& pf) const
{
if (!_coords || _coords->empty()) return;
pf.setVertexArray(_coords->size(), &(_coords->front()));
// short term fix/workaround for _coords being transformed by a local matrix before rendering, so we need to replicate this was doing tasks like intersection testing.
osg::ref_ptr<osg::Vec3Array> vertices = _coords;
if (!_matrix.isIdentity())
{
vertices = new osg::Vec3Array;
vertices->resize(_coords->size());
for(osg::Vec3Array::iterator sitr = _coords->begin(), ditr = vertices->begin();
sitr != _coords->end();
++sitr, ++ditr)
{
*ditr = *sitr * _matrix;
}
}
pf.setVertexArray(vertices->size(), &(vertices->front()));
for(osg::Geometry::PrimitiveSetList::const_iterator itr = _frontPrimitiveSetList.begin();
itr != _frontPrimitiveSetList.end();