@ -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);
@ -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;
@ -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.