Skip to content

Commit

Permalink
Multiple fixes
Browse files Browse the repository at this point in the history
- 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 <dark_sylinc@yahoo.com.ar>
  • Loading branch information
darksylinc committed Jul 10, 2021
1 parent f2d70cd commit 5d396f6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
3 changes: 0 additions & 3 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 1 addition & 4 deletions include/ignition/rendering/Scene.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1032,10 +1032,7 @@ namespace ignition
/// \code
/// scene->PreRender();
/// for( auto& camera in cameras )
/// {
/// camera->PreRender();
/// camera->Render();
/// }
/// for( auto& camera in cameras )
/// camera->PostRender();
/// scene->PostRender();
Expand Down Expand Up @@ -1128,7 +1125,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).
Expand Down
2 changes: 1 addition & 1 deletion include/ignition/rendering/base/BaseScene.hh
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,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;
Expand Down
5 changes: 4 additions & 1 deletion ogre2/include/ignition/rendering/ogre2/Ogre2Scene.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
Expand Down
10 changes: 8 additions & 2 deletions ogre2/src/Ogre2Scene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,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

Expand Down Expand Up @@ -346,6 +346,12 @@ void Ogre2Scene::SetCameraPassCountPerGpuFlush(uint8_t _numPass)
this->dataPtr->cameraPassCountPerGpuFlush = _numPass;
}

//////////////////////////////////////////////////
uint8_t Ogre2Scene::CameraPassCountPerGpuFlush() const
{
return this->dataPtr->cameraPassCountPerGpuFlush;
}

//////////////////////////////////////////////////
bool Ogre2Scene::LegacyAutoGpuFlush() const
{
Expand Down
2 changes: 1 addition & 1 deletion src/base/BaseScene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ void BaseScene::SetCameraPassCountPerGpuFlush(uint8_t /*_numPass*/)
}

//////////////////////////////////////////////////
uint8_t BaseScene::GetCameraPassCountPerGpuFlush() const
uint8_t BaseScene::CameraPassCountPerGpuFlush() const
{
return 0u;
}
Expand Down

0 comments on commit 5d396f6

Please sign in to comment.