Adopted the matrix transformation code from Text
This commit is contained in:
parent
59f417f1e0
commit
02d91a3eea
@ -56,7 +56,21 @@ void Text3D::accept(osg::PrimitiveFunctor& pf) const
|
|||||||
{
|
{
|
||||||
if (!_coords || _coords->empty()) return;
|
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();
|
for(osg::Geometry::PrimitiveSetList::const_iterator itr = _frontPrimitiveSetList.begin();
|
||||||
itr != _frontPrimitiveSetList.end();
|
itr != _frontPrimitiveSetList.end();
|
||||||
|
Loading…
Reference in New Issue
Block a user