From 56c74fb96fcf59a43919d8f303ffb222817d4857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Thu, 16 Nov 2017 12:46:46 +0100 Subject: [PATCH] add scene switch node --- apps/openmw/mwrender/renderingmanager.cpp | 11 ++++++++--- apps/openmw/mwrender/renderingmanager.hpp | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index c571d516f..bc16a5ea2 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -205,7 +205,9 @@ namespace MWRender mSceneRoot = sceneRoot; sceneRoot->setStartLight(1); - mRootNode->addChild(sceneRoot); + mSceneSwitch = new osg::Switch; + mSceneSwitch->addChild(sceneRoot); + mRootNode->addChild(mSceneSwitch); mPathgrid.reset(new Pathgrid(mRootNode)); @@ -814,13 +816,16 @@ namespace MWRender // at the time this function is called we are in the middle of a frame, // so out of order calls are necessary to get a correct frameNumber for the next frame. // refer to the advance() and frame() order in Engine::go() - + + mSceneSwitch->setAllChildrenOff(); // don't render the scene for main camera + mViewer->eventTraversal(); mViewer->updateTraversal(); mViewer->renderingTraversals(); - callback->waitTillDone(); + mSceneSwitch->setAllChildrenOn(); + mViewer->getCamera()->setClearMask(maskBackup); mViewer->getCamera()->setClearDepth(clearDepthBackup); diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 8fd96cff9..4a271228e 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -224,6 +224,7 @@ namespace MWRender osg::ref_ptr mViewer; osg::ref_ptr mRootNode; osg::ref_ptr mSceneRoot; + osg::ref_ptr mSceneSwitch; Resource::ResourceSystem* mResourceSystem; osg::ref_ptr mWorkQueue;