Gazebo Rendering

API Reference

7.4.2
gz/rendering/ogre/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 
27 namespace Ogre
28 {
29  class Root;
30  class SceneManager;
31 }
32 
33 namespace 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 
78  protected: virtual DirectionalLightPtr CreateDirectionalLightImpl(
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
86  protected: virtual InertiaVisualPtr CreateInertiaVisualImpl(
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
106  protected: virtual DepthCameraPtr CreateDepthCameraImpl(
107  const unsigned int _id,
108  const std::string &_name) override;
109 
110  // Documentation inherited
111  protected: virtual ThermalCameraPtr CreateThermalCameraImpl(
112  const unsigned int _id,
113  const std::string &_name) override;
114 
115  // Documentation inherited
116  protected: virtual WideAngleCameraPtr CreateWideAngleCameraImpl(
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
161  protected: virtual HeightmapPtr CreateHeightmapImpl(
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  protected: virtual WireBoxPtr CreateWireBoxImpl(unsigned int _id,
185  const std::string &_name) override;
186 
187  // Documentation inherited
188  protected: virtual TextPtr CreateTextImpl(unsigned int _id,
189  const std::string &_name) override;
190 
191  protected: virtual MaterialPtr CreateMaterialImpl(unsigned int _id,
192  const std::string &_name) override;
193 
194  protected: virtual RenderTexturePtr CreateRenderTextureImpl(
195  unsigned int _id, const std::string &_name) override;
196 
197  // Documentation inherited.
198  protected: virtual RenderWindowPtr CreateRenderWindowImpl(
199  unsigned int _id, const std::string &_name) override;
200 
201  protected: virtual RayQueryPtr CreateRayQueryImpl(
202  unsigned int _id, const std::string &_name) override;
203 
204  // Documentation inherited
205  protected: virtual ParticleEmitterPtr CreateParticleEmitterImpl(
206  unsigned int _id, const std::string &_name) override;
207 
208  // Documentation inherited
209  // \todo(iche033) make this virtual in gz-rendering8
210  protected: ProjectorPtr CreateProjectorImpl(
211  unsigned int _id, const std::string &_name);
212 
213  protected: virtual bool InitObject(OgreObjectPtr _object,
214  unsigned int _id, const std::string &_name);
215 
216  protected: virtual LightStorePtr Lights() const override;
217 
218  protected: virtual SensorStorePtr Sensors() const override;
219 
220  protected: virtual VisualStorePtr Visuals() const override;
221 
222  protected: virtual MaterialMapPtr Materials() const override;
223 
224  // Documentation inherited
225  protected: unsigned int CreateObjectId() override;
226 
229  public: void ClearMaterialsCache(const std::string &_name);
230 
231  private: void CreateContext();
232 
233  private: void CreateRootVisual();
234 
235  private: void CreateMeshFactory();
236 
237  private: void CreateStores();
238 
239  private: OgreScenePtr SharedThis();
240 
242 
244 
246 
248 
250 
252 
253  protected: Ogre::Root *ogreRoot;
254 
255  protected: Ogre::SceneManager *ogreSceneManager;
256 
257  private: friend class OgreRenderEngine;
258  private: friend class OgreSceneExt;
259  };
260 
262  class OgreSceneExt : public SceneExt
263  {
266  public: OgreSceneExt(Scene *_scene);
267 
268  // Documentation inherited
269  public: virtual ObjectPtr CreateExt(const std::string &_type,
270  const std::string &_name = "") override;
271  };
272  }
273  }
274 }
275 #endif