Gazebo Rendering

API Reference

9.1.0
OgreScene.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_OGRESCENE_HH_
18#define GZ_RENDERING_OGRE_OGRESCENE_HH_
19
20#include <array>
21#include <string>
23#include "gz/rendering/ogre/Export.hh"
25
26
27namespace Ogre
28{
29 class Root;
30 class SceneManager;
31}
32
33namespace gz
34{
35 namespace rendering
36 {
37 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
38 //
39 class GZ_RENDERING_OGRE_VISIBLE OgreScene :
40 public BaseScene
41 {
42 protected: OgreScene(unsigned int _id, const std::string &_name);
43
44 public: virtual ~OgreScene();
45
46 public: virtual void Fini() override;
47
48 public: virtual RenderEngine *Engine() const override;
49
50 public: virtual VisualPtr RootVisual() const override;
51
52 public: virtual math::Color AmbientLight() const override;
53
54 public: virtual void SetAmbientLight(const math::Color &_color) override;
55
56 public: virtual void SetBackgroundColor(
57 const math::Color &_color) override;
58
59 // Documentation inherited.
60 public: virtual void SetGradientBackgroundColor(
61 const std::array<math::Color, 4> &_colors) override;
62
63 // Documentation inherited.
64 public: virtual void RemoveGradientBackgroundColor() override;
65
66 public: virtual void PreRender() override;
67
68 public: virtual void Clear() override;
69
70 public: virtual void Destroy() override;
71
72 public: virtual Ogre::SceneManager *OgreSceneManager() const;
73
74 protected: virtual bool LoadImpl() override;
75
76 protected: virtual bool InitImpl() override;
77
79 unsigned int _id, const std::string &_name) override;
80
81 // Documentation inherited
82 protected: virtual COMVisualPtr CreateCOMVisualImpl(unsigned int _id,
83 const std::string &_name) override;
84
85 // Documentation inherited
87 unsigned int _id, const std::string &_name) override;
88
89 // Documentation inherited
90 protected: virtual JointVisualPtr CreateJointVisualImpl(unsigned int _id,
91 const std::string &_name) override;
92
93 protected: virtual LightVisualPtr CreateLightVisualImpl(unsigned int _id,
94 const std::string &_name) override;
95
96 protected: virtual PointLightPtr CreatePointLightImpl(unsigned int _id,
97 const std::string &_name) override;
98
99 protected: virtual SpotLightPtr CreateSpotLightImpl(unsigned int _id,
100 const std::string &_name) override;
101
102 protected: virtual CameraPtr CreateCameraImpl(unsigned int _id,
103 const std::string &_name) override;
104
105 // Documentation inherited
107 const unsigned int _id,
108 const std::string &_name) override;
109
110 // Documentation inherited
112 const unsigned int _id,
113 const std::string &_name) override;
114
115 // Documentation inherited
117 const unsigned int _id,
118 const std::string &_name) override;
119
120 protected: virtual GpuRaysPtr CreateGpuRaysImpl(
121 const unsigned int _id,
122 const std::string &_name) override;
123
124 protected: virtual VisualPtr CreateVisualImpl(unsigned int _id,
125 const std::string &_name) override;
126
127 protected: virtual ArrowVisualPtr CreateArrowVisualImpl(unsigned int _id,
128 const std::string &_name) override;
129
130 protected: virtual AxisVisualPtr CreateAxisVisualImpl(unsigned int _id,
131 const std::string &_name) override;
132
133 // Documentation inherited
134 protected: virtual GizmoVisualPtr CreateGizmoVisualImpl(unsigned int _id,
135 const std::string &_name) override;
136
137 protected: virtual GeometryPtr CreateBoxImpl(unsigned int _id,
138 const std::string &_name) override;
139
140 protected: virtual GeometryPtr CreateConeImpl(unsigned int _id,
141 const std::string &_name) override;
142
143 protected: virtual GeometryPtr CreateCylinderImpl(unsigned int _id,
144 const std::string &_name) override;
145
146 protected: virtual GeometryPtr CreatePlaneImpl(unsigned int _id,
147 const std::string &_name) override;
148
149 protected: virtual GeometryPtr CreateSphereImpl(unsigned int _id,
150 const std::string &_name) override;
151
152 protected: virtual MeshPtr CreateMeshImpl(unsigned int _id,
153 const std::string &_name, const std::string &_meshName);
154
155 protected: virtual MeshPtr CreateMeshImpl(
156 unsigned int _id,
157 const std::string &_name,
158 const MeshDescriptor &_desc) override;
159
160 // Documentation inherited
162 unsigned int _id,
163 const std::string &_name,
164 const HeightmapDescriptor &_desc) override;
165
166 // Documentation inherited
167 protected: virtual CapsulePtr CreateCapsuleImpl(unsigned int _id,
168 const std::string &_name) override;
169
170 protected: virtual GridPtr CreateGridImpl(
171 unsigned int _id,
172 const std::string &_name) override;
173
174 // Documentation inherited
175 protected: virtual MarkerPtr CreateMarkerImpl(
176 unsigned int _id,
177 const std::string &_name) override;
178
179 // Documentation inherited
180 protected: virtual LidarVisualPtr CreateLidarVisualImpl(unsigned int _id,
181 const std::string &_name) override;
182
183 // Documentation inherited
184 // \todo(iche033) make this virtual in gz-rendering10
186 unsigned int _id, const std::string &_name);
187
188 // Documentation inherited
189 protected: virtual WireBoxPtr CreateWireBoxImpl(unsigned int _id,
190 const std::string &_name) override;
191
192 // Documentation inherited
193 protected: virtual TextPtr CreateTextImpl(unsigned int _id,
194 const std::string &_name) override;
195
196 protected: virtual MaterialPtr CreateMaterialImpl(unsigned int _id,
197 const std::string &_name) override;
198
200 unsigned int _id, const std::string &_name) override;
201
202 // Documentation inherited.
204 unsigned int _id, const std::string &_name) override;
205
206 protected: virtual RayQueryPtr CreateRayQueryImpl(
207 unsigned int _id, const std::string &_name) override;
208
209 // Documentation inherited
211 unsigned int _id, const std::string &_name) override;
212
213 // Documentation inherited
215 unsigned int _id, const std::string &_name) override;
216
217 protected: virtual bool InitObject(OgreObjectPtr _object,
218 unsigned int _id, const std::string &_name);
219
220 protected: virtual LightStorePtr Lights() const override;
221
222 protected: virtual SensorStorePtr Sensors() const override;
223
224 protected: virtual VisualStorePtr Visuals() const override;
225
226 protected: virtual MaterialMapPtr Materials() const override;
227
228 // Documentation inherited
229 protected: unsigned int CreateObjectId() override;
230
233 public: void ClearMaterialsCache(const std::string &_name);
234
235 private: void CreateContext();
236
237 private: void CreateRootVisual();
238
239 private: void CreateMeshFactory();
240
241 private: void CreateStores();
242
243 private: OgreScenePtr SharedThis();
244
246
248
250
252
254
256
257 protected: Ogre::Root *ogreRoot;
258
259 protected: Ogre::SceneManager *ogreSceneManager;
260
261 private: friend class OgreRenderEngine;
262 private: friend class OgreSceneExt;
263 };
264
266 class OgreSceneExt : public SceneExt
267 {
270 public: OgreSceneExt(Scene *_scene);
271
272 // Documentation inherited
273 public: virtual ObjectPtr CreateExt(const std::string &_type,
274 const std::string &_name = "") override;
275 };
276 }
277 }
278}
279#endif