Ignition Rendering

API Reference

4.0.0
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 IGNITION_RENDERING_OGRE2_OGRE2RENDERTARGET_HH_
18 #define IGNITION_RENDERING_OGRE2_OGRE2RENDERTARGET_HH_
19 
20 #include <memory>
21 #include <string>
22 #include <ignition/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  //
43  // forward declaration
44  class Ogre2RenderTargetPrivate;
45 
47  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderTarget :
48  public virtual BaseRenderTarget<Ogre2Object>
49  {
51  protected: Ogre2RenderTarget();
52 
54  public: virtual ~Ogre2RenderTarget();
55 
57  public: virtual unsigned int AntiAliasing() const;
58 
61  public: virtual void SetAntiAliasing(unsigned int _aa);
62 
65  public: virtual void Copy(Image &_image) const override;
66 
69  public: virtual Ogre::Camera *Camera() const;
70 
73  public: virtual void SetCamera(Ogre::Camera *_camera);
74 
75  // Documentation inherited
76  public: virtual math::Color BackgroundColor() const override;
77 
80  public: virtual void SetBackgroundColor(math::Color _color);
81 
82  // Documentation inherited
83  public: virtual void PreRender() override;
84 
85  // Documentation inherited
86  public: virtual void PostRender() override;
87 
89  public: virtual void Render();
90 
92  public: virtual void Destroy() override = 0;
93 
97  public: void SetMaterial(MaterialPtr _material);
98 
100  public: virtual Ogre::RenderTarget *RenderTarget() const = 0;
101 
105  public: virtual uint32_t VisibilityMask() const;
106 
110  public: virtual void SetVisibilityMask(uint32_t _mask);
111 
113  protected: virtual void UpdateBackgroundColor();
114 
116  protected: virtual void UpdateRenderPassChain();
117 
120  protected: void UpdateShadowNode();
121 
123  protected: virtual void RebuildImpl() override;
124 
126  protected: virtual void RebuildTarget() = 0;
127 
129  protected: virtual void RebuildCompositor();
130 
132  protected: virtual void BuildCompositor();
133 
135  protected: virtual void DestroyCompositor();
136 
141  protected: void RebuildMaterial();
142 
156  private: void CreateShadowNodeWithSettings(
157  Ogre::CompositorManager2 *_compositorManager,
158  const std::string &_shadowNodeName,
159  const Ogre::ShadowNodeHelper::ShadowParamVec &_shadowParams);
160 
162  protected: Ogre::Camera *ogreCamera = nullptr;
163 
166  protected: Ogre::CompositorWorkspace *ogreCompositorWorkspace = nullptr;
167 
170 
172  protected: Ogre::ColourValue ogreBackgroundColor;
173 
175  protected: MaterialPtr material;
176 
179 
181  protected: bool colorDirty = true;
182 
184  protected: unsigned int antiAliasing = 4;
185 
187  protected: uint32_t visibilityMask = IGN_VISIBILITY_ALL;
188 
191  };
192 
194  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderTexture :
195  public virtual BaseRenderTexture<Ogre2RenderTarget>
196  {
198  protected: Ogre2RenderTexture();
199 
201  public: virtual ~Ogre2RenderTexture();
202 
203  // Documentation inherited.
204  public: virtual void Destroy() override;
205 
206  // Documentation inherited
207  public: virtual void PreRender() override;
208 
209  // Documentation inherited
210  public: virtual void PostRender() override;
211 
212  // Documentation inherited
213  public: virtual unsigned int GLId() const override;
214 
215  // Documentation inherited.
216  public: virtual Ogre::RenderTarget *RenderTarget() const override;
217 
218  // Documentation inherited.
219  protected: virtual void RebuildTarget() override;
220 
222  protected: virtual void DestroyTarget();
223 
225  protected: virtual void BuildTarget();
226 
228  protected: Ogre::Texture *ogreTexture = nullptr;
229 
231  private: friend class Ogre2Scene;
232  };
233 
235  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderWindow :
236  public virtual BaseRenderWindow<Ogre2RenderTarget>
237  {
239  protected: Ogre2RenderWindow();
240 
242  public: virtual ~Ogre2RenderWindow();
243 
244  // Documentation inherited.
245  public: virtual void Destroy() override;
246 
247  // Documentation inherited.
248  public: virtual Ogre::RenderTarget *RenderTarget() const override;
249 
250  // Documentation inherited.
251  protected: virtual void RebuildTarget() override;
252 
254  protected: virtual void BuildTarget();
255 
257  protected: Ogre::RenderTarget *ogreRenderWindow = nullptr;
258 
260  private: friend class Ogre2Scene;
261  };
262  }
263  }
264 }
265 #endif
Definition: BaseRenderTarget.hh:98
Ogre::ColourValue ogreBackgroundColor
Stores the background color of the render target.
Definition: Ogre2RenderTarget.hh:172
#define IGN_VISIBILITY_ALL
Render everything visibility mask.
Definition: RenderTypes.hh:26
MaterialPtr material
a material used by for the render target
Definition: Ogre2RenderTarget.hh:175
Ogre2.x implementation of the render window class.
Definition: Ogre2RenderTarget.hh:235
Definition: BaseRenderTarget.hh:35
std::string ogreCompositorWorkspaceDefName
Ogre&#39;s compositor workspace definition name.
Definition: Ogre2RenderTarget.hh:169
Ogre2.x implementation of the scene class.
Definition: Ogre2Scene.hh:45
STL class.
Represents a render-target to which cameras can render images.
Definition: RenderTarget.hh:37
Definition: BaseRenderTarget.hh:111
Encapsulates a raw image buffer and relevant properties.
Definition: Image.hh:36
Ogre2RenderTargetMaterialPtr materialApplicator
Helper class that applies the material to the render target.
Definition: Ogre2RenderTarget.hh:178
Posable camera used for rendering the scene graph.
Definition: Camera.hh:40
Ogre2.x implementation of the render texture class.
Definition: Ogre2RenderTarget.hh:194
Definition: OgreCamera.hh:27
Ogre2.x implementation of the render target class.
Definition: Ogre2RenderTarget.hh:47