Do not copy osg::ref_ptr when possible

macos_ci_fix
Andrei Kortunov 1 year ago
parent d3d7a663c6
commit 35561450f1

@ -24,7 +24,7 @@
#include "mask.hpp" #include "mask.hpp"
CSVRender::BrushDraw::BrushDraw(osg::ref_ptr<osg::Group> parentNode, bool textureMode) CSVRender::BrushDraw::BrushDraw(osg::ref_ptr<osg::Group> parentNode, bool textureMode)
: mParentNode(parentNode) : mParentNode(std::move(parentNode))
, mTextureMode(textureMode) , mTextureMode(textureMode)
{ {
mBrushDrawNode = new osg::Group(); mBrushDrawNode = new osg::Group();

@ -197,7 +197,7 @@ CSVRender::InstanceMode::InstanceMode(
, mDragAxis(-1) , mDragAxis(-1)
, mLocked(false) , mLocked(false)
, mUnitScaleDist(1) , mUnitScaleDist(1)
, mParentNode(parentNode) , mParentNode(std::move(parentNode))
{ {
connect(this, &InstanceMode::requestFocus, worldspaceWidget, &WorldspaceWidget::requestFocus); connect(this, &InstanceMode::requestFocus, worldspaceWidget, &WorldspaceWidget::requestFocus);

@ -284,7 +284,7 @@ namespace CSVRender
osg::ref_ptr<osg::Geometry> gradientQuad = createGradientRectangle(bgColour, gradientColour); osg::ref_ptr<osg::Geometry> gradientQuad = createGradientRectangle(bgColour, gradientColour);
camera->addChild(gradientQuad); camera->addChild(std::move(gradientQuad));
return camera; return camera;
} }

@ -31,8 +31,8 @@ namespace MWInput
osgViewer::ScreenCaptureHandler::CaptureOperation* screenCaptureOperation, osgViewer::ScreenCaptureHandler::CaptureOperation* screenCaptureOperation,
osg::ref_ptr<osgViewer::Viewer> viewer, osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler) osg::ref_ptr<osgViewer::Viewer> viewer, osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler)
: mBindingsManager(bindingsManager) : mBindingsManager(bindingsManager)
, mViewer(viewer) , mViewer(std::move(viewer))
, mScreenCaptureHandler(screenCaptureHandler) , mScreenCaptureHandler(std::move(screenCaptureHandler))
, mScreenCaptureOperation(screenCaptureOperation) , mScreenCaptureOperation(screenCaptureOperation)
, mTimeIdle(0.f) , mTimeIdle(0.f)
{ {

@ -102,7 +102,7 @@ namespace MWPhysics
, mProjectileId(0) , mProjectileId(0)
, mWaterHeight(0) , mWaterHeight(0)
, mWaterEnabled(false) , mWaterEnabled(false)
, mParentNode(parentNode) , mParentNode(std::move(parentNode))
, mPhysicsDt(1.f / 60.f) , mPhysicsDt(1.f / 60.f)
{ {
mResourceSystem->addResourceManager(mShapeManager.get()); mResourceSystem->addResourceManager(mShapeManager.get());

@ -42,7 +42,7 @@ namespace MWRender
ActorAnimation::ActorAnimation( ActorAnimation::ActorAnimation(
const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem) const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem)
: Animation(ptr, parentNode, resourceSystem) : Animation(ptr, std::move(parentNode), resourceSystem)
{ {
MWWorld::ContainerStore& store = mPtr.getClass().getContainerStore(mPtr); MWWorld::ContainerStore& store = mPtr.getClass().getContainerStore(mPtr);
@ -474,7 +474,7 @@ namespace MWRender
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup(); osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
osg::ref_ptr<osg::Node> arrow = mResourceSystem->getSceneManager()->getInstance(model, arrowNode); osg::ref_ptr<osg::Node> arrow = mResourceSystem->getSceneManager()->getInstance(model, arrowNode);
if (!ammo->getClass().getEnchantment(*ammo).empty()) if (!ammo->getClass().getEnchantment(*ammo).empty())
mGlowUpdater = SceneUtil::addEnchantedGlow(arrow, mResourceSystem, glowColor); mGlowUpdater = SceneUtil::addEnchantedGlow(std::move(arrow), mResourceSystem, glowColor);
} }
} }

@ -515,7 +515,7 @@ namespace MWRender
Animation::Animation( Animation::Animation(
const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem) const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem)
: mInsert(parentNode) : mInsert(std::move(parentNode))
, mSkeleton(nullptr) , mSkeleton(nullptr)
, mNodeMapCreated(false) , mNodeMapCreated(false)
, mPtr(ptr) , mPtr(ptr)
@ -1912,7 +1912,7 @@ namespace MWRender
// ------------------------------ // ------------------------------
PartHolder::PartHolder(osg::ref_ptr<osg::Node> node) PartHolder::PartHolder(osg::ref_ptr<osg::Node> node)
: mNode(node) : mNode(std::move(node))
{ {
} }

@ -26,7 +26,7 @@ namespace MWRender
{ {
DebugDrawer::DebugDrawer(osg::ref_ptr<osg::Group> parentNode, btCollisionWorld* world, int debugMode) DebugDrawer::DebugDrawer(osg::ref_ptr<osg::Group> parentNode, btCollisionWorld* world, int debugMode)
: mParentNode(parentNode) : mParentNode(std::move(parentNode))
, mWorld(world) , mWorld(world)
{ {
DebugDrawer::setDebugMode(debugMode); DebugDrawer::setDebugMode(debugMode);

@ -554,7 +554,7 @@ namespace MWRender
public: public:
UpdateCameraCallback( UpdateCameraCallback(
osg::ref_ptr<const osg::Node> nodeToFollow, const osg::Vec3& posOffset, const osg::Vec3& lookAtOffset) osg::ref_ptr<const osg::Node> nodeToFollow, const osg::Vec3& posOffset, const osg::Vec3& lookAtOffset)
: mNodeToFollow(nodeToFollow) : mNodeToFollow(std::move(nodeToFollow))
, mPosOffset(posOffset) , mPosOffset(posOffset)
, mLookAtOffset(lookAtOffset) , mLookAtOffset(lookAtOffset)
{ {

@ -17,7 +17,7 @@ namespace MWRender
{ {
EffectManager::EffectManager(osg::ref_ptr<osg::Group> parent, Resource::ResourceSystem* resourceSystem) EffectManager::EffectManager(osg::ref_ptr<osg::Group> parent, Resource::ResourceSystem* resourceSystem)
: mParentNode(parent) : mParentNode(std::move(parent))
, mResourceSystem(resourceSystem) , mResourceSystem(resourceSystem)
{ {
} }

@ -255,7 +255,7 @@ namespace MWRender
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> parentNode, NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> parentNode,
Resource::ResourceSystem* resourceSystem, bool disableSounds, ViewMode viewMode, float firstPersonFieldOfView) Resource::ResourceSystem* resourceSystem, bool disableSounds, ViewMode viewMode, float firstPersonFieldOfView)
: ActorAnimation(ptr, parentNode, resourceSystem) : ActorAnimation(ptr, std::move(parentNode), resourceSystem)
, mViewMode(viewMode) , mViewMode(viewMode)
, mShowWeapons(false) , mShowWeapons(false)
, mShowCarriedLeft(true) , mShowCarriedLeft(true)

@ -26,7 +26,7 @@ namespace MWRender
Pathgrid::Pathgrid(osg::ref_ptr<osg::Group> root) Pathgrid::Pathgrid(osg::ref_ptr<osg::Group> root)
: mPathgridEnabled(false) : mPathgridEnabled(false)
, mRootNode(root) , mRootNode(std::move(root))
, mPathGridRoot(nullptr) , mPathGridRoot(nullptr)
, mInteriorPathgridNode(nullptr) , mInteriorPathgridNode(nullptr)
{ {

@ -20,7 +20,7 @@ namespace
{ {
public: public:
PrecipitationOcclusionUpdater(osg::ref_ptr<osg::Texture2D> depthTexture) PrecipitationOcclusionUpdater(osg::ref_ptr<osg::Texture2D> depthTexture)
: mDepthTexture(depthTexture) : mDepthTexture(std::move(depthTexture))
{ {
} }

@ -133,8 +133,8 @@ namespace MWRender
ScreenshotManager::ScreenshotManager(osgViewer::Viewer* viewer, osg::ref_ptr<osg::Group> rootNode, ScreenshotManager::ScreenshotManager(osgViewer::Viewer* viewer, osg::ref_ptr<osg::Group> rootNode,
osg::ref_ptr<osg::Group> sceneRoot, Resource::ResourceSystem* resourceSystem, Water* water) osg::ref_ptr<osg::Group> sceneRoot, Resource::ResourceSystem* resourceSystem, Water* water)
: mViewer(viewer) : mViewer(viewer)
, mRootNode(rootNode) , mRootNode(std::move(rootNode))
, mSceneRoot(sceneRoot) , mSceneRoot(std::move(sceneRoot))
, mDrawCompleteCallback(new NotifyDrawCompletedCallback) , mDrawCompleteCallback(new NotifyDrawCompletedCallback)
, mResourceSystem(resourceSystem) , mResourceSystem(resourceSystem)
, mWater(water) , mWater(water)

@ -128,8 +128,8 @@ namespace MWRender
OcclusionCallback::OcclusionCallback( OcclusionCallback::OcclusionCallback(
osg::ref_ptr<osg::OcclusionQueryNode> oqnVisible, osg::ref_ptr<osg::OcclusionQueryNode> oqnTotal) osg::ref_ptr<osg::OcclusionQueryNode> oqnVisible, osg::ref_ptr<osg::OcclusionQueryNode> oqnTotal)
: mOcclusionQueryVisiblePixels(oqnVisible) : mOcclusionQueryVisiblePixels(std::move(oqnVisible))
, mOcclusionQueryTotalPixels(oqnTotal) , mOcclusionQueryTotalPixels(std::move(oqnTotal))
{ {
} }
@ -166,7 +166,7 @@ namespace MWRender
public: public:
SunFlashCallback( SunFlashCallback(
osg::ref_ptr<osg::OcclusionQueryNode> oqnVisible, osg::ref_ptr<osg::OcclusionQueryNode> oqnTotal) osg::ref_ptr<osg::OcclusionQueryNode> oqnVisible, osg::ref_ptr<osg::OcclusionQueryNode> oqnTotal)
: OcclusionCallback(oqnVisible, oqnTotal) : OcclusionCallback(std::move(oqnVisible), std::move(oqnTotal))
, mGlareView(1.f) , mGlareView(1.f)
{ {
} }
@ -238,8 +238,8 @@ namespace MWRender
public: public:
SunGlareCallback(osg::ref_ptr<osg::OcclusionQueryNode> oqnVisible, SunGlareCallback(osg::ref_ptr<osg::OcclusionQueryNode> oqnVisible,
osg::ref_ptr<osg::OcclusionQueryNode> oqnTotal, osg::ref_ptr<osg::PositionAttitudeTransform> sunTransform) osg::ref_ptr<osg::OcclusionQueryNode> oqnTotal, osg::ref_ptr<osg::PositionAttitudeTransform> sunTransform)
: OcclusionCallback(oqnVisible, oqnTotal) : OcclusionCallback(std::move(oqnVisible), std::move(oqnTotal))
, mSunTransform(sunTransform) , mSunTransform(std::move(sunTransform))
, mTimeOfDayFade(1.f) , mTimeOfDayFade(1.f)
, mGlareView(1.f) , mGlareView(1.f)
{ {

@ -28,7 +28,7 @@ namespace MWRender
if (node.getUserValue("overrideFx", index)) if (node.getUserValue("overrideFx", index))
{ {
if (index == 1) if (index == 1)
overrideTexture(mTexture, mResourcesystem, nodePtr); overrideTexture(mTexture, mResourcesystem, std::move(nodePtr));
} }
traverse(node); traverse(node);
} }

@ -625,8 +625,8 @@ namespace MWRender
, mReflection(reflection) , mReflection(reflection)
, mRefraction(refraction) , mRefraction(refraction)
, mRipples(ripples) , mRipples(ripples)
, mProgram(program) , mProgram(std::move(program))
, mNormalMap(normalMap) , mNormalMap(std::move(normalMap))
{ {
} }
@ -714,7 +714,7 @@ namespace MWRender
node->setUpdateCallback(mRainIntensityUpdater); node->setUpdateCallback(mRainIntensityUpdater);
mShaderWaterStateSetUpdater mShaderWaterStateSetUpdater
= new ShaderWaterStateSetUpdater(this, mReflection, mRefraction, mRipples, program, normalMap); = new ShaderWaterStateSetUpdater(this, mReflection, mRefraction, mRipples, std::move(program), normalMap);
node->addCullCallback(mShaderWaterStateSetUpdater); node->addCullCallback(mShaderWaterStateSetUpdater);
} }

@ -95,7 +95,7 @@ namespace MWWorld
{ {
PreloadEntry(double timestamp, osg::ref_ptr<SceneUtil::WorkItem> workItem) PreloadEntry(double timestamp, osg::ref_ptr<SceneUtil::WorkItem> workItem)
: mTimeStamp(timestamp) : mTimeStamp(timestamp)
, mWorkItem(workItem) , mWorkItem(std::move(workItem))
{ {
} }
PreloadEntry() PreloadEntry()

@ -254,7 +254,7 @@ namespace MWWorld
SceneUtil::AssignControllerSourcesVisitor assignVisitor(state.mEffectAnimationTime); SceneUtil::AssignControllerSourcesVisitor assignVisitor(state.mEffectAnimationTime);
state.mNode->accept(assignVisitor); state.mNode->accept(assignVisitor);
MWRender::overrideFirstRootTexture(texture, mResourceSystem, projectile); MWRender::overrideFirstRootTexture(texture, mResourceSystem, std::move(projectile));
} }
void ProjectileManager::update(State& state, float duration) void ProjectileManager::update(State& state, float duration)

@ -336,7 +336,7 @@ namespace Debug
} }
Debug::DebugDrawer::DebugDrawer(Shader::ShaderManager& shaderManager, osg::ref_ptr<osg::Group> parentNode) Debug::DebugDrawer::DebugDrawer(Shader::ShaderManager& shaderManager, osg::ref_ptr<osg::Group> parentNode)
: mParentNode(parentNode) : mParentNode(std::move(parentNode))
{ {
mCurrentFrame = 0; mCurrentFrame = 0;

@ -30,7 +30,7 @@ namespace Resource
const VFS::Manager* vfs) const VFS::Manager* vfs)
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
, mTarget(target) , mTarget(target)
, mAnimationManager(animationManager) , mAnimationManager(std::move(animationManager))
, mNormalized(normalized) , mNormalized(normalized)
, mVFS(vfs) , mVFS(vfs)
{ {

@ -22,7 +22,7 @@ namespace SceneUtil
public: public:
CopyRigVisitor(osg::ref_ptr<osg::Group> parent, std::string_view filter) CopyRigVisitor(osg::ref_ptr<osg::Group> parent, std::string_view filter)
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
, mParent(parent) , mParent(std::move(parent))
, mFilter(filter) , mFilter(filter)
{ {
} }

@ -69,7 +69,7 @@ namespace SceneUtil
} }
osg::ref_ptr<OsgaRigGeometry> rigGeometry = new OsgaRigGeometry(*copy.getSourceRigGeometry(), copyop); osg::ref_ptr<OsgaRigGeometry> rigGeometry = new OsgaRigGeometry(*copy.getSourceRigGeometry(), copyop);
setSourceRigGeometry(rigGeometry); setSourceRigGeometry(std::move(rigGeometry));
} }
RigGeometryHolder::RigGeometryHolder(const osgAnimation::RigGeometry& copy, const osg::CopyOp& copyop) RigGeometryHolder::RigGeometryHolder(const osgAnimation::RigGeometry& copy, const osg::CopyOp& copyop)
@ -80,7 +80,7 @@ namespace SceneUtil
setUseVertexBufferObjects(true); setUseVertexBufferObjects(true);
osg::ref_ptr<OsgaRigGeometry> rigGeometry = new OsgaRigGeometry(copy, copyop); osg::ref_ptr<OsgaRigGeometry> rigGeometry = new OsgaRigGeometry(copy, copyop);
setSourceRigGeometry(rigGeometry); setSourceRigGeometry(std::move(rigGeometry));
} }
void RigGeometryHolder::setSourceRigGeometry(osg::ref_ptr<OsgaRigGeometry> sourceRigGeometry) void RigGeometryHolder::setSourceRigGeometry(osg::ref_ptr<OsgaRigGeometry> sourceRigGeometry)

@ -10,7 +10,7 @@ namespace SDLUtil
InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> viewer, bool grab) InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> viewer, bool grab)
: mSDLWindow(window) : mSDLWindow(window)
, mViewer(viewer) , mViewer(std::move(viewer))
, mMouseListener(nullptr) , mMouseListener(nullptr)
, mSensorListener(nullptr) , mSensorListener(nullptr)
, mKeyboardListener(nullptr) , mKeyboardListener(nullptr)

@ -13,7 +13,7 @@ namespace SDLUtil
VideoWrapper::VideoWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> viewer) VideoWrapper::VideoWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> viewer)
: mWindow(window) : mWindow(window)
, mViewer(viewer) , mViewer(std::move(viewer))
, mGamma(1.f) , mGamma(1.f)
, mContrast(1.f) , mContrast(1.f)
, mHasSetGammaContrast(false) , mHasSetGammaContrast(false)

@ -83,7 +83,7 @@ CompositeOsgRenderer* osgQOpenGLWidget::getCompositeViewer()
void osgQOpenGLWidget::setGraphicsWindowEmbedded(osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> osgWinEmb) void osgQOpenGLWidget::setGraphicsWindowEmbedded(osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> osgWinEmb)
{ {
if (m_renderer) m_renderer->setGraphicsWindowEmbedded(osgWinEmb); if (m_renderer) m_renderer->setGraphicsWindowEmbedded(std::move(osgWinEmb));
} }
void osgQOpenGLWidget::createRenderer() void osgQOpenGLWidget::createRenderer()

Loading…
Cancel
Save