From Michael Platings, introduced osg::State::applyModelViewMaitrx(const osg::Matrix& matrix) method and associated osg::State::_modelViewCache to enable osgText::Text3D to be refactored in away that avoids creating/destroying matrices
This commit is contained in:
@@ -45,6 +45,7 @@ State::State():
|
||||
_initialViewMatrix = _identity;
|
||||
_projection = _identity;
|
||||
_modelView = _identity;
|
||||
_modelViewCache = new osg::RefMatrix;
|
||||
|
||||
#if !defined(OSG_GL_FIXED_FUNCTION_AVAILABLE)
|
||||
_useModelViewAndProjectionUniforms = true;
|
||||
@@ -1296,6 +1297,19 @@ void State::applyProjectionMatrix(const osg::RefMatrix* matrix)
|
||||
}
|
||||
}
|
||||
|
||||
void State::loadModelViewMatrix()
|
||||
{
|
||||
if (_useModelViewAndProjectionUniforms)
|
||||
{
|
||||
if (_modelViewMatrixUniform.valid()) _modelViewMatrixUniform->set(*_modelView);
|
||||
updateModelViewAndProjectionMatrixUniforms();
|
||||
}
|
||||
|
||||
#ifdef OSG_GL_MATRICES_AVAILABLE
|
||||
glLoadMatrix(_modelView->ptr());
|
||||
#endif
|
||||
}
|
||||
|
||||
void State::applyModelViewMatrix(const osg::RefMatrix* matrix)
|
||||
{
|
||||
if (_modelView!=matrix)
|
||||
@@ -1309,18 +1323,18 @@ void State::applyModelViewMatrix(const osg::RefMatrix* matrix)
|
||||
_modelView=_identity;
|
||||
}
|
||||
|
||||
if (_useModelViewAndProjectionUniforms)
|
||||
{
|
||||
if (_modelViewMatrixUniform.valid()) _modelViewMatrixUniform->set(*_modelView);
|
||||
updateModelViewAndProjectionMatrixUniforms();
|
||||
}
|
||||
|
||||
#ifdef OSG_GL_MATRICES_AVAILABLE
|
||||
glLoadMatrix(_modelView->ptr());
|
||||
#endif
|
||||
loadModelViewMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
void State::applyModelViewMatrix(const osg::Matrix& matrix)
|
||||
{
|
||||
_modelViewCache->set(matrix);
|
||||
_modelView = _modelViewCache;
|
||||
|
||||
loadModelViewMatrix();
|
||||
}
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
void State::updateModelViewAndProjectionMatrixUniforms()
|
||||
|
||||
Reference in New Issue
Block a user