From 83758af87c90dd8938e0d44a01b96b951fc571ba Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 13 Aug 2024 22:15:33 +0000 Subject: [PATCH 1/2] Fix virtual overload warnings on noble Signed-off-by: Ian Chen --- include/gz/rendering/Camera.hh | 12 ------------ include/gz/rendering/GpuRays.hh | 4 ++++ include/gz/rendering/Object.hh | 12 ------------ include/gz/rendering/ParticleEmitter.hh | 10 ---------- include/gz/rendering/RenderPass.hh | 4 ++++ include/gz/rendering/RenderTarget.hh | 3 +++ include/gz/rendering/Visual.hh | 12 ------------ include/gz/rendering/base/BaseParticleEmitter.hh | 6 ++++-- include/gz/rendering/base/BaseRenderPass.hh | 2 +- include/gz/rendering/base/BaseRenderTarget.hh | 12 ------------ ogre/include/gz/rendering/ogre/OgreRenderTarget.hh | 2 +- ogre/src/OgreRenderTarget.cc | 2 +- .../gz/rendering/ogre2/Ogre2GaussianNoisePass.hh | 2 +- .../gz/rendering/ogre2/Ogre2ParticleEmitter.hh | 3 ++- ogre2/src/Ogre2DepthCamera.cc | 4 ++-- ogre2/src/Ogre2GaussianNoisePass.cc | 2 +- ogre2/src/Ogre2ParticleEmitter.cc | 3 ++- 17 files changed, 26 insertions(+), 69 deletions(-) diff --git a/include/gz/rendering/Camera.hh b/include/gz/rendering/Camera.hh index 6e4303509..b23b23970 100644 --- a/include/gz/rendering/Camera.hh +++ b/include/gz/rendering/Camera.hh @@ -28,14 +28,6 @@ #include "gz/rendering/Sensor.hh" #include "gz/rendering/Scene.hh" -// overloaded-virtuals warnings appeared on Ubuntu Noble -// GCC-13. it is not easy to fix them without breaking ABI -// ignore them to preserve current ABI. -#if defined(__GNUC__) || defined(__clang__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Woverloaded-virtual" -#endif - namespace gz { namespace rendering @@ -377,8 +369,4 @@ namespace gz } } -#if defined(__GNUC__) || defined(__clang__) -# pragma GCC diagnostic pop -#endif - #endif diff --git a/include/gz/rendering/GpuRays.hh b/include/gz/rendering/GpuRays.hh index b1d646d53..57421eaba 100644 --- a/include/gz/rendering/GpuRays.hh +++ b/include/gz/rendering/GpuRays.hh @@ -190,6 +190,10 @@ namespace gz /// \return The vertical resolution. /// \sa VerticalRayCount() public: virtual double VerticalResolution() const = 0; + + // Disallow use of Camera::Copy by making it private. + // Use the overloaded Copy(float *) function instead. + private: using Camera::Copy; }; } } diff --git a/include/gz/rendering/Object.hh b/include/gz/rendering/Object.hh index 573c7edf0..93606b421 100644 --- a/include/gz/rendering/Object.hh +++ b/include/gz/rendering/Object.hh @@ -22,14 +22,6 @@ #include "gz/rendering/RenderTypes.hh" #include "gz/rendering/Export.hh" -// overloaded-virtuals warnings appeared on Ubuntu Noble -// GCC-13. it is not easy to fix them without breaking ABI -// ignore them to preserve current ABI. -#if defined(__GNUC__) || defined(__clang__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Woverloaded-virtual" -#endif - namespace gz { namespace rendering @@ -78,8 +70,4 @@ namespace gz } } -#if defined(__GNUC__) || defined(__clang__) -# pragma GCC diagnostic pop -#endif - #endif diff --git a/include/gz/rendering/ParticleEmitter.hh b/include/gz/rendering/ParticleEmitter.hh index dd7c09a2d..c5115f53f 100644 --- a/include/gz/rendering/ParticleEmitter.hh +++ b/include/gz/rendering/ParticleEmitter.hh @@ -158,16 +158,6 @@ namespace gz /// \sa Lifetime public: virtual void SetLifetime(double _lifetime) = 0; - /// \brief Get the material which all particles in the emitter will use. - /// \return The material pointer. - /// \sa SetMaterial - public: virtual MaterialPtr Material() const = 0; - - /// \brief Sets the material which all particles in the emitter will use. - /// \param[in] _material The material pointer. - /// \sa Material - public: virtual void SetMaterial(const MaterialPtr &_material) = 0; - /// \brief Get the minimum velocity each particle is emitted (m/s). /// \return Minimum velocity. /// \sa MaxVelocity diff --git a/include/gz/rendering/RenderPass.hh b/include/gz/rendering/RenderPass.hh index 0d29b0f99..644d71f44 100644 --- a/include/gz/rendering/RenderPass.hh +++ b/include/gz/rendering/RenderPass.hh @@ -69,6 +69,10 @@ namespace gz /// \brief See SetWideAngleCameraAfterStitching() /// \return The current value set by SetWideAngleCameraAfterStitching public: virtual bool WideAngleCameraAfterStitching() const = 0; + + // Documentation inherited + // Use PreRender(const CameraPtr &) instead + private: using Object::PreRender; }; } } diff --git a/include/gz/rendering/RenderTarget.hh b/include/gz/rendering/RenderTarget.hh index c7b796e17..c140e085c 100644 --- a/include/gz/rendering/RenderTarget.hh +++ b/include/gz/rendering/RenderTarget.hh @@ -85,6 +85,9 @@ namespace gz /// \return Render target background color. public: virtual math::Color BackgroundColor() const = 0; + // Documentation inherited + public: using Object::PreRender; + /// \brief See Object::PreRender. This function will call /// Object::PreRender but with the added bonus that it has access /// to the camera that is about to render diff --git a/include/gz/rendering/Visual.hh b/include/gz/rendering/Visual.hh index 809855b9d..74adfcf32 100644 --- a/include/gz/rendering/Visual.hh +++ b/include/gz/rendering/Visual.hh @@ -22,14 +22,6 @@ #include "gz/rendering/config.hh" #include "gz/rendering/Node.hh" -// overloaded-virtuals warnings appeared on Ubuntu Noble -// GCC-13. it is not easy to fix them without breaking ABI -// ignore them to preserve current ABI. -#if defined(__GNUC__) || defined(__clang__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Woverloaded-virtual" -#endif - namespace gz { namespace rendering @@ -215,8 +207,4 @@ namespace gz } } -#if defined(__GNUC__) || defined(__clang__) -# pragma GCC diagnostic pop -#endif - #endif diff --git a/include/gz/rendering/base/BaseParticleEmitter.hh b/include/gz/rendering/base/BaseParticleEmitter.hh index 569d0b886..0e852f2bd 100644 --- a/include/gz/rendering/base/BaseParticleEmitter.hh +++ b/include/gz/rendering/base/BaseParticleEmitter.hh @@ -101,7 +101,8 @@ namespace gz public: virtual MaterialPtr Material() const override; // Documentation inherited. - public: virtual void SetMaterial(const MaterialPtr &_material) override; + public: virtual void SetMaterial(MaterialPtr _material, + bool _unique = true) override; // Documentation inherited. public: virtual double MinVelocity() const override; @@ -341,7 +342,8 @@ namespace gz ///////////////////////////////////////////////// template - void BaseParticleEmitter::SetMaterial(const MaterialPtr &_material) + void BaseParticleEmitter::SetMaterial(MaterialPtr _material, + bool /*_unique*/) { this->material = _material; } diff --git a/include/gz/rendering/base/BaseRenderPass.hh b/include/gz/rendering/base/BaseRenderPass.hh index 4cfb3f517..7704de2d2 100644 --- a/include/gz/rendering/base/BaseRenderPass.hh +++ b/include/gz/rendering/base/BaseRenderPass.hh @@ -48,7 +48,7 @@ namespace gz public: virtual bool IsEnabled() const override; // Documentation inherited - public: void PreRender(const CameraPtr &_camera) override; + public: virtual void PreRender(const CameraPtr &_camera) override; // Documentation inherited public: void SetWideAngleCameraAfterStitching(bool _afterStitching) diff --git a/include/gz/rendering/base/BaseRenderTarget.hh b/include/gz/rendering/base/BaseRenderTarget.hh index c1ef16a1c..07d082c9a 100644 --- a/include/gz/rendering/base/BaseRenderTarget.hh +++ b/include/gz/rendering/base/BaseRenderTarget.hh @@ -25,14 +25,6 @@ #include "gz/rendering/Scene.hh" #include "gz/rendering/base/BaseRenderTypes.hh" -// overloaded-virtuals warnings appeared on Ubuntu Noble -// GCC-13. it is not easy to fix them without breaking ABI -// ignore them to preserve current ABI. -#if defined(__GNUC__) || defined(__clang__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Woverloaded-virtual" -#endif - namespace gz { namespace rendering @@ -415,8 +407,4 @@ namespace gz } } -#if defined(__GNUC__) || defined(__clang__) -# pragma GCC diagnostic pop -#endif - #endif diff --git a/ogre/include/gz/rendering/ogre/OgreRenderTarget.hh b/ogre/include/gz/rendering/ogre/OgreRenderTarget.hh index 5ff7a1361..ee1d4dad1 100644 --- a/ogre/include/gz/rendering/ogre/OgreRenderTarget.hh +++ b/ogre/include/gz/rendering/ogre/OgreRenderTarget.hh @@ -144,7 +144,7 @@ namespace gz public: virtual void PostRender() override; // Documentation inherited. - public: virtual unsigned int GLId(); + public: virtual unsigned int GLId() const override; public: virtual void Buffer(float *buffer); diff --git a/ogre/src/OgreRenderTarget.cc b/ogre/src/OgreRenderTarget.cc index 9f7f67f09..f004e07e2 100644 --- a/ogre/src/OgreRenderTarget.cc +++ b/ogre/src/OgreRenderTarget.cc @@ -426,7 +426,7 @@ void OgreRenderTexture::BuildTarget() } ////////////////////////////////////////////////// -unsigned int OgreRenderTexture::GLId() +unsigned int OgreRenderTexture::GLId() const { if (!this->ogreTexture) return 0u; diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2GaussianNoisePass.hh b/ogre2/include/gz/rendering/ogre2/Ogre2GaussianNoisePass.hh index 55e66f2c9..595093aa5 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2GaussianNoisePass.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2GaussianNoisePass.hh @@ -46,7 +46,7 @@ namespace gz public: virtual ~Ogre2GaussianNoisePass(); // Documentation inherited - public: void PreRender() override; + public: virtual void PreRender(const CameraPtr &_camera) override; // Documentation inherited public: void CreateRenderPass() override; diff --git a/ogre2/include/gz/rendering/ogre2/Ogre2ParticleEmitter.hh b/ogre2/include/gz/rendering/ogre2/Ogre2ParticleEmitter.hh index 5498ac0af..7ff5d0068 100644 --- a/ogre2/include/gz/rendering/ogre2/Ogre2ParticleEmitter.hh +++ b/ogre2/include/gz/rendering/ogre2/Ogre2ParticleEmitter.hh @@ -68,7 +68,8 @@ namespace gz public: virtual void SetLifetime(double _lifetime) override; // Documentation inherited. - public: virtual void SetMaterial(const MaterialPtr &_material) override; + public: virtual void SetMaterial(MaterialPtr _material, + bool _unique = true) override; // Documentation inherited. public: virtual void SetVelocityRange(double _minVelocity, diff --git a/ogre2/src/Ogre2DepthCamera.cc b/ogre2/src/Ogre2DepthCamera.cc index f9d8d329b..84b81853e 100644 --- a/ogre2/src/Ogre2DepthCamera.cc +++ b/ogre2/src/Ogre2DepthCamera.cc @@ -76,7 +76,7 @@ class Ogre2DepthGaussianNoisePass : public Ogre2GaussianNoisePass public: virtual ~Ogre2DepthGaussianNoisePass() {} // Documentation inherited. - public: void PreRender() override; + public: virtual void PreRender(const CameraPtr &_camera) override; // Documentation inherited. public: void CreateRenderPass() override; @@ -180,7 +180,7 @@ using namespace gz; using namespace rendering; ////////////////////////////////////////////////// -void Ogre2DepthGaussianNoisePass::PreRender() +void Ogre2DepthGaussianNoisePass::PreRender(const CameraPtr &/*_camera*/) { // This function is similar to Ogre2GaussianNoisePass but duplicated here // for Ogre2DepthCamera diff --git a/ogre2/src/Ogre2GaussianNoisePass.cc b/ogre2/src/Ogre2GaussianNoisePass.cc index 928123a7b..86680e96b 100644 --- a/ogre2/src/Ogre2GaussianNoisePass.cc +++ b/ogre2/src/Ogre2GaussianNoisePass.cc @@ -60,7 +60,7 @@ Ogre2GaussianNoisePass::~Ogre2GaussianNoisePass() } ////////////////////////////////////////////////// -void Ogre2GaussianNoisePass::PreRender() +void Ogre2GaussianNoisePass::PreRender(const CameraPtr &/*_camera*/) { if (!this->dataPtr->gaussianNoiseMat) return; diff --git a/ogre2/src/Ogre2ParticleEmitter.cc b/ogre2/src/Ogre2ParticleEmitter.cc index 1a0fc7b2f..e034b7635 100644 --- a/ogre2/src/Ogre2ParticleEmitter.cc +++ b/ogre2/src/Ogre2ParticleEmitter.cc @@ -260,7 +260,8 @@ void Ogre2ParticleEmitter::SetLifetime(double _lifetime) } ////////////////////////////////////////////////// -void Ogre2ParticleEmitter::SetMaterial(const MaterialPtr &_material) +void Ogre2ParticleEmitter::SetMaterial(MaterialPtr _material, + bool /*_unique*/) { // Sanity check: The material cannot be nullptr. if (!_material) From 177920aa80c250689cd5ccd3e8c2b5fa2dadc800 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 13 Aug 2024 22:34:24 +0000 Subject: [PATCH 2/2] update migration guide Signed-off-by: Ian Chen --- Migration.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Migration.md b/Migration.md index e85451af1..11c187501 100644 --- a/Migration.md +++ b/Migration.md @@ -19,6 +19,14 @@ release will remove the deprecated code. + Removed: `Ogre::OgreItem *OnSelectionClick(const int _x, const int _y)` + Replacement: `Ogre::MovableObject *OnSelectionClick(int _x, int _y)` +1. **GpuRays** + + Made function private: `void Copy(Image &_image)` + + Use the overloaded function: `void Copy(float *_data)` + +1. **RenderPass** + + Made function private: `void PreRender()` + + Use the overloaded function: `void PreRender(const CameraPtr &_camera)` + ## Gazebo Rendering 7.x to 8.x ### Deprecations