Skip to content

Commit

Permalink
Add Rendering Plugin Tutorial (#161)
Browse files Browse the repository at this point in the history
* Add unversioned symlinks for engine plugins

Signed-off-by: John Shepherd <[email protected]>

* Add init attempt at custom render engine

Signed-off-by: John Shepherd <[email protected]>

* Refactor

Signed-off-by: John Shepherd <[email protected]>

* Clean up

Signed-off-by: John Shepherd <[email protected]>

* Add init attempt

Signed-off-by: John Shepherd <[email protected]>

* Clean

Signed-off-by: John Shepherd <[email protected]>

* Add null checks when loading example render engine (#156)

Add null checks and docs

Signed-off-by: Ian Chen <[email protected]>

Co-authored-by: John Shepherd <[email protected]>

* Add windows build rules

Signed-off-by: John Shepherd <[email protected]>

* Take in paths from ign gazebo

Signed-off-by: John Shepherd <[email protected]>

* Update docs

Signed-off-by: John Shepherd <[email protected]>

* Add init attempt at rendering plugin tutorial

Signed-off-by: John Shepherd <[email protected]>

* Requested fixes

Signed-off-by: John Shepherd <[email protected]>

* minor tweak to heading

Signed-off-by: Ian Chen <[email protected]>

Co-authored-by: Ian Chen <[email protected]>
  • Loading branch information
John Shepherd and iche033 authored Oct 13, 2020
1 parent 8876d6a commit 816177b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tutorials/03_rendering_plugins.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
\page renderingplugin Understanding the Rendering Plugin

This is an introduction to different rendering engines and how they are integrated into the Ignition Physics library.
This is an introduction to different rendering engines and how they are integrated into the Ignition Rendering library.

## Ignition Rendering

Expand All @@ -9,7 +9,7 @@ It allows users to select from multiple supported rendering engines based on the
Its plugin interface loads rendering engines at runtime.
It is also possible to integrate your own selected rendering engine by writing a compatible plugin interface.

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

A mocked example of a custom rendering engine plugin can be found [here](https://github.com/ignitionrobotics/ign-rendering/tree/ign-rendering3/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:
Expand All @@ -18,9 +18,9 @@ to make your own custom rendering engine, this example is a good starting point.
* A plugin class which implements the pure virtual functions in [`ignition::rendering::RenderEnginePlugin`](https://github.com/ignitionrobotics/ign-rendering/blob/main/include/ignition/rendering/RenderEnginePlugin.hh)
* Registering the plugin, this line can be seen at the bottom of the [`HelloWorldPlugin`](https://github.com/ignitionrobotics/ign-rendering/tree/ign-rendering3/examples/hello_world_plugin/HelloWorldPlugin.cc) example

Finally, for your custom rendering engine to actually have any functionality, you will need to implement your own `Scene` class, which inherits from and implements the pure virtual functions of [`ignition::rendering::Scene`](https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering3/include/ignition/rendering/Scene.hh). 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 `ignition::rendering` such as [`ogre`](https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering3/ogre/src/OgreScene.cc) or [`optix`](https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering3/optix/src/OptixScene.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 [`ignition::rendering::Scene`](https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering3/include/ignition/rendering/Scene.hh) and [`ignition::rendering::Camera`](https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering3/include/ignition/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 `ignition::rendering` such as [`OGRE`](https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering3/ogre/src/OgreScene.cc) or [`OGRE2`](https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering3/ogre2/src/Ogre2Scene.cc). Likewise, it may be helpful to look at the `Camera` implementations from [`OGRE`](https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering3/ogre/src/OgreCamera.cc) and [`OGRE2`](https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering3/ogre2/src/Ogre2Camera.cc)

#### Building and Running Your Rendering Plugin
#### Building and Running Your Rendering Engine Plugin with Ignition 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/ignitionrobotics/ign-rendering/tree/ign-rendering3/examples/hello_world_plugin) from the example as it contains the boilerplate code needed to get a custom rendering engine plugin built.

Expand All @@ -32,8 +32,4 @@ From here, you should be able to reference your rendering plugin within Ignition

~~~
ign gazebo --render-engine HelloWorldPlugin shapes.sdf
~~~

#### Feature Comparison

Do we want to fill this out for ogre, ogre2, and optix?
~~~

0 comments on commit 816177b

Please sign in to comment.