Gazebo Rendering

API Reference

9.0.0~pre2
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
29namespace Ogre
30{
31 class Camera;
32 class RenderTarget;
33 class Texture;
34}
35
36namespace gz
37{
38 namespace rendering
39 {
40 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
41 //
42 class GZ_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
92 public: virtual void SetVisibilityMask(uint32_t _mask);
93
94 protected: virtual void UpdateBackgroundColor();
95
97 protected: virtual void UpdateRenderPassChain();
98
99 protected: virtual void RebuildImpl() override;
100
101 protected: virtual void RebuildTarget() = 0;
102
103 protected: virtual void RebuildViewport();
104
109 protected: void RebuildMaterial();
110
111 protected: Ogre::Camera *ogreCamera = nullptr;
112
113 protected: Ogre::Viewport *ogreViewport = nullptr;
114
115 protected: Ogre::ColourValue ogreBackgroundColor;
116
119
122
123 protected: bool colorDirty = true;
124
125 protected: unsigned int antiAliasing = 4;
126
128 protected: uint32_t visibilityMask = GZ_VISIBILITY_ALL;
129 };
130
131 class GZ_RENDERING_OGRE_VISIBLE OgreRenderTexture :
132 public virtual BaseRenderTexture<OgreRenderTarget>
133 {
134 protected: OgreRenderTexture();
135
136 public: virtual ~OgreRenderTexture();
137
138 public: virtual void Destroy() override;
139
140 // Documentation inherited.
141 public: virtual void PreRender() override;
142
143 // Documentation inherited.
144 public: virtual void PostRender() override;
145
146 // Documentation inherited.
147 public: virtual unsigned int GLId() const override;
148
149 public: virtual void Buffer(float *buffer);
150
151 public: virtual Ogre::RenderTarget *RenderTarget() const override;
152
153 protected: virtual void RebuildTarget() override;
154
155 protected: virtual void DestroyTarget();
156
157 protected: virtual void BuildTarget();
158
159 protected: Ogre::Texture *ogreTexture = nullptr;
160
161 private: friend class OgreScene;
162 };
163
164 class GZ_RENDERING_OGRE_VISIBLE OgreRenderWindow :
165 public virtual BaseRenderWindow<OgreRenderTarget>
166 {
167 protected: OgreRenderWindow();
168
169 public: virtual ~OgreRenderWindow();
170
171 public: virtual void Destroy();
172
173 protected: virtual Ogre::RenderTarget *RenderTarget() const;
174
175 protected: virtual void RebuildTarget();
176
177 protected: virtual void BuildTarget();
178
179 protected: Ogre::RenderTarget *ogreRenderWindow = nullptr;
180
181 private: friend class OgreScene;
182 };
183 }
184 }
185}
186#endif