Gazebo Rendering

API Reference

3.7.2
gz/rendering/ogre2/Ogre2RenderTarget.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Open Source Robotics Foundation
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 #ifndef GZ_RENDERING_OGRE2_OGRE2RENDERTARGET_HH_
18 #define GZ_RENDERING_OGRE2_OGRE2RENDERTARGET_HH_
19 
20 #include <string>
21 #include <vector>
22 #include <gz/math/Color.hh>
23 
29 
30 namespace Ogre
31 {
32  class Camera;
33  class RenderTarget;
34  class Texture;
35 }
36 
37 namespace ignition
38 {
39  namespace rendering
40  {
41  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
42  //
44  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderTarget :
45  public virtual BaseRenderTarget<Ogre2Object>
46  {
48  protected: Ogre2RenderTarget();
49 
51  public: virtual ~Ogre2RenderTarget();
52 
54  public: virtual unsigned int AntiAliasing() const;
55 
58  public: virtual void SetAntiAliasing(unsigned int _aa);
59 
62  public: virtual void Copy(Image &_image) const override;
63 
66  public: virtual Ogre::Camera *Camera() const;
67 
70  public: virtual void SetCamera(Ogre::Camera *_camera);
71 
72  // Documentation inherited
73  public: virtual math::Color BackgroundColor() const override;
74 
77  public: virtual void SetBackgroundColor(math::Color _color);
78 
79  // Documentation inherited
80  public: virtual void PreRender() override;
81 
82  // Documentation inherited
83  public: virtual void PostRender() override;
84 
86  public: virtual void Render();
87 
89  public: virtual void Destroy() override = 0;
90 
94  public: void SetMaterial(MaterialPtr _material);
95 
97  public: virtual Ogre::RenderTarget *RenderTarget() const = 0;
98 
100  public: static void UpdateRenderPassChain(
101  Ogre::CompositorWorkspace *_workspace,
102  const std::string &_workspaceDefName,
103  const std::string &_baseNode, const std::string &_finalNode,
104  const std::vector<RenderPassPtr> &_renderPasses, bool _recreateNodes);
105 
107  protected: virtual void UpdateBackgroundColor();
108 
110  protected: virtual void UpdateRenderPassChain();
111 
114  protected: void UpdateShadowNode();
115 
117  protected: virtual void RebuildImpl() override;
118 
120  protected: virtual void RebuildTarget() = 0;
121 
123  protected: virtual void RebuildCompositor();
124 
126  protected: virtual void BuildCompositor();
127 
129  protected: virtual void DestroyCompositor();
130 
135  protected: void RebuildMaterial();
136 
150  private: void CreateShadowNodeWithSettings(
151  Ogre::CompositorManager2 *_compositorManager,
152  const std::string &_shadowNodeName,
153  const Ogre::ShadowNodeHelper::ShadowParamVec &_shadowParams);
154 
156  protected: Ogre::Camera *ogreCamera = nullptr;
157 
160  protected: Ogre::CompositorWorkspace *ogreCompositorWorkspace = nullptr;
161 
164 
166  protected: Ogre::ColourValue ogreBackgroundColor;
167 
169  protected: MaterialPtr material;
170 
173 
175  protected: bool colorDirty = true;
176 
178  protected: unsigned int antiAliasing = 4;
179  };
180 
182  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderTexture :
183  public virtual BaseRenderTexture<Ogre2RenderTarget>
184  {
186  protected: Ogre2RenderTexture();
187 
189  public: virtual ~Ogre2RenderTexture();
190 
191  // Documentation inherited.
192  public: virtual void Destroy() override;
193 
194  // Documentation inherited
195  public: virtual void PreRender() override;
196 
197  // Documentation inherited
198  public: virtual void PostRender() override;
199 
200  // Documentation inherited
201  public: virtual unsigned int GLId() const override;
202 
203  // Documentation inherited.
204  public: virtual Ogre::RenderTarget *RenderTarget() const override;
205 
206  // Documentation inherited.
207  protected: virtual void RebuildTarget() override;
208 
210  protected: virtual void DestroyTarget();
211 
213  protected: virtual void BuildTarget();
214 
216  protected: Ogre::Texture *ogreTexture = nullptr;
217 
219  private: friend class Ogre2Scene;
220  };
221 
223  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderWindow :
224  public virtual BaseRenderWindow<Ogre2RenderTarget>
225  {
227  protected: Ogre2RenderWindow();
228 
230  public: virtual ~Ogre2RenderWindow();
231 
232  // Documentation inherited.
233  public: virtual void Destroy() override;
234 
235  // Documentation inherited.
236  public: virtual Ogre::RenderTarget *RenderTarget() const override;
237 
238  // Documentation inherited.
239  protected: virtual void RebuildTarget() override;
240 
242  protected: virtual void BuildTarget();
243 
245  protected: Ogre::RenderTarget *ogreRenderWindow = nullptr;
246 
248  private: friend class Ogre2Scene;
249  };
250  }
251  }
252 }
253 #endif
Definition: gz/rendering/ogre/OgreCamera.hh:27
STL class.
STL class.
STL class.
std::string ogreCompositorWorkspaceDefName
Ogre's compositor workspace definition name.
Definition: gz/rendering/ogre2/Ogre2RenderTarget.hh:163
Ogre2.x implementation of the render target class.
Definition: gz/rendering/ogre2/Ogre2RenderTarget.hh:44
Ogre2.x implementation of the render window class.
Definition: gz/rendering/ogre2/Ogre2RenderTarget.hh:223
Encapsulates a raw image buffer and relevant properties.
Definition: gz/rendering/Image.hh:36
Posable camera used for rendering the scene graph.
Definition: gz/rendering/Camera.hh:40
MaterialPtr material
a material used by for the render target
Definition: gz/rendering/ogre2/Ogre2RenderTarget.hh:169
Ogre2.x implementation of the scene class.
Definition: gz/rendering/ogre2/Ogre2Scene.hh:41
Represents a render-target to which cameras can render images.
Definition: gz/rendering/RenderTarget.hh:37
Definition: gz/rendering/base/BaseRenderTarget.hh:35
Ogre2.x implementation of the render texture class.
Definition: gz/rendering/ogre2/Ogre2RenderTarget.hh:182
Ogre::ColourValue ogreBackgroundColor
Stores the background color of the render target.
Definition: gz/rendering/ogre2/Ogre2RenderTarget.hh:166
Definition: gz/rendering/base/BaseRenderTarget.hh:111
Definition: gz/rendering/base/BaseRenderTarget.hh:98
Ogre2RenderTargetMaterialPtr materialApplicator
Helper class that applies the material to the render target.
Definition: gz/rendering/ogre2/Ogre2RenderTarget.hh:172