WavefieldVisualPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Rhys Mainwaring
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
22 
23 #ifndef _ASV_WAVE_SIM_GAZEBO_PLUGINS_WAVEFIELD_VISUAL_PLUGIN_HH_
24 #define _ASV_WAVE_SIM_GAZEBO_PLUGINS_WAVEFIELD_VISUAL_PLUGIN_HH_
25 
26 #include <gazebo/common/Plugin.hh>
27 #include <gazebo/msgs/msgs.hh>
28 #include <gazebo/rendering/Camera.hh>
29 
30 #include <memory>
31 #include <string>
32 #include <vector>
33 
34 namespace asv
35 {
36 
38 // WavefieldVisualPlugin
39 
42  class WavefieldVisualPluginPrivate;
43 
138  class GZ_RENDERING_VISIBLE WavefieldVisualPlugin :
139  public gazebo::VisualPlugin,
140  public Ogre::RenderTargetListener
141  {
143  public: virtual ~WavefieldVisualPlugin();
144 
146  public: WavefieldVisualPlugin();
147 
149  public: virtual void Load(
150  gazebo::rendering::VisualPtr _visual,
151  sdf::ElementPtr _sdf);
152 
154  public: virtual void Init();
155 
157  public: virtual void Reset();
158 
161  private: void OnPreRender();
162 
165  private: void SetupReflectionRefraction();
166 
169  private: void UpdateClipPlanes();
170 
173  private: void AddNewCamerasForReflectionRefraction();
174 
178  private: void CreateRtts(Ogre::Camera* _camera);
179 
182  private: std::vector<gazebo::rendering::CameraPtr> NewCameras();
183 
188  private: void OnStatsMsg(ConstWorldStatisticsPtr &_msg);
189 
192  private: void SetShaderParams();
193 
199  private: virtual void preRenderTargetUpdate(
200  const Ogre::RenderTargetEvent& rte);
201  private: virtual void postRenderTargetUpdate(
202  const Ogre::RenderTargetEvent& rte);
203 
206  private: void OnCameraPreRender(const std::string &_camera);
207 
210  private: std::shared_ptr<WavefieldVisualPluginPrivate> data;
211  };
212 }
213 
214 #endif
A Gazebo visual plugin to synchronise and control a vertex shader rendering Gerstner waves...
std::shared_ptr< WavefieldVisualPluginPrivate > data
Definition: Geometry.hh:28


wave_gazebo_plugins
Author(s): Rhys Mainwaring
autogenerated on Thu May 7 2020 03:54:44