mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 07:19:54 +00:00
Change some osg::clone's to direct copy constructor to avoid dynamic_cast overhead
This commit is contained in:
parent
93c582064e
commit
67e4a7e37b
6 changed files with 7 additions and 7 deletions
|
@ -543,7 +543,7 @@ namespace MWRender
|
||||||
size_t blendMask = detectBlendMask(node);
|
size_t blendMask = detectBlendMask(node);
|
||||||
|
|
||||||
// clone the controller, because each Animation needs its own ControllerSource
|
// clone the controller, because each Animation needs its own ControllerSource
|
||||||
osg::ref_ptr<NifOsg::KeyframeController> cloned = osg::clone(it->second.get(), osg::CopyOp::DEEP_COPY_ALL);
|
osg::ref_ptr<NifOsg::KeyframeController> cloned = new NifOsg::KeyframeController(*it->second, osg::CopyOp::SHALLOW_COPY);
|
||||||
cloned->setSource(mAnimationTimePtr[blendMask]);
|
cloned->setSource(mAnimationTimePtr[blendMask]);
|
||||||
|
|
||||||
animsrc->mControllerMap[blendMask].insert(std::make_pair(bonename, cloned));
|
animsrc->mControllerMap[blendMask].insert(std::make_pair(bonename, cloned));
|
||||||
|
@ -1272,7 +1272,7 @@ namespace MWRender
|
||||||
writableStateSet = node->getOrCreateStateSet();
|
writableStateSet = node->getOrCreateStateSet();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writableStateSet = osg::clone(node->getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
writableStateSet = new osg::StateSet(*node->getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
||||||
node->setStateSet(writableStateSet);
|
node->setStateSet(writableStateSet);
|
||||||
}
|
}
|
||||||
writableStateSet->setTextureAttributeAndModes(texUnit, textures.front(), osg::StateAttribute::ON);
|
writableStateSet->setTextureAttributeAndModes(texUnit, textures.front(), osg::StateAttribute::ON);
|
||||||
|
|
|
@ -55,7 +55,7 @@ void overrideTexture(const std::string &texture, Resource::ResourceSystem *resou
|
||||||
|
|
||||||
osg::ref_ptr<osg::StateSet> stateset;
|
osg::ref_ptr<osg::StateSet> stateset;
|
||||||
if (node->getStateSet())
|
if (node->getStateSet())
|
||||||
stateset = osg::clone(node->getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
stateset = new osg::StateSet(*node->getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
||||||
else
|
else
|
||||||
stateset = new osg::StateSet;
|
stateset = new osg::StateSet;
|
||||||
|
|
||||||
|
|
|
@ -368,7 +368,7 @@ namespace SceneUtil
|
||||||
mId = sLightId++;
|
mId = sLightId++;
|
||||||
|
|
||||||
for (int i=0; i<2; ++i)
|
for (int i=0; i<2; ++i)
|
||||||
mLight[i] = osg::clone(copy.mLight[i].get(), copyop);
|
mLight[i] = new osg::Light(*copy.mLight[i].get(), copyop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace SceneUtil
|
||||||
void setLight(osg::Light* light)
|
void setLight(osg::Light* light)
|
||||||
{
|
{
|
||||||
mLight[0] = light;
|
mLight[0] = light;
|
||||||
mLight[1] = osg::clone(light);
|
mLight[1] = new osg::Light(*light);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the unique ID for this light source.
|
/// Get the unique ID for this light source.
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace SceneUtil
|
||||||
for (int i=0; i<2; ++i) // Using SHALLOW_COPY for StateAttributes, if users want to modify it is their responsibility to set a non-shared one first
|
for (int i=0; i<2; ++i) // Using SHALLOW_COPY for StateAttributes, if users want to modify it is their responsibility to set a non-shared one first
|
||||||
// This can be done conveniently in user implementations of the setDefaults() method
|
// This can be done conveniently in user implementations of the setDefaults() method
|
||||||
{
|
{
|
||||||
mStateSets[i] = osg::clone(src, osg::CopyOp::SHALLOW_COPY);
|
mStateSets[i] = new osg::StateSet(*src, osg::CopyOp::SHALLOW_COPY);
|
||||||
setDefaults(mStateSets[i]);
|
setDefaults(mStateSets[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace Shader
|
||||||
if (!node.getStateSet())
|
if (!node.getStateSet())
|
||||||
return node.getOrCreateStateSet();
|
return node.getOrCreateStateSet();
|
||||||
|
|
||||||
osg::ref_ptr<osg::StateSet> newStateSet = osg::clone(node.getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
osg::ref_ptr<osg::StateSet> newStateSet = new osg::StateSet(*node.getStateSet(), osg::CopyOp::SHALLOW_COPY);
|
||||||
node.setStateSet(newStateSet);
|
node.setStateSet(newStateSet);
|
||||||
return newStateSet.get();
|
return newStateSet.get();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue