Move the applying of Projection and ModelView matrices into osg::State so that
it now maintains references to the last applied matrices, automatically doing lazy state updating. This simplifies the various places in the OSG which were previously doing the applying, add paves the way for managing the projection matrix within the scene graph. Remove MemoryAdapter and mem_ptr as they arn't being used, and can potentially confuse users by their existance.
This commit is contained in:
@@ -158,6 +158,9 @@ void SceneView::app()
|
||||
void SceneView::cull()
|
||||
{
|
||||
|
||||
_state->reset();
|
||||
|
||||
|
||||
if (_displaySettings.valid() && _displaySettings->getStereo())
|
||||
{
|
||||
|
||||
@@ -201,9 +204,23 @@ void SceneView::cullStage(osg::Camera* camera, osgUtil::CullVisitor* cullVisitor
|
||||
|
||||
if (!_initCalled) init();
|
||||
|
||||
if (!_state)
|
||||
{
|
||||
osg::notify(osg::WARN) << "Warning: no valid osgUtil::SceneView::_state"<< std::endl;
|
||||
osg::notify(osg::WARN) << " creating a state automatically."<< std::endl;
|
||||
|
||||
// note the constructor for osg::State will set ContextID to 0.
|
||||
_state = osgNew osg::State;
|
||||
}
|
||||
|
||||
// we in theory should be able to be able to bypass reset, but we'll call it just incase.
|
||||
_state->reset();
|
||||
|
||||
_state->setFrameStamp(_frameStamp.get());
|
||||
_state->setDisplaySettings(_displaySettings.get());
|
||||
|
||||
|
||||
camera->adjustAspectRatio(_viewport->aspectRatio());
|
||||
|
||||
|
||||
|
||||
cullVisitor->reset();
|
||||
|
||||
@@ -343,6 +360,7 @@ void SceneView::cullStage(osg::Camera* camera, osgUtil::CullVisitor* cullVisitor
|
||||
|
||||
void SceneView::draw()
|
||||
{
|
||||
|
||||
if (_displaySettings.valid() && _displaySettings->getStereo())
|
||||
{
|
||||
|
||||
@@ -442,19 +460,6 @@ void SceneView::drawStage(osgUtil::RenderStage* renderStage)
|
||||
{
|
||||
if (!_sceneData || !_viewport->valid()) return;
|
||||
|
||||
if (!_state)
|
||||
{
|
||||
osg::notify(osg::WARN) << "Warning: no valid osgUtil::SceneView::_state"<< std::endl;
|
||||
osg::notify(osg::WARN) << " creating a state automatically."<< std::endl;
|
||||
|
||||
// note the constructor for osg::State will set ContextID to 0.
|
||||
_state = osgNew osg::State;
|
||||
}
|
||||
// we in theory should be able to
|
||||
_state->reset();
|
||||
|
||||
_state->setFrameStamp(_frameStamp.get());
|
||||
_state->setDisplaySettings(_displaySettings.get());
|
||||
|
||||
// note, to support multi-pipe systems the deletion of OpenGL display list
|
||||
// and texture objects is deferred until the OpenGL context is the correct
|
||||
|
||||
Reference in New Issue
Block a user