Ignition Rendering

API Reference

5.0.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 // This disables warning messages for OGRE
30 #ifndef _MSC_VER
31  #pragma GCC system_header
32 #else
33  #pragma warning(push, 0)
34 #endif
35 #include <Compositor/OgreCompositorShadowNode.h>
36 #ifdef _MSC_VER
37  #pragma warning(pop)
38 #endif
39 
40 namespace Ogre
41 {
42  class Root;
43  class SceneManager;
44 }
45 
46 namespace ignition
47 {
48  namespace rendering
49  {
50  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
51  //
52  // forward declaration
53  class Ogre2ScenePrivate;
54  //
56  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2Scene :
57  public BaseScene
58  {
62  protected: Ogre2Scene(unsigned int _id, const std::string &_name);
63 
65  public: virtual ~Ogre2Scene();
66 
67  // Documentation inherited.
68  public: virtual void Fini() override;
69 
70  // Documentation inherited.
71  public: virtual RenderEngine *Engine() const override;
72 
73  // Documentation inherited.
74  public: virtual VisualPtr RootVisual() const override;
75 
76  // Documentation inherited.
77  public: virtual math::Color AmbientLight() const override;
78 
79  // Documentation inherited.
80  public: virtual void SetAmbientLight(const math::Color &_color) override;
81 
82  // Documentation inherited
83  public: virtual void PreRender() override;
84 
85  // Documentation inherited
86  public: virtual void Clear() override;
87 
88  // Documentation inherited
89  public: virtual void Destroy() override;
90 
91  // Documentation inherited
92  public: virtual void SetSkyEnabled(bool _enabled) override;
93 
94  // Documentation inherited
95  public: virtual bool SkyEnabled() const override;
96 
99  public: virtual Ogre::SceneManager *OgreSceneManager() const;
100 
107  public: void SetShadowsDirty(bool _dirty);
108 
113  public: bool ShadowsDirty() const;
115 
116  // Documentation inherited
117  protected: virtual bool LoadImpl() override;
118 
119  // Documentation inherited
120  protected: virtual bool InitImpl() override;
121 
122  // Documentation inherited
123  protected: virtual LightVisualPtr CreateLightVisualImpl(unsigned int _id,
124  const std::string &_name) override;
125 
126  // Documentation inherited
127  protected: virtual DirectionalLightPtr CreateDirectionalLightImpl(
128  unsigned int _id, const std::string &_name) override;
129 
130  // Documentation inherited
131  protected: virtual PointLightPtr CreatePointLightImpl(unsigned int _id,
132  const std::string &_name) override;
133 
134  // Documentation inherited
135  protected: virtual SpotLightPtr CreateSpotLightImpl(unsigned int _id,
136  const std::string &_name) override;
137 
138  // Documentation inherited
139  protected: virtual CameraPtr CreateCameraImpl(unsigned int _id,
140  const std::string &_name) override;
141 
142  // Documentation inherited
143  protected: virtual DepthCameraPtr CreateDepthCameraImpl(unsigned int _id,
144  const std::string &_name) override;
145 
146  // Documentation inherited
147  protected: virtual ThermalCameraPtr CreateThermalCameraImpl(
148  unsigned int _id, const std::string &_name) override;
149 
150  // Documentation inherited
151  protected: virtual GpuRaysPtr CreateGpuRaysImpl(unsigned int _id,
152  const std::string &_name) override;
153 
154  // Documentation inherited
155  protected: virtual VisualPtr CreateVisualImpl(unsigned int _id,
156  const std::string &_name) override;
157 
158  // Documentation inherited
159  protected: virtual ArrowVisualPtr CreateArrowVisualImpl(unsigned int _id,
160  const std::string &_name) override;
161 
162  // Documentation inherited
163  protected: virtual AxisVisualPtr CreateAxisVisualImpl(unsigned int _id,
164  const std::string &_name) override;
165 
166  // Documentation inherited
167  protected: virtual GizmoVisualPtr CreateGizmoVisualImpl(unsigned int _id,
168  const std::string &_name) override;
169 
170  // Documentation inherited
171  protected: virtual GeometryPtr CreateBoxImpl(unsigned int _id,
172  const std::string &_name) override;
173 
174  // Documentation inherited
175  protected: virtual GeometryPtr CreateConeImpl(unsigned int _id,
176  const std::string &_name) override;
177 
178  // Documentation inherited
179  protected: virtual GeometryPtr CreateCylinderImpl(unsigned int _id,
180  const std::string &_name) override;
181 
182  // Documentation inherited
183  protected: virtual GeometryPtr CreatePlaneImpl(unsigned int _id,
184  const std::string &_name) override;
185 
186  // Documentation inherited
187  protected: virtual GeometryPtr CreateSphereImpl(unsigned int _id,
188  const std::string &_name) override;
189 
194  protected: virtual MeshPtr CreateMeshImpl(unsigned int _id,
195  const std::string &_name, const std::string &_meshName);
196 
197  // Documentation inherited
198  protected: virtual MeshPtr CreateMeshImpl(unsigned int _id,
199  const std::string &_name, const MeshDescriptor &_desc)
200  override;
201 
202  // Documentation inherited
203  protected: virtual CapsulePtr CreateCapsuleImpl(unsigned int _id,
204  const std::string &_name) override;
205 
206  protected: virtual HeightmapPtr CreateHeightmapImpl(unsigned int _id,
207  const std::string &_name, const HeightmapDescriptor &_desc)
208  override;
209 
210  // Documentation inherited
211  protected: virtual GridPtr CreateGridImpl(unsigned int _id,
212  const std::string &_name) override;
213 
214  // Documentation inherited
215  protected: virtual MarkerPtr CreateMarkerImpl(unsigned int _id,
216  const std::string &_name) override;
217 
218  // Documentation inherited
219  protected: virtual LidarVisualPtr CreateLidarVisualImpl(unsigned int _id,
220  const std::string &_name) override;
221 
222  // Documentation inherited
223  protected: virtual WireBoxPtr CreateWireBoxImpl(unsigned int _id,
224  const std::string &_name) override;
225 
226  // Documentation inherited
227  protected: virtual TextPtr CreateTextImpl(unsigned int _id,
228  const std::string &_name) override;
229 
230  protected: virtual MaterialPtr CreateMaterialImpl(unsigned int _id,
231  const std::string &_name) override;
232 
233  protected: virtual RenderTexturePtr CreateRenderTextureImpl(
234  unsigned int _id, const std::string &_name) override;
235 
236  // Documentation inherited.
237  protected: virtual RenderWindowPtr CreateRenderWindowImpl(
238  unsigned int _id, const std::string &_name) override;
239 
240  // Documentation inherited
241  protected: virtual RayQueryPtr CreateRayQueryImpl(
242  unsigned int _id, const std::string &_name) override;
243 
244  // Documentation inherited
245  protected: virtual ParticleEmitterPtr CreateParticleEmitterImpl(
246  unsigned int _id, const std::string &_name) override;
247 
252  protected: virtual bool InitObject(Ogre2ObjectPtr _object,
253  unsigned int _id, const std::string &_name);
254 
257  protected: void UpdateShadowNode();
258 
272  private: void CreateShadowNodeWithSettings(
273  Ogre::CompositorManager2 *_compositorManager,
274  const std::string &_shadowNodeName,
275  const Ogre::ShadowNodeHelper::ShadowParamVec &_shadowParams);
276 
277  // Documentation inherited
278  protected: virtual LightStorePtr Lights() const override;
279 
280  // Documentation inherited
281  protected: virtual SensorStorePtr Sensors() const override;
282 
283  // Documentation inherited
284  protected: virtual VisualStorePtr Visuals() const override;
285 
286  // Documentation inherited
287  protected: virtual MaterialMapPtr Materials() const override;
288 
290  private: void CreateContext();
291 
293  private: void CreateRootVisual();
294 
296  private: void CreateMeshFactory();
297 
299  private: void CreateStores();
300 
302  private: Ogre2ScenePtr SharedThis();
303 
306 
309 
312 
315 
318 
321 
323  protected: Ogre::SceneManager *ogreSceneManager = nullptr;
324 
326  private: std::unique_ptr<Ogre2ScenePrivate> dataPtr;
327 
329  private: friend class Ogre2RenderEngine;
330  };
331  }
332  }
333 }
334 #endif
Ogre2LightStorePtr lights
A list of ogre lights.
Definition: Ogre2Scene.hh:317
Describes how a Mesh should be loaded.
Definition: MeshDescriptor.hh:44
Ogre2.x implementation of the scene class.
Definition: Ogre2Scene.hh:56
Ogre2VisualStorePtr visuals
A list of ogre visuals.
Definition: Ogre2Scene.hh:314
STL class.
Ogre2SensorStorePtr sensors
A list of ogre sensors, e.g. cameras.
Definition: Ogre2Scene.hh:311
Ogre2 render engine class. A singleton class that manages the underlying ogre2 render engine...
Definition: Ogre2RenderEngine.hh:74
Definition: BaseScene.hh:37
Ogre2VisualPtr rootVisual
Root visual in the scene.
Definition: Ogre2Scene.hh:305
Ogre2MeshFactoryPtr meshFactory
Mesh factory for generating ogre meshes.
Definition: Ogre2Scene.hh:308
Describes how a Heightmap should be loaded.
Definition: HeightmapDescriptor.hh:146
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:320