Skip to content

Commit

Permalink
Fix camera display overlay (#1151)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Hernández Cordero <[email protected]>
  • Loading branch information
ahcorde authored Mar 1, 2024
1 parent 8e5f283 commit c7bf4c9
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rviz_common/src/rviz_common/render_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void RenderPanel::initialize(DisplayContext * context, bool use_main_scene)
camera_node->attachObject(default_camera);
camera_node->setPosition(default_camera_pose_);
camera_node->lookAt(Ogre::Vector3(0, 0, 0), Ogre::Node::TS_WORLD);

rviz_rendering::RenderWindowOgreAdapter::setSceneNodeCamera(render_window_, camera_node);
rviz_rendering::RenderWindowOgreAdapter::setOgreCamera(render_window_, default_camera);
}
// scene_manager_ = scene_manager;
Expand Down
4 changes: 4 additions & 0 deletions rviz_rendering/include/rviz_rendering/render_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ class RVIZ_RENDERING_PUBLIC RenderWindowOgreAdapter
void
setOgreCamera(RenderWindow * render_window, Ogre::Camera * ogre_camera);

static
void
setSceneNodeCamera(RenderWindow * render_window, Ogre::SceneNode * ogre_camera);

static
Ogre::Camera *
getOgreCamera(RenderWindow * render_window);
Expand Down
7 changes: 7 additions & 0 deletions rviz_rendering/src/rviz_rendering/ogre_render_window_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,13 @@ void RenderWindowImpl::setCamera(Ogre::Camera * ogre_camera)
}
}

void RenderWindowImpl::setSceneNodeCamera(Ogre::SceneNode * ogre_camera)
{
if (ogre_camera) {
ogre_camera_node_ = ogre_camera;
}
}

Ogre::Camera * RenderWindowImpl::getCamera() const
{
return ogre_camera_;
Expand Down
2 changes: 2 additions & 0 deletions rviz_rendering/src/rviz_rendering/ogre_render_window_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ class RenderWindowImpl
/// Set the camera associated with this render window's viewport.
void setCamera(Ogre::Camera * camera);

void setSceneNodeCamera(Ogre::SceneNode * ogre_camera);

/// Get the camera.
Ogre::Camera * getCamera() const;

Expand Down
8 changes: 8 additions & 0 deletions rviz_rendering/src/rviz_rendering/render_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ RenderWindowOgreAdapter::setOgreCamera(RenderWindow * render_window, Ogre::Camer
render_window->impl_->setCamera(ogre_camera);
}

void
RenderWindowOgreAdapter::setSceneNodeCamera(
RenderWindow * render_window,
Ogre::SceneNode * ogre_camera)
{
render_window->impl_->setSceneNodeCamera(ogre_camera);
}

Ogre::Camera *
RenderWindowOgreAdapter::getOgreCamera(RenderWindow * render_window)
{
Expand Down

0 comments on commit c7bf4c9

Please sign in to comment.