From 4421164c795fc598f783133f22436af670bb3ba4 Mon Sep 17 00:00:00 2001 From: "Matias N. Goldberg" Date: Sat, 10 Jul 2021 19:49:42 -0300 Subject: [PATCH] Multiple fixes - Do not recommend the user to call Camera::PreRender in docs. This is done implicitly via Scene::PreRender - Rename GetCameraPassCountPerGpuFlush -> CameraPassCountPerGpuFlush - CameraPassCountPerGpuFlush was incorrectly always returning 0 - Grammar mistakes in comments Signed-off-by: Matias N. Goldberg --- Migration.md | 3 --- include/ignition/rendering/Scene.hh | 5 +---- include/ignition/rendering/base/BaseScene.hh | 2 +- ogre2/include/ignition/rendering/ogre2/Ogre2Scene.hh | 5 ++++- ogre2/src/Ogre2Scene.cc | 10 ++++++++-- src/base/BaseScene.cc | 2 +- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Migration.md b/Migration.md index 134cf5f8e..1bfc9213b 100644 --- a/Migration.md +++ b/Migration.md @@ -21,10 +21,7 @@ release will remove the deprecated code. ``` scene->PreRender(); for( auto& camera in cameras ) - { - camera->PreRender(); camera->Render(); - } for( auto& camera in cameras ) camera->PostRender(); scene->PostRender(); diff --git a/include/ignition/rendering/Scene.hh b/include/ignition/rendering/Scene.hh index 3351b9965..29d3cb6c8 100644 --- a/include/ignition/rendering/Scene.hh +++ b/include/ignition/rendering/Scene.hh @@ -1090,10 +1090,7 @@ namespace ignition /// \code /// scene->PreRender(); /// for( auto& camera in cameras ) - /// { - /// camera->PreRender(); /// camera->Render(); - /// } /// for( auto& camera in cameras ) /// camera->PostRender(); /// scene->PostRender(); @@ -1186,7 +1183,7 @@ namespace ignition /// \return Value in range [0; 255]. /// ALWAYS returns 0 for plugins that ignore /// SetCameraPassCountPerGpuFlush - public: virtual uint8_t GetCameraPassCountPerGpuFlush() const = 0; + public: virtual uint8_t CameraPassCountPerGpuFlush() const = 0; /// \brief Checks if SetCameraPassCountPerGpuFlush is 0 /// \return True if Gazebo is using the old method (i.e. 0). diff --git a/include/ignition/rendering/base/BaseScene.hh b/include/ignition/rendering/base/BaseScene.hh index 4723439e0..56ad9569e 100644 --- a/include/ignition/rendering/base/BaseScene.hh +++ b/include/ignition/rendering/base/BaseScene.hh @@ -530,7 +530,7 @@ namespace ignition uint8_t _numPass) override; // Documentation inherited. - public: virtual uint8_t GetCameraPassCountPerGpuFlush() const override; + public: virtual uint8_t CameraPassCountPerGpuFlush() const override; // Documentation inherited. public: virtual bool LegacyAutoGpuFlush() const override; diff --git a/ogre2/include/ignition/rendering/ogre2/Ogre2Scene.hh b/ogre2/include/ignition/rendering/ogre2/Ogre2Scene.hh index fa7ec7a93..cb438fff4 100644 --- a/ogre2/include/ignition/rendering/ogre2/Ogre2Scene.hh +++ b/ogre2/include/ignition/rendering/ogre2/Ogre2Scene.hh @@ -98,6 +98,9 @@ namespace ignition public: virtual void SetCameraPassCountPerGpuFlush( uint8_t _numPass) override; + // Documentation inherited. + public: virtual uint8_t CameraPassCountPerGpuFlush() const override; + // Documentation inherited. public: virtual bool LegacyAutoGpuFlush() const override; @@ -111,7 +114,7 @@ namespace ignition /// \cond PRIVATE /// \brief Certain functions like Ogre2Camera::VisualAt would /// need to call PreRender and PostFrame, which is very unintuitive - /// and use hostile. + /// and user-hostile. /// /// More over, it's likely that we don't want to advance the frame /// in those cases (e.g. particle FXs should not advance), but we diff --git a/ogre2/src/Ogre2Scene.cc b/ogre2/src/Ogre2Scene.cc index 6f01cc990..9db31e989 100644 --- a/ogre2/src/Ogre2Scene.cc +++ b/ogre2/src/Ogre2Scene.cc @@ -319,11 +319,11 @@ void Ogre2Scene::FlushGpuCommandsOnly() #if OGRE_VERSION_MAJOR == 2 && OGRE_VERSION_MINOR == 1 auto hlmsManager = ogreRoot->getHlmsManager(); - // Updating the compositor with all workspaces disables achieves our goal + // Updating the compositor with all workspaces disabled achieves our goal ogreCompMgr->_update(Ogre::SceneManagerEnumerator::getSingleton(), hlmsManager); #else - // Updating the compositor with all workspaces disables achieves our goal + // Updating the compositor with all workspaces disabled achieves our goal ogreCompMgr->_update(); #endif @@ -354,6 +354,12 @@ void Ogre2Scene::SetCameraPassCountPerGpuFlush(uint8_t _numPass) this->dataPtr->cameraPassCountPerGpuFlush = _numPass; } +////////////////////////////////////////////////// +uint8_t Ogre2Scene::CameraPassCountPerGpuFlush() const +{ + return this->dataPtr->cameraPassCountPerGpuFlush; +} + ////////////////////////////////////////////////// bool Ogre2Scene::LegacyAutoGpuFlush() const { diff --git a/src/base/BaseScene.cc b/src/base/BaseScene.cc index 247ae3a83..c24d0ed8c 100644 --- a/src/base/BaseScene.cc +++ b/src/base/BaseScene.cc @@ -1307,7 +1307,7 @@ void BaseScene::SetCameraPassCountPerGpuFlush(uint8_t /*_numPass*/) } ////////////////////////////////////////////////// -uint8_t BaseScene::GetCameraPassCountPerGpuFlush() const +uint8_t BaseScene::CameraPassCountPerGpuFlush() const { return 0u; }