1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 03:15:32 +00:00

Share state

This commit is contained in:
CedricMocquillon 2021-05-18 14:03:16 +02:00
parent 373f8636b7
commit d11a6bd92c
3 changed files with 8 additions and 1 deletions

View file

@ -651,6 +651,7 @@ namespace MWRender
}
optimizer.setIsOperationPermissibleForObjectCallback(new CanOptimizeCallback);
unsigned int options = SceneUtil::Optimizer::FLATTEN_STATIC_TRANSFORMS|SceneUtil::Optimizer::REMOVE_REDUNDANT_NODES|SceneUtil::Optimizer::MERGE_GEOMETRY;
mSceneManager->shareState(mergeGroup);
optimizer.optimize(mergeGroup, options);
group->addChild(mergeGroup);

View file

@ -514,6 +514,12 @@ namespace Resource
return options;
}
void SceneManager::shareState(osg::ref_ptr<osg::Node> node) {
mSharedStateMutex.lock();
mSharedStateManager->share(node.get());
mSharedStateMutex.unlock();
}
osg::ref_ptr<const osg::Node> SceneManager::getTemplate(const std::string &name, bool compile)
{
std::string normalized = name;

View file

@ -135,7 +135,7 @@ namespace Resource
osg::ref_ptr<osg::Node> createInstance(const std::string& name);
osg::ref_ptr<osg::Node> createInstance(const osg::Node* base);
void shareState(osg::ref_ptr<osg::Node> node);
/// Get an instance of the given scene template
/// @see getTemplate
/// @note Thread safe.