From 6199c0bbc5049b8450e6c1b583ca027c876ce4da Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 16 Jun 2015 23:50:19 +0200 Subject: [PATCH] Use osgDB::SharedStateManager for sharing of StateSets across NIF files --- components/resource/scenemanager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index bb4c57e4c..de4e2bd1c 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -8,6 +8,9 @@ #include +#include +#include + #include #include @@ -103,6 +106,9 @@ namespace Resource NifOsg::Loader loader; osg::ref_ptr loaded = loader.load(Nif::NIFFilePtr(new Nif::NIFFile(file, normalized)), mTextureManager); + osgDB::Registry::instance()->getOrCreateSharedStateManager()->share(loaded.get()); + // TODO: run SharedStateManager::prune on unload + if (mIncrementalCompileOperation) mIncrementalCompileOperation->add(loaded);