Fixes glyphs's MODELVIEW matrices (positions, scales etc.) if state.getUseModelViewAndProjectionUniforms() is true

This commit is contained in:
Konstantin S. Matveyev 2017-04-18 15:53:48 +01:00 committed by Robert Osfield
parent 9ba9221ccf
commit 9eaf03e16e

View File

@ -493,6 +493,10 @@ void Text3D::drawImplementation(osg::RenderInfo& renderInfo) const
// ** apply this new modelview matrix // ** apply this new modelview matrix
state.applyModelViewMatrix(modelview); state.applyModelViewMatrix(modelview);
// if we are using osg::Program which requires OSG's generated uniforms to track
// modelview and projection matrices then apply them now.
if (state.getUseModelViewAndProjectionUniforms()) state.applyModelViewAndProjectionUniformsIfRequired();
osg::GLBeginEndAdapter& gl = (state.getGLBeginEndAdapter()); osg::GLBeginEndAdapter& gl = (state.getGLBeginEndAdapter());
if (_drawMode & BOUNDINGBOX) if (_drawMode & BOUNDINGBOX)
@ -583,6 +587,10 @@ void Text3D::drawImplementation(osg::RenderInfo& renderInfo) const
// restore the previous modelview matrix // restore the previous modelview matrix
state.applyModelViewMatrix(previous); state.applyModelViewMatrix(previous);
// if we are using osg::Program which requires OSG's generated uniforms to track
// modelview and projection matrices then apply them now.
if (state.getUseModelViewAndProjectionUniforms()) state.applyModelViewAndProjectionUniformsIfRequired();
} }
void Text3D::renderPerGlyph(osg::State & state) const void Text3D::renderPerGlyph(osg::State & state) const
@ -613,6 +621,10 @@ void Text3D::renderPerGlyph(osg::State & state) const
matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z())); matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z()));
state.applyModelViewMatrix(matrix); state.applyModelViewMatrix(matrix);
// if we are using osg::Program which requires OSG's generated uniforms to track
// modelview and projection matrices then apply them now.
if (state.getUseModelViewAndProjectionUniforms()) state.applyModelViewAndProjectionUniformsIfRequired();
state.lazyDisablingOfVertexAttributes(); state.lazyDisablingOfVertexAttributes();
// ** apply the vertex array // ** apply the vertex array
@ -688,6 +700,10 @@ void Text3D::renderPerFace(osg::State & state) const
matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z())); matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z()));
state.applyModelViewMatrix(matrix); state.applyModelViewMatrix(matrix);
// if we are using osg::Program which requires OSG's generated uniforms to track
// modelview and projection matrices then apply them now.
if (state.getUseModelViewAndProjectionUniforms()) state.applyModelViewAndProjectionUniformsIfRequired();
state.setVertexPointer(it->_glyphGeometry->getVertexArray()); state.setVertexPointer(it->_glyphGeometry->getVertexArray());
state.setNormalPointer(it->_glyphGeometry->getNormalArray()); state.setNormalPointer(it->_glyphGeometry->getNormalArray());
@ -713,6 +729,10 @@ void Text3D::renderPerFace(osg::State & state) const
matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z())); matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z()));
state.applyModelViewMatrix(matrix); state.applyModelViewMatrix(matrix);
// if we are using osg::Program which requires OSG's generated uniforms to track
// modelview and projection matrices then apply them now.
if (state.getUseModelViewAndProjectionUniforms()) state.applyModelViewAndProjectionUniformsIfRequired();
state.setVertexPointer(it->_glyphGeometry->getVertexArray()); state.setVertexPointer(it->_glyphGeometry->getVertexArray());
state.setNormalPointer(it->_glyphGeometry->getNormalArray()); state.setNormalPointer(it->_glyphGeometry->getNormalArray());
@ -746,6 +766,10 @@ void Text3D::renderPerFace(osg::State & state) const
matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z())); matrix.preMultTranslate(osg::Vec3d(it->_position.x(), it->_position.y(), it->_position.z()));
state.applyModelViewMatrix(matrix); state.applyModelViewMatrix(matrix);
// if we are using osg::Program which requires OSG's generated uniforms to track
// modelview and projection matrices then apply them now.
if (state.getUseModelViewAndProjectionUniforms()) state.applyModelViewAndProjectionUniformsIfRequired();
state.setVertexPointer(it->_glyphGeometry->getVertexArray()); state.setVertexPointer(it->_glyphGeometry->getVertexArray());
state.setNormalPointer(it->_glyphGeometry->getNormalArray()); state.setNormalPointer(it->_glyphGeometry->getNormalArray());