Skip to content

Commit

Permalink
Use gz-rendering9 in links and lux_core_engine example (#1053)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Agüero <[email protected]>
  • Loading branch information
caguero authored Sep 6, 2024
1 parent 6ec0c52 commit 12b6a15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/lux_core_engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
set(GZ_PLUGIN_VER 2)
set(GZ_COMMON_VER 5)

find_package(gz-rendering7 REQUIRED)
find_package(gz-rendering9 REQUIRED)
find_package(gz-plugin3 REQUIRED COMPONENTS all)

if (NOT DEFINED ENV{LUXCORE_SDK_PATH})
Expand Down
12 changes: 6 additions & 6 deletions tutorials/03_rendering_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ It is also possible to integrate your own selected rendering engine by writing a

#### How to Write Your Own Rendering Engine Plugin

A mocked example of a custom rendering engine plugin can be found [here](https://github.com/gazebosim/gz-rendering/tree/gz-rendering7/examples/hello_world_plugin). In order
A mocked example of a custom rendering engine plugin can be found [here](https://github.com/gazebosim/gz-rendering/tree/gz-rendering9/examples/hello_world_plugin). In order
to make your own custom rendering engine, this example is a good starting point. There are a few key things which will need to be done in order for a custom rendering engine to function:

* A singleton Render Engine class which implements the pure virtual functions in [`gz::rendering::BaseRenderEngine`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/include/gz/rendering/base/BaseRenderEngine.hh).
* A plugin class which implements the pure virtual functions in [`gz::rendering::RenderEnginePlugin`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/include/gz/rendering/RenderEnginePlugin.hh)
* Registering the plugin, this line can be seen at the bottom of the [`HelloWorldPlugin`](https://github.com/gazebosim/gz-rendering/tree/gz-rendering7/examples/hello_world_plugin/HelloWorldPlugin.cc) example
* A singleton Render Engine class which implements the pure virtual functions in [`gz::rendering::BaseRenderEngine`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/include/gz/rendering/base/BaseRenderEngine.hh).
* A plugin class which implements the pure virtual functions in [`gz::rendering::RenderEnginePlugin`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/include/gz/rendering/RenderEnginePlugin.hh)
* Registering the plugin, this line can be seen at the bottom of the [`HelloWorldPlugin`](https://github.com/gazebosim/gz-rendering/tree/gz-rendering9/examples/hello_world_plugin/HelloWorldPlugin.cc) example

Finally, for your custom rendering engine to actually have any functionality and at minimum, display something in a window, you will need to implement your own `Scene` and `Camera` classes, which inherit from and implement the pure virtual functions of [`gz::rendering::Scene`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/include/gz/rendering/Scene.hh) and [`gz::rendering::Camera`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/include/gz/rendering/Camera.hh), respectively. The mocked example simply returns `nullptr` for its `CreateSceneImpl(...)` function, so it may be useful to look at the current `Scene` implementations for the other rendering engines within `gz::rendering` such as [`OGRE`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/ogre/src/OgreScene.cc) or [`OGRE2`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/ogre2/src/Ogre2Scene.cc). Likewise, it may be helpful to look at the `Camera` implementations from [`OGRE`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/ogre/src/OgreCamera.cc) and [`OGRE2`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering7/ogre2/src/Ogre2Camera.cc)
Finally, for your custom rendering engine to actually have any functionality and at minimum, display something in a window, you will need to implement your own `Scene` and `Camera` classes, which inherit from and implement the pure virtual functions of [`gz::rendering::Scene`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/include/gz/rendering/Scene.hh) and [`gz::rendering::Camera`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/include/gz/rendering/Camera.hh), respectively. The mocked example simply returns `nullptr` for its `CreateSceneImpl(...)` function, so it may be useful to look at the current `Scene` implementations for the other rendering engines within `gz::rendering` such as [`OGRE`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/ogre/src/OgreScene.cc) or [`OGRE2`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/ogre2/src/Ogre2Scene.cc). Likewise, it may be helpful to look at the `Camera` implementations from [`OGRE`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/ogre/src/OgreCamera.cc) and [`OGRE2`](https://github.com/gazebosim/gz-rendering/blob/gz-rendering9/ogre2/src/Ogre2Camera.cc)

#### Building and Running Your Rendering Engine Plugin with Gazebo

Once you have your own rendering plugin written, you can build it similarly to how the example is built. It may be helpful to look at the [`CMakeLists.txt`](https://github.com/gazebosim/gz-rendering/tree/gz-rendering7/examples/hello_world_plugin) from the example as it contains the boilerplate code needed to get a custom rendering engine plugin built.
Once you have your own rendering plugin written, you can build it similarly to how the example is built. It may be helpful to look at the [`CMakeLists.txt`](https://github.com/gazebosim/gz-rendering/tree/gz-rendering9/examples/hello_world_plugin) from the example as it contains the boilerplate code needed to get a custom rendering engine plugin built.

After you have your plugin built, you will need to set the `GZ_SIM_RENDER_ENGINE_PATH` environment variable to the path in which your built shared library resides. Note that you will need to do this for every command line instance unless you add the line to your startup shell script (`.bashrc`, `.zshrc`, etc.).

Expand Down

0 comments on commit 12b6a15

Please sign in to comment.