Gazebo Rendering

API Reference

10.1.0
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
29
30namespace Ogre
31{
32 class Camera;
33 class RenderTarget;
34 class Texture;
35}
36
37namespace gz
38{
39 namespace rendering
40 {
41 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
42 //
43 class GZ_RENDERING_OGRE_VISIBLE OgreRenderTarget :
44 public virtual BaseRenderTarget<OgreObject>
45 {
46 protected: OgreRenderTarget();
47
48 public: virtual ~OgreRenderTarget();
49
50 public: virtual unsigned int AntiAliasing() const;
51
52 public: virtual void SetAntiAliasing(unsigned int _aa);
53
54 public: virtual void Copy(Image &_image) const override;
55
62 private: bool CopyToBuffer(const PixelBuffer &_dst) const;
63
64 public: virtual Ogre::Camera *Camera() const;
65
66 public: virtual void SetCamera(Ogre::Camera *_camera);
67
68 // Documentation inherited
69 public: virtual math::Color BackgroundColor() const override;
70
71 public: virtual void SetBackgroundColor(math::Color _color);
72
73 // Documentation inherited.
74 public: virtual void PreRender() override;
75
76 // Documentation inherited.
77 public: virtual void PostRender() override;
78
79 public: virtual void Render();
80
81 public: virtual void Destroy() override = 0;
82
86 public: void SetMaterial(MaterialPtr _material);
87
88 public: virtual Ogre::RenderTarget *RenderTarget() const = 0;
89
90 public: Ogre::Viewport *AddViewport(Ogre::Camera *_viewport);
91
92 public: Ogre::Viewport *Viewport(const int _viewportId) const;
93
94 public: void SetUpdate(const bool _value);
95
96 public: void SetAutoUpdated(const bool _value);
97
101 public: virtual void SetVisibilityMask(uint32_t _mask);
102
103 protected: virtual void UpdateBackgroundColor();
104
106 protected: virtual void UpdateRenderPassChain();
107
108 protected: virtual void RebuildImpl() override;
109
110 protected: virtual void RebuildTarget() = 0;
111
112 protected: virtual void RebuildViewport();
113
118 protected: void RebuildMaterial();
119
120 protected: Ogre::Camera *ogreCamera = nullptr;
121
122 protected: Ogre::Viewport *ogreViewport = nullptr;
123
124 protected: Ogre::ColourValue ogreBackgroundColor;
125
128
131
132 protected: bool colorDirty = true;
133
134 protected: unsigned int antiAliasing = 4;
135
137 protected: uint32_t visibilityMask = GZ_VISIBILITY_ALL;
138 };
139
140 class GZ_RENDERING_OGRE_VISIBLE OgreRenderTexture :
141 public virtual BaseRenderTexture<OgreRenderTarget>
142 {
143 protected: OgreRenderTexture();
144
145 public: virtual ~OgreRenderTexture();
146
147 public: virtual void Destroy() override;
148
149 // Documentation inherited.
150 public: virtual void PreRender() override;
151
152 // Documentation inherited.
153 public: virtual void PostRender() override;
154
155 // Documentation inherited.
156 public: virtual unsigned int GLId() const override;
157
158 public: virtual void Buffer(float *buffer);
159
160 public: virtual Ogre::RenderTarget *RenderTarget() const override;
161
162 protected: virtual void RebuildTarget() override;
163
164 protected: virtual void DestroyTarget();
165
166 protected: virtual void BuildTarget();
167
168 protected: Ogre::Texture *ogreTexture = nullptr;
169
170 private: friend class OgreScene;
171 };
172
173 class GZ_RENDERING_OGRE_VISIBLE OgreRenderWindow :
174 public virtual BaseRenderWindow<OgreRenderTarget>
175 {
176 protected: OgreRenderWindow();
177
178 public: virtual ~OgreRenderWindow();
179
180 public: virtual void Destroy();
181
182 protected: virtual Ogre::RenderTarget *RenderTarget() const;
183
184 protected: virtual void RebuildTarget();
185
186 protected: virtual void BuildTarget();
187
188 protected: Ogre::RenderTarget *ogreRenderWindow = nullptr;
189
190 private: friend class OgreScene;
191 };
192 }
193 }
194}
195#endif