Ignition Rendering

API Reference

4.1.0
Ogre2Scene.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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 IGNITION_RENDERING_OGRE2_OGRE2SCENE_HH_
18 #define IGNITION_RENDERING_OGRE2_OGRE2SCENE_HH_
19 
20 #include <memory>
21 #include <string>
22 
26 
27 #include "ignition/rendering/ogre2/Export.hh"
28 
29 namespace Ogre
30 {
31  class Root;
32  class SceneManager;
33 }
34 
35 namespace ignition
36 {
37  namespace rendering
38  {
39  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
40  //
41  // forward declaration
42  class Ogre2ScenePrivate;
43  //
45  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2Scene :
46  public BaseScene
47  {
51  protected: Ogre2Scene(unsigned int _id, const std::string &_name);
52 
54  public: virtual ~Ogre2Scene();
55 
56  // Documentation inherited.
57  public: virtual void Fini() override;
58 
59  // Documentation inherited.
60  public: virtual RenderEngine *Engine() const override;
61 
62  // Documentation inherited.
63  public: virtual VisualPtr RootVisual() const override;
64 
65  // Documentation inherited.
66  public: virtual math::Color AmbientLight() const override;
67 
68  // Documentation inherited.
69  public: virtual void SetAmbientLight(const math::Color &_color) override;
70 
71  // Documentation inherited
72  public: virtual void PreRender() override;
73 
74  // Documentation inherited
75  public: virtual void Clear() override;
76 
77  // Documentation inherited
78  public: virtual void Destroy() override;
79 
82  public: virtual Ogre::SceneManager *OgreSceneManager() const;
83 
90  public: void SetShadowsDirty(bool _dirty);
91 
96  public: bool ShadowsDirty() const;
98 
99  // Documentation inherited
100  protected: virtual bool LoadImpl() override;
101 
102  // Documentation inherited
103  protected: virtual bool InitImpl() override;
104 
105  // Documentation inherited
106  protected: virtual DirectionalLightPtr CreateDirectionalLightImpl(
107  unsigned int _id, const std::string &_name) override;
108 
109  // Documentation inherited
110  protected: virtual PointLightPtr CreatePointLightImpl(unsigned int _id,
111  const std::string &_name) override;
112 
113  // Documentation inherited
114  protected: virtual SpotLightPtr CreateSpotLightImpl(unsigned int _id,
115  const std::string &_name) override;
116 
117  // Documentation inherited
118  protected: virtual CameraPtr CreateCameraImpl(unsigned int _id,
119  const std::string &_name) override;
120 
121  // Documentation inherited
122  protected: virtual DepthCameraPtr CreateDepthCameraImpl(unsigned int _id,
123  const std::string &_name) override;
124 
125  // Documentation inherited
126  protected: virtual ThermalCameraPtr CreateThermalCameraImpl(
127  unsigned int _id, const std::string &_name) override;
128 
129  // Documentation inherited
130  protected: virtual GpuRaysPtr CreateGpuRaysImpl(unsigned int _id,
131  const std::string &_name) override;
132 
133  // Documentation inherited
134  protected: virtual VisualPtr CreateVisualImpl(unsigned int _id,
135  const std::string &_name) override;
136 
137  // Documentation inherited
138  protected: virtual ArrowVisualPtr CreateArrowVisualImpl(unsigned int _id,
139  const std::string &_name) override;
140 
141  // Documentation inherited
142  protected: virtual AxisVisualPtr CreateAxisVisualImpl(unsigned int _id,
143  const std::string &_name) override;
144 
145  // Documentation inherited
146  protected: virtual GizmoVisualPtr CreateGizmoVisualImpl(unsigned int _id,
147  const std::string &_name) override;
148 
149  // Documentation inherited
150  protected: virtual GeometryPtr CreateBoxImpl(unsigned int _id,
151  const std::string &_name) override;
152 
153  // Documentation inherited
154  protected: virtual GeometryPtr CreateConeImpl(unsigned int _id,
155  const std::string &_name) override;
156 
157  // Documentation inherited
158  protected: virtual GeometryPtr CreateCylinderImpl(unsigned int _id,
159  const std::string &_name) override;
160 
161  // Documentation inherited
162  protected: virtual GeometryPtr CreatePlaneImpl(unsigned int _id,
163  const std::string &_name) override;
164 
165  // Documentation inherited
166  protected: virtual GeometryPtr CreateSphereImpl(unsigned int _id,
167  const std::string &_name) override;
168 
173  protected: virtual MeshPtr CreateMeshImpl(unsigned int _id,
174  const std::string &_name, const std::string &_meshName);
175 
176  // Documentation inherited
177  protected: virtual MeshPtr CreateMeshImpl(unsigned int _id,
178  const std::string &_name, const MeshDescriptor &_desc)
179  override;
180 
181  // Documentation inherited
182  protected: virtual GridPtr CreateGridImpl(unsigned int _id,
183  const std::string &_name) override;
184 
185  // Documentation inherited
186  protected: virtual MarkerPtr CreateMarkerImpl(unsigned int _id,
187  const std::string &_name) override;
188 
189  // Documentation inherited
190  protected: virtual LidarVisualPtr CreateLidarVisualImpl(unsigned int _id,
191  const std::string &_name) override;
192 
193  // Documentation inherited
194  protected: virtual WireBoxPtr CreateWireBoxImpl(unsigned int _id,
195  const std::string &_name) override;
196 
197  // Documentation inherited
198  protected: virtual TextPtr CreateTextImpl(unsigned int _id,
199  const std::string &_name) override;
200 
201  protected: virtual MaterialPtr CreateMaterialImpl(unsigned int _id,
202  const std::string &_name) override;
203 
204  protected: virtual RenderTexturePtr CreateRenderTextureImpl(
205  unsigned int _id, const std::string &_name) override;
206 
207  // Documentation inherited.
208  protected: virtual RenderWindowPtr CreateRenderWindowImpl(
209  unsigned int _id, const std::string &_name) override;
210 
211  // Documentation inherited
212  protected: virtual RayQueryPtr CreateRayQueryImpl(
213  unsigned int _id, const std::string &_name) override;
214 
215  // Documentation inherited
216  protected: virtual ParticleEmitterPtr CreateParticleEmitterImpl(
217  unsigned int _id, const std::string &_name) override;
218 
223  protected: virtual bool InitObject(Ogre2ObjectPtr _object,
224  unsigned int _id, const std::string &_name);
225 
226  // Documentation inherited
227  protected: virtual LightStorePtr Lights() const override;
228 
229  // Documentation inherited
230  protected: virtual SensorStorePtr Sensors() const override;
231 
232  // Documentation inherited
233  protected: virtual VisualStorePtr Visuals() const override;
234 
235  // Documentation inherited
236  protected: virtual MaterialMapPtr Materials() const override;
237 
239  private: void CreateContext();
240 
242  private: void CreateRootVisual();
243 
245  private: void CreateMeshFactory();
246 
248  private: void CreateStores();
249 
251  private: Ogre2ScenePtr SharedThis();
252 
255 
258 
261 
264 
267 
270 
272  protected: Ogre::SceneManager *ogreSceneManager = nullptr;
273 
275  private: std::unique_ptr<Ogre2ScenePrivate> dataPtr;
276 
278  private: friend class Ogre2RenderEngine;
279  };
280  }
281  }
282 }
283 #endif
Ogre2LightStorePtr lights
A list of ogre lights.
Definition: Ogre2Scene.hh:266
Describes how a Mesh should be loaded.
Definition: MeshDescriptor.hh:44
Ogre2.x implementation of the scene class.
Definition: Ogre2Scene.hh:45
Ogre2VisualStorePtr visuals
A list of ogre visuals.
Definition: Ogre2Scene.hh:263
STL class.
Ogre2SensorStorePtr sensors
A list of ogre sensors, e.g. cameras.
Definition: Ogre2Scene.hh:260
Ogre2 render engine class. A singleton class that manages the underlying ogre2 render engine...
Definition: Ogre2RenderEngine.hh:74
Definition: BaseScene.hh:36
Ogre2VisualPtr rootVisual
Root visual in the scene.
Definition: Ogre2Scene.hh:254
Ogre2MeshFactoryPtr meshFactory
Mesh factory for generating ogre meshes.
Definition: Ogre2Scene.hh:257
Definition: OgreCamera.hh:27
An abstract interface to a concrete render-engine. A RenderEngine is responsible for initializing a r...
Definition: RenderEngine.hh:36
Ogre2MaterialMapPtr materials
A list of ogre materials.
Definition: Ogre2Scene.hh:269