Gazebo Rendering

API Reference

8.2.1
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 
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
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 
195  unsigned int _id, const std::string &_name) override;
196 
197  // Documentation inherited.
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
206  unsigned int _id, const std::string &_name) override;
207 
208  // Documentation inherited
209  protected: virtual ProjectorPtr CreateProjectorImpl(
210  unsigned int _id, const std::string &_name) override;
211 
212  protected: virtual bool InitObject(OgreObjectPtr _object,
213  unsigned int _id, const std::string &_name);
214 
215  protected: virtual LightStorePtr Lights() const override;
216 
217  protected: virtual SensorStorePtr Sensors() const override;
218 
219  protected: virtual VisualStorePtr Visuals() const override;
220 
221  protected: virtual MaterialMapPtr Materials() const override;
222 
223  // Documentation inherited
224  protected: unsigned int CreateObjectId() override;
225 
228  public: void ClearMaterialsCache(const std::string &_name);
229 
230  private: void CreateContext();
231 
232  private: void CreateRootVisual();
233 
234  private: void CreateMeshFactory();
235 
236  private: void CreateStores();
237 
238  private: OgreScenePtr SharedThis();
239 
241 
243 
245 
247 
249 
251 
252  protected: Ogre::Root *ogreRoot;
253 
254  protected: Ogre::SceneManager *ogreSceneManager;
255 
256  private: friend class OgreRenderEngine;
257  private: friend class OgreSceneExt;
258  };
259 
261  class OgreSceneExt : public SceneExt
262  {
265  public: OgreSceneExt(Scene *_scene);
266 
267  // Documentation inherited
268  public: virtual ObjectPtr CreateExt(const std::string &_type,
269  const std::string &_name = "") override;
270  };
271  }
272  }
273 }
274 #endif