Gazebo Rendering

API Reference

3.7.2
gz/rendering/ogre/OgreRenderTarget.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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_OGRE_OGRERENDERTARGET_HH_
18 #define GZ_RENDERING_OGRE_OGRERENDERTARGET_HH_
19 
20 #include <gz/math/Color.hh>
21 
28 
29 namespace Ogre
30 {
31  class Camera;
32  class RenderTarget;
33  class Texture;
34 }
35 
36 namespace ignition
37 {
38  namespace rendering
39  {
40  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
41  //
42  class IGNITION_RENDERING_OGRE_VISIBLE OgreRenderTarget :
43  public virtual BaseRenderTarget<OgreObject>
44  {
45  protected: OgreRenderTarget();
46 
47  public: virtual ~OgreRenderTarget();
48 
49  public: virtual unsigned int AntiAliasing() const;
50 
51  public: virtual void SetAntiAliasing(unsigned int _aa);
52 
53  public: virtual void Copy(Image &_image) const override;
54 
55  public: virtual Ogre::Camera *Camera() const;
56 
57  public: virtual void SetCamera(Ogre::Camera *_camera);
58 
59  // Documentation inherited
60  public: virtual math::Color BackgroundColor() const override;
61 
62  public: virtual void SetBackgroundColor(math::Color _color);
63 
64  // Documentation inherited.
65  public: virtual void PreRender() override;
66 
67  // Documentation inherited.
68  public: virtual void PostRender() override;
69 
70  public: virtual void Render();
71 
72  public: virtual void Destroy() override = 0;
73 
77  public: void SetMaterial(MaterialPtr _material);
78 
79  public: virtual Ogre::RenderTarget *RenderTarget() const = 0;
80 
81  public: Ogre::Viewport *AddViewport(Ogre::Camera *_viewport);
82 
83  public: Ogre::Viewport *Viewport(const int _viewportId) const;
84 
85  public: void SetUpdate(const bool _value);
86 
87  public: void SetAutoUpdated(const bool _value);
88 
89  protected: virtual void UpdateBackgroundColor();
90 
92  protected: virtual void UpdateRenderPassChain();
93 
94  protected: virtual void RebuildImpl() override;
95 
96  protected: virtual void RebuildTarget() = 0;
97 
98  protected: virtual void RebuildViewport();
99 
104  protected: void RebuildMaterial();
105 
106  protected: Ogre::Camera *ogreCamera = nullptr;
107 
108  protected: Ogre::Viewport *ogreViewport = nullptr;
109 
110  protected: Ogre::ColourValue ogreBackgroundColor;
111 
113  protected: MaterialPtr material;
114 
117 
118  protected: bool colorDirty = true;
119 
120  protected: unsigned int antiAliasing = 4;
121  };
122 
123  class IGNITION_RENDERING_OGRE_VISIBLE OgreRenderTexture :
124  public virtual BaseRenderTexture<OgreRenderTarget>
125  {
126  protected: OgreRenderTexture();
127 
128  public: virtual ~OgreRenderTexture();
129 
130  public: virtual void Destroy() override;
131 
132  // Documentation inherited.
133  public: virtual void PreRender() override;
134 
135  // Documentation inherited.
136  public: virtual void PostRender() override;
137 
138  // Documentation inherited.
139  public: virtual unsigned int GLId();
140 
141  public: virtual void Buffer(float *buffer);
142 
143  public: virtual Ogre::RenderTarget *RenderTarget() const override;
144 
145  protected: virtual void RebuildTarget() override;
146 
147  protected: virtual void DestroyTarget();
148 
149  protected: virtual void BuildTarget();
150 
151  protected: Ogre::Texture *ogreTexture = nullptr;
152 
153  private: friend class OgreScene;
154  };
155 
156  class IGNITION_RENDERING_OGRE_VISIBLE OgreRenderWindow :
157  public virtual BaseRenderWindow<OgreRenderTarget>
158  {
159  protected: OgreRenderWindow();
160 
161  public: virtual ~OgreRenderWindow();
162 
163  public: virtual void Destroy();
164 
165  protected: virtual Ogre::RenderTarget *RenderTarget() const;
166 
167  protected: virtual void RebuildTarget();
168 
169  protected: virtual void BuildTarget();
170 
171  protected: Ogre::RenderTarget *ogreRenderWindow = nullptr;
172 
173  private: friend class OgreScene;
174  };
175  }
176  }
177 }
178 #endif
Definition: gz/rendering/ogre/OgreCamera.hh:27
STL class.
Definition: gz/rendering/ogre/OgreScene.hh:39
Definition: gz/rendering/ogre/OgreRenderTarget.hh:123
Ogre::ColourValue ogreBackgroundColor
Definition: gz/rendering/ogre/OgreRenderTarget.hh:110
Encapsulates a raw image buffer and relevant properties.
Definition: gz/rendering/Image.hh:36
OgreRenderTargetMaterialPtr materialApplicator
Helper class that applies the material to the render target.
Definition: gz/rendering/ogre/OgreRenderTarget.hh:116
Posable camera used for rendering the scene graph.
Definition: gz/rendering/Camera.hh:40
Represents a render-target to which cameras can render images.
Definition: gz/rendering/RenderTarget.hh:37
Definition: gz/rendering/ogre/OgreRenderTarget.hh:156
MaterialPtr material
a material used by for the render target
Definition: gz/rendering/ogre/OgreRenderTarget.hh:113
Definition: gz/rendering/base/BaseRenderTarget.hh:35
Definition: gz/rendering/ogre/OgreRenderTarget.hh:42
Definition: gz/rendering/base/BaseRenderTarget.hh:111
Definition: gz/rendering/base/BaseRenderTarget.hh:98