Skip to content

Commit

Permalink
Ogre 13 compatibility
Browse files Browse the repository at this point in the history
- Adapt to new createSceneManager
- Add missing deque include
- Ogre::UTFString was removed in 13.0
- CI: Add Ogre 13.6
  • Loading branch information
simonschmeisser authored and rhaschke committed Feb 3, 2024
1 parent fc75912 commit 9911c32
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ jobs:
ogre: 1.12
qt: 6
cxxflags: -Wno-deprecated-declarations -Werror
- distro: noetic
ogre: 13.6
qt: 5

env:
CXXFLAGS: "-DRVIZ_DEPRECATE_QT4_SLOTS -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls -Wno-strict-aliasing -Wno-sign-compare ${{ matrix.cxxflags}}"
UPSTREAM_WORKSPACE: ${{ matrix.distro != 'jammy' && 'github:rhaschke/python_qt_binding#silent-external-warnings' || '' }}
AFTER_INIT: ${{ startsWith(matrix.ogre, '13') && 'apt install -q -y software-properties-common && add-apt-repository ppa:s-schmeisser/ogre-13-focal -y' || ''}}
AFTER_INSTALL_TARGET_DEPENDENCIES: apt install -qq -y libogre-${{ matrix.ogre }}-dev
CATKIN_LINT: true
CMAKE_ARGS: -DRVIZ_QT_VERSIONS="${{ matrix.qt }}"
Expand Down
5 changes: 5 additions & 0 deletions src/image_view/image_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ using namespace rviz;
ImageView::ImageView(QWidget* parent) : QtOgreRenderWindow(parent), texture_it_(nh_)
{
setAutoRender(false);
#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0))
scene_manager_ = ogre_root_->createSceneManager(Ogre::ST_GENERIC, "TestSceneManager");
#else
scene_manager_ = ogre_root_->createSceneManager(Ogre::DefaultSceneManagerFactory::FACTORY_TYPE_NAME,
"TestSceneManager");
#endif
}

ImageView::~ImageView()
Expand Down
2 changes: 2 additions & 0 deletions src/rviz/default_plugin/covariance_property.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#ifndef COVARIANCE_PROPERTY_H
#define COVARIANCE_PROPERTY_H

#include <deque>

#include <QColor>

#include <OgreColourValue.h>
Expand Down
5 changes: 5 additions & 0 deletions src/rviz/default_plugin/image_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ void ImageDisplay::onInitialize()
static uint32_t count = 0;
std::stringstream ss;
ss << "ImageDisplay" << count++;
#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0))
img_scene_manager_ = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, ss.str());
#else
img_scene_manager_ = Ogre::Root::getSingleton().createSceneManager(
Ogre::DefaultSceneManagerFactory::FACTORY_TYPE_NAME, ss.str());
#endif
}

img_scene_node_ = img_scene_manager_->getRootSceneNode()->createChildSceneNode();
Expand Down
1 change: 1 addition & 0 deletions src/rviz/image/ros_image_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#include <ros/ros.h>

#include <deque>
#include <stdexcept>

namespace rviz
Expand Down
1 change: 1 addition & 0 deletions src/rviz/ogre_helpers/apply_visibility_bits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include <OgreMovableObject.h>
#include <OgreSceneNode.h>
#include <OgreIteratorWrapper.h>

namespace rviz
{
Expand Down
6 changes: 6 additions & 0 deletions src/rviz/ogre_helpers/movable_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
#include <OgreHardwareBufferManager.h>
#include <Overlay/OgreFontManager.h>
#include <Overlay/OgreFont.h>
#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0))
#include <OgreUTFString.h>
#endif

#include <sstream>

Expand Down Expand Up @@ -215,7 +217,11 @@ void MovableText::showOnTop(bool show)

void MovableText::_setupGeometry()
{
#if (OGRE_VERSION >= OGRE_VERSION_CHECK(13, 0, 0))
Ogre::String utfCaption(mCaption);
#else
Ogre::UTFString::utf32string utfCaption(Ogre::UTFString(mCaption).asUTF32());
#endif

assert(mpFont);
assert(!mpMaterial.isNull());
Expand Down
5 changes: 4 additions & 1 deletion src/rviz/visualization_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,11 @@ VisualizationManager::VisualizationManager(RenderPanel* render_panel,
render_panel->setAutoRender(false);

private_->threaded_nh_.setCallbackQueue(&private_->threaded_queue_);

#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0))
scene_manager_ = ogre_root_->createSceneManager(Ogre::ST_GENERIC);
#else
scene_manager_ = ogre_root_->createSceneManager();
#endif

rviz::RenderSystem::RenderSystem::get()->prepareOverlays(scene_manager_);

Expand Down
5 changes: 5 additions & 0 deletions src/test/render_points_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ MyFrame::MyFrame(QWidget* parent)

try
{
#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0))
scene_manager_ = root_->createSceneManager(Ogre::ST_GENERIC, "TestSceneManager");
#else
scene_manager_ = root_->createSceneManager(Ogre::DefaultSceneManagerFactory::FACTORY_TYPE_NAME,
"TestSceneManager");
#endif

render_panel_ = new QtOgreRenderWindow();
render_panel_->resize(this->size());
Expand Down
5 changes: 5 additions & 0 deletions src/test/two_render_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include <rviz/ogre_helpers/compatibility.h>
#include <rviz/ogre_helpers/render_system.h>
#include <rviz/ogre_helpers/render_widget.h>

Expand Down Expand Up @@ -68,7 +69,11 @@ int main(int argc, char** argv)
container.show();

// Make a scene and show it in the window.
#if (OGRE_VERSION < OGRE_VERSION_CHECK(13, 0, 0))
Ogre::SceneManager* scene_manager = render_system->root()->createSceneManager(Ogre::ST_GENERIC);
#else
Ogre::SceneManager* scene_manager = render_system->root()->createSceneManager();
#endif

Ogre::Entity* thing = scene_manager->createEntity("thing", "rviz_cone.mesh");
Ogre::SceneNode* node = scene_manager->getRootSceneNode()->createChildSceneNode();
Expand Down

0 comments on commit 9911c32

Please sign in to comment.