1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 18:29:55 +00:00

resets state updater to apply light settings (#3141)

resets state updater to apply light settings

With this PR we achieve the same effect with fewer lines of code.
This commit is contained in:
Bo Svensson 2021-10-06 09:15:47 +00:00 committed by Bret Curtis
parent c3f5e8f968
commit 787f91211d
2 changed files with 2 additions and 7 deletions

View file

@ -1281,11 +1281,7 @@ namespace MWRender
defines[name] = key; defines[name] = key;
mResourceSystem->getSceneManager()->getShaderManager().setGlobalDefines(defines); mResourceSystem->getSceneManager()->getShaderManager().setGlobalDefines(defines);
mSceneRoot->removeUpdateCallback(mStateUpdater); mStateUpdater->reset();
mStateUpdater = new StateUpdater;
mSceneRoot->addUpdateCallback(mStateUpdater);
mStateUpdater->setFogEnd(mViewDistance);
updateAmbient();
mViewer->startThreading(); mViewer->startThreading();
} }

View file

@ -46,8 +46,7 @@ namespace SceneUtil
/// Set default state - optionally override in derived classes /// Set default state - optionally override in derived classes
/// @par May be used e.g. to allocate StateAttributes. /// @par May be used e.g. to allocate StateAttributes.
virtual void setDefaults(osg::StateSet* stateset) {} virtual void setDefaults(osg::StateSet* stateset) {}
protected:
/// Reset mStateSets, forcing a setDefaults() on the next frame. Can be used to change the defaults if needed. /// Reset mStateSets, forcing a setDefaults() on the next frame. Can be used to change the defaults if needed.
void reset(); void reset();