Use move semantics for osg::ref_ptr

ini_importer_tests
Andrei Kortunov 11 months ago
parent a41259cca8
commit 251d01304f

@ -440,7 +440,7 @@ CSVRender::WorldspaceHitResult CSVRender::WorldspaceWidget::mousePick(
osg::Node* node = *nodeIter;
if (osg::ref_ptr<CSVRender::TagBase> tag = dynamic_cast<CSVRender::TagBase*>(node->getUserData()))
{
WorldspaceHitResult hit = { true, tag, 0, 0, 0, intersection.getWorldIntersectPoint() };
WorldspaceHitResult hit = { true, std::move(tag), 0, 0, 0, intersection.getWorldIntersectPoint() };
if (intersection.indexList.size() >= 3)
{
hit.index0 = intersection.indexList[0];

@ -823,7 +823,7 @@ void OMW::Engine::prepareEngine()
}
listener->loadingOff();
mWorld->init(mViewer, rootNode, mWorkQueue.get(), *mUnrefQueue);
mWorld->init(mViewer, std::move(rootNode), mWorkQueue.get(), *mUnrefQueue);
mEnvironment.setWorldScene(mWorld->getWorldScene());
mWorld->setupPlayer();
mWorld->setRandomSeed(mRandomSeed);

@ -101,7 +101,7 @@ namespace MWRender
templateNode, mObjectRoot, bonefilter, found->second, mResourceSystem->getSceneManager(), &rotation);
}
return SceneUtil::attach(
templateNode, mObjectRoot, bonefilter, found->second, mResourceSystem->getSceneManager());
std::move(templateNode), mObjectRoot, bonefilter, found->second, mResourceSystem->getSceneManager());
}
std::string ActorAnimation::getShieldMesh(const MWWorld::ConstPtr& shield, bool female) const

@ -422,7 +422,8 @@ namespace MWRender
if (cellX > mMaxX || cellX < mMinX || cellY > mMaxY || cellY < mMinY)
return;
requestOverlayTextureUpdate(originX, mHeight - originY, cellSize, cellSize, localMapTexture, false, true);
requestOverlayTextureUpdate(
originX, mHeight - originY, cellSize, cellSize, std::move(localMapTexture), false, true);
}
void GlobalMap::clear()
@ -554,7 +555,7 @@ namespace MWRender
{
mOverlayImage = image;
requestOverlayTextureUpdate(0, 0, mWidth, mHeight, texture, true, false);
requestOverlayTextureUpdate(0, 0, mWidth, mHeight, std::move(texture), true, false);
}
else
{
@ -562,7 +563,7 @@ namespace MWRender
// In the latter case, we'll want filtering.
// Create a RTT Camera and draw the image onto mOverlayImage in the next frame.
requestOverlayTextureUpdate(destBox.mLeft, destBox.mTop, destBox.mRight - destBox.mLeft,
destBox.mBottom - destBox.mTop, texture, true, true, srcBox.mLeft / float(imageWidth),
destBox.mBottom - destBox.mTop, std::move(texture), true, true, srcBox.mLeft / float(imageWidth),
srcBox.mTop / float(imageHeight), srcBox.mRight / float(imageWidth),
srcBox.mBottom / float(imageHeight));
}

@ -19,7 +19,7 @@ namespace MWRender
auto resolveFragment = shaderManager.getShader("luminance/resolve.frag", defines);
mResolveProgram = shaderManager.getProgram(vertex, std::move(resolveFragment));
mLuminanceProgram = shaderManager.getProgram(vertex, std::move(luminanceFragment));
mLuminanceProgram = shaderManager.getProgram(std::move(vertex), std::move(luminanceFragment));
for (auto& buffer : mBuffers)
{

@ -68,7 +68,7 @@ namespace MWRender
ptr.getClass().adjustScale(ptr, scaleVec, true);
insert->setScale(scaleVec);
ptr.getRefData().setBaseNode(insert);
ptr.getRefData().setBaseNode(std::move(insert));
}
void Objects::insertModel(const MWWorld::Ptr& ptr, const std::string& mesh, bool allowLight)

@ -106,7 +106,7 @@ namespace MWRender
mProgramBlobber = shaderManager.getProgram(
vertex, shaderManager.getShader("ripples_blobber.frag", defineMap, osg::Shader::FRAGMENT));
mProgramSimulation = shaderManager.getProgram(
vertex, shaderManager.getShader("ripples_simulate.frag", defineMap, osg::Shader::FRAGMENT));
std::move(vertex), shaderManager.getShader("ripples_simulate.frag", defineMap, osg::Shader::FRAGMENT));
}
void RipplesSurface::setupComputePipeline()

@ -764,7 +764,7 @@ namespace MWRender
cloudTex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
cloudTex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
mCloudUpdater->setTexture(cloudTex);
mCloudUpdater->setTexture(std::move(cloudTex));
}
if (mStormDirection != weather.mStormDirection)
@ -786,7 +786,7 @@ namespace MWRender
cloudTex->setWrap(osg::Texture::WRAP_S, osg::Texture::REPEAT);
cloudTex->setWrap(osg::Texture::WRAP_T, osg::Texture::REPEAT);
mNextCloudUpdater->setTexture(cloudTex);
mNextCloudUpdater->setTexture(std::move(cloudTex));
mNextStormDirection = weather.mStormDirection;
}
}

@ -722,8 +722,8 @@ namespace MWRender
mRainSettingsUpdater = new RainSettingsUpdater();
node->setUpdateCallback(mRainSettingsUpdater);
mShaderWaterStateSetUpdater
= new ShaderWaterStateSetUpdater(this, mReflection, mRefraction, mRipples, std::move(program), normalMap);
mShaderWaterStateSetUpdater = new ShaderWaterStateSetUpdater(
this, mReflection, mRefraction, mRipples, std::move(program), std::move(normalMap));
node->addCullCallback(mShaderWaterStateSetUpdater);
}

@ -1660,7 +1660,7 @@ namespace NifOsg
&& bsTriShape->mVertDesc.mFlags & Nif::BSVertexDesc::VertexAttribute::Skinned)
{
osg::ref_ptr<SceneUtil::RigGeometry> rig(new SceneUtil::RigGeometry);
rig->setSourceGeometry(geometry);
rig->setSourceGeometry(std::move(geometry));
const Nif::BSSkinInstance* skin = static_cast<const Nif::BSSkinInstance*>(bsTriShape->mSkin.getPtr());
const Nif::BSSkinBoneData* data = skin->mData.getPtr();

@ -123,7 +123,7 @@ namespace Resource
mergedAnimationTrack->addChannel(channel.get()->clone());
}
callback->addMergedAnimationTrack(mergedAnimationTrack);
callback->addMergedAnimationTrack(std::move(mergedAnimationTrack));
float startTime = animation->getStartTime();
float stopTime = startTime + animation->getDuration();
@ -239,7 +239,7 @@ namespace Resource
= dynamic_cast<osgAnimation::BasicAnimationManager*>(scene->getUpdateCallback());
if (bam)
{
Resource::RetrieveAnimationsVisitor rav(*loaded.get(), bam, normalized, mVFS);
Resource::RetrieveAnimationsVisitor rav(*loaded.get(), std::move(bam), normalized, mVFS);
scene->accept(rav);
}
}

@ -248,7 +248,7 @@ namespace SceneUtil
}
writableStateSet->setTextureAttributeAndModes(texUnit, textures.front(), osg::StateAttribute::ON);
writableStateSet->addUniform(new osg::Uniform("envMapColor", glowColor));
resourceSystem->getSceneManager()->recreateShaders(node);
resourceSystem->getSceneManager()->recreateShaders(std::move(node));
return glowUpdater;
}

@ -740,7 +740,7 @@ namespace Shader
auto program = mShaderManager.getProgram(shaderPrefix, defineMap, mProgramTemplate);
writableStateSet->setAttributeAndModes(program, osg::StateAttribute::ON);
addedState->setAttributeAndModes(program);
addedState->setAttributeAndModes(std::move(program));
for (const auto& [unit, name] : reqs.mTextures)
{
@ -934,13 +934,13 @@ namespace Shader
{
osg::ref_ptr<osg::Geometry> sourceGeometry = rig->getSourceGeometry();
if (sourceGeometry && adjustGeometry(*sourceGeometry, reqs))
rig->setSourceGeometry(sourceGeometry);
rig->setSourceGeometry(std::move(sourceGeometry));
}
else if (auto morph = dynamic_cast<SceneUtil::MorphGeometry*>(&drawable))
{
osg::ref_ptr<osg::Geometry> sourceGeometry = morph->getSourceGeometry();
if (sourceGeometry && adjustGeometry(*sourceGeometry, reqs))
morph->setSourceGeometry(sourceGeometry);
morph->setSourceGeometry(std::move(sourceGeometry));
}
else if (auto osgaRig = dynamic_cast<SceneUtil::RigGeometryHolder*>(&drawable))
{
@ -948,8 +948,8 @@ namespace Shader
osg::ref_ptr<osg::Geometry> sourceGeometry = sourceOsgaRigGeometry->getSourceGeometry();
if (sourceGeometry && adjustGeometry(*sourceGeometry, reqs))
{
sourceOsgaRigGeometry->setSourceGeometry(sourceGeometry);
osgaRig->setSourceRigGeometry(sourceOsgaRigGeometry);
sourceOsgaRigGeometry->setSourceGeometry(std::move(sourceGeometry));
osgaRig->setSourceRigGeometry(std::move(sourceOsgaRigGeometry));
}
}

Loading…
Cancel
Save