A Gazebo visual plugin to synchronise and control a vertex shader rendering Gerstner waves. It also renders reflections and refractions onto the water. More...
#include <WavefieldVisualPlugin.hh>
Public Member Functions | |
virtual void | Init () |
Initialize the plugin. More... | |
virtual void | Load (gazebo::rendering::VisualPtr _visual, sdf::ElementPtr _sdf) |
Load the plugin. More... | |
virtual void | Reset () |
Reset the plugin. More... | |
WavefieldVisualPlugin () | |
Constructor. More... | |
virtual | ~WavefieldVisualPlugin () |
Destructor. More... | |
Private Member Functions | |
void | AddNewCamerasForReflectionRefraction () |
Check for new cameras, setup rtts for them. More... | |
void | CreateRtts (Ogre::Camera *_camera) |
Create reflection refraction rtts for a given camera Stores the render target and given camera. More... | |
std::vector< gazebo::rendering::CameraPtr > | NewCameras () |
Get new cameras not already contained in this->data->cameras. More... | |
void | OnCameraPreRender (const std::string &_camera) |
Update rtts before cameras. More... | |
void | OnPreRender () |
Called every PreRender event. More... | |
void | OnStatsMsg (ConstWorldStatisticsPtr &_msg) |
Callback for gztopic "~/world_stats". More... | |
virtual void | postRenderTargetUpdate (const Ogre::RenderTargetEvent &rte) |
virtual void | preRenderTargetUpdate (const Ogre::RenderTargetEvent &rte) |
Hide/Show objects for reflection/refraction render eg. hide objects above water for refraction hide objects below water for reflection unhide all objects after texture is rendered. More... | |
void | SetShaderParams () |
Update the vertex shader parameters. More... | |
void | SetupReflectionRefraction () |
Setup Ogre objects for reflection/refraction. More... | |
void | UpdateClipPlanes () |
Move and rotate clip planes to match ocean pose. More... | |
Private Attributes | |
std::shared_ptr< WavefieldVisualPluginPrivate > | data |
A Gazebo visual plugin to synchronise and control a vertex shader rendering Gerstner waves. It also renders reflections and refractions onto the water.
Add the SDF for the plugin to the <visual> element of your wave model.
The SDF parameters specifying the wave are all optional, and normal use will be overridden.
If this visual is loaded as part of a wave model that also contains the plugin libWavefieldModelPlugin.so, then it will receive a response to its request for ~/wave_param and set the wave parameters to be consistent with the wave generator operating on the physics server.
11.<period> (double, default: 1.0) The period of the mean wave in [s].
12.<phase> (double, default: 0.0) The phase of the mean wave.
13.<direction> (Vector2D, default: (1 0)) A two component vector specifiying the direction of the mean wave.
Definition at line 138 of file WavefieldVisualPlugin.hh.
|
virtual |
Destructor.
Definition at line 229 of file WavefieldVisualPlugin.cc.
asv::WavefieldVisualPlugin::WavefieldVisualPlugin | ( | ) |
Constructor.
Definition at line 239 of file WavefieldVisualPlugin.cc.
|
private |
Check for new cameras, setup rtts for them.
internal
Definition at line 475 of file WavefieldVisualPlugin.cc.
|
private |
Create reflection refraction rtts for a given camera Stores the render target and given camera.
internal
Definition at line 503 of file WavefieldVisualPlugin.cc.
|
virtual |
Initialize the plugin.
Definition at line 331 of file WavefieldVisualPlugin.cc.
|
virtual |
Load the plugin.
Definition at line 247 of file WavefieldVisualPlugin.cc.
|
private |
Get new cameras not already contained in this->data->cameras.
internal
Definition at line 573 of file WavefieldVisualPlugin.cc.
|
private |
|
private |
|
private |
Callback for gztopic "~/world_stats".
internal
[in] | _msg | World statistics message. |
|
privatevirtual |
Definition at line 722 of file WavefieldVisualPlugin.cc.
|
privatevirtual |
Hide/Show objects for reflection/refraction render eg. hide objects above water for refraction hide objects below water for reflection unhide all objects after texture is rendered.
internal
Definition at line 685 of file WavefieldVisualPlugin.cc.
|
virtual |
Reset the plugin.
Definition at line 355 of file WavefieldVisualPlugin.cc.
|
private |
Update the vertex shader parameters.
internal
Definition at line 599 of file WavefieldVisualPlugin.cc.
|
private |
Setup Ogre objects for reflection/refraction.
internal
Definition at line 390 of file WavefieldVisualPlugin.cc.
|
private |
Move and rotate clip planes to match ocean pose.
internal
Definition at line 447 of file WavefieldVisualPlugin.cc.
|
private |
Definition at line 210 of file WavefieldVisualPlugin.hh.