Gazebo Rendering

API Reference

6.6.3
gz/rendering/base/BaseScene.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_BASE_BASESCENE_HH_
18 #define GZ_RENDERING_BASE_BASESCENE_HH_
19 
20 #include <array>
21 #include <set>
22 #include <string>
23 
24 #include <gz/common/Console.hh>
25 #include <gz/common/SuppressWarning.hh>
26 
28 #include "gz/rendering/Scene.hh"
30 
31 namespace ignition
32 {
33  namespace rendering
34  {
35  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
36  //
37  class IGNITION_RENDERING_VISIBLE BaseScene :
39  public std::enable_shared_from_this<BaseScene>,
41  public virtual Scene
42  {
43  protected: BaseScene(unsigned int _id, const std::string &_name);
44 
45  public: virtual ~BaseScene();
46 
47  public: virtual void Load() override;
48 
49  public: virtual void Init() override;
50 
51  public: virtual void Fini() override;
52 
53  public: virtual bool IsLoaded() const;
54 
55  public: virtual bool IsInitialized() const override;
56 
57  public: virtual unsigned int Id() const override;
58 
59  public: virtual std::string Name() const override;
60 
61  public: virtual void IGN_DEPRECATED(4)
62  SetSimTime(const common::Time &_time) override;
63 
64  public: virtual common::Time IGN_DEPRECATED(4) SimTime() const override;
65 
66  public: virtual std::chrono::steady_clock::duration Time()
67  const override;
68 
69  public: virtual void SetTime(
70  const std::chrono::steady_clock::duration &_time) override;
71 
72  public: virtual void SetAmbientLight(double _r, double _g, double _b,
73  double _a = 1.0) override;
74 
75  public: virtual void SetAmbientLight(const math::Color &_color)
76  override = 0;
77 
78  public: virtual math::Color BackgroundColor() const override;
79 
80  public: virtual void SetBackgroundColor(double _r, double _g, double _b,
81  double _a = 1.0) override;
82 
83  public: virtual void SetBackgroundColor(const math::Color &_color)
84  override;
85 
86  // Documentation inherited.
87  public: virtual bool IsGradientBackgroundColor() const override;
88 
89  // Documentation inherited.
90  public: virtual std::array<math::Color, 4> GradientBackgroundColor()
91  const override;
92 
93  // Documentation inherited.
94  public: virtual void SetGradientBackgroundColor(
95  const std::array<math::Color, 4> &_colors) override;
96 
97  // Documentation inherited.
98  public: virtual void RemoveGradientBackgroundColor() override;
99 
100  // Documentation inherited.
101  public: virtual MaterialPtr BackgroundMaterial() const override;
102 
103  // Documentation inherited.
104  public: virtual void SetBackgroundMaterial(MaterialPtr _material)
105  override;
106 
107  public: virtual unsigned int NodeCount() const override;
108 
109  public: virtual bool HasNode(ConstNodePtr _node) const override;
110 
111  public: virtual bool HasNodeId(unsigned int _id) const override;
112 
113  public: virtual bool HasNodeName(const std::string &_name) const override;
114 
115  public: virtual NodePtr NodeById(unsigned int _id) const override;
116 
117  public: virtual NodePtr NodeByName(const std::string &_name) const
118  override;
119 
120  public: virtual NodePtr NodeByIndex(unsigned int _index) const override;
121 
122  // Documentation inherited.
123  public: virtual void DestroyNode(NodePtr _node, bool _recursive = false)
124  override;
125 
126  public: virtual void DestroyNodeById(unsigned int _id) override;
127 
128  public: virtual void DestroyNodeByName(const std::string &_name) override;
129 
130  public: virtual void DestroyNodeByIndex(unsigned int _index) override;
131 
132  public: virtual void DestroyNodes() override;
133 
134  public: virtual unsigned int LightCount() const override;
135 
136  public: virtual bool HasLight(ConstLightPtr _light) const override;
137 
138  public: virtual bool HasLightId(unsigned int _id) const override;
139 
140  public: virtual bool HasLightName(const std::string &_name) const
141  override;
142 
143  public: virtual LightPtr LightById(unsigned int _id) const override;
144 
145  public: virtual LightPtr LightByName(const std::string &_name) const
146  override;
147 
148  public: virtual LightPtr LightByIndex(unsigned int _index) const override;
149 
150  // Documentation inherited.
151  public: virtual void DestroyLight(LightPtr _light,
152  bool _recursive = false) override;
153 
154  public: virtual void DestroyLightById(unsigned int _id) override;
155 
156  public: virtual void DestroyLightByName(const std::string &_name)
157  override;
158 
159  public: virtual void DestroyLightByIndex(unsigned int _index) override;
160 
161  public: virtual void DestroyLights() override;
162 
163  public: virtual unsigned int SensorCount() const override;
164 
165  public: virtual bool HasSensor(ConstSensorPtr _sensor) const override;
166 
167  public: virtual bool HasSensorId(unsigned int _id) const override;
168 
169  public: virtual bool HasSensorName(const std::string &_name) const
170  override;
171 
172  public: virtual SensorPtr SensorById(unsigned int _id) const override;
173 
174  public: virtual SensorPtr SensorByName(const std::string &_name) const
175  override;
176 
177  public: virtual SensorPtr SensorByIndex(unsigned int _index) const
178  override;
179 
180  // Documentation inherited.
181  public: virtual void DestroySensor(SensorPtr _sensor,
182  bool _recursive = false) override;
183 
184  public: virtual void DestroySensorById(unsigned int _id) override;
185 
186  public: virtual void DestroySensorByName(const std::string &_name)
187  override;
188 
189  public: virtual void DestroySensorByIndex(unsigned int _index) override;
190 
191  public: virtual void DestroySensors() override;
192 
193  public: virtual unsigned int VisualCount() const override;
194 
195  public: virtual bool HasVisual(ConstVisualPtr _visual) const override;
196 
197  public: virtual bool HasVisualId(unsigned int _id) const override;
198 
199  public: virtual bool HasVisualName(const std::string &_name) const
200  override;
201 
202  public: virtual VisualPtr VisualById(unsigned int _id) const override;
203 
204  public: virtual VisualPtr VisualByName(const std::string &_name) const
205  override;
206 
207  public: virtual VisualPtr VisualByIndex(unsigned int _index) const
208  override;
209 
210  // Documentation inherited
211  public: virtual VisualPtr VisualAt(const CameraPtr &_camera,
212  const gz::math::Vector2i &_mousePos) override;
213 
214  // Documentation inherited.
215  public: virtual void DestroyVisual(VisualPtr _visual,
216  bool _recursive = false) override;
217 
218  public: virtual void DestroyVisualById(unsigned int _id) override;
219 
220  public: virtual void DestroyVisualByName(const std::string &_name)
221  override;
222 
223  public: virtual void DestroyVisualByIndex(unsigned int _index) override;
224 
225  public: virtual void DestroyVisuals() override;
226 
227  public: virtual bool MaterialRegistered(const std::string &_name) const
228  override;
229 
230  public: virtual MaterialPtr Material(const std::string &_name) const
231  override;
232 
233  public: virtual void RegisterMaterial(const std::string &_name,
234  MaterialPtr _material) override;
235 
236  public: virtual void UnregisterMaterial(const std::string &_name)
237  override;
238 
239  public: virtual void UnregisterMaterials() override;
240 
241  // Documentation inherited
242  public: virtual void DestroyMaterial(MaterialPtr _material) override;
243 
244  // Documentation inherited
245  public: virtual void DestroyMaterials() override;
246 
247  public: virtual DirectionalLightPtr CreateDirectionalLight() override;
248 
249  public: virtual DirectionalLightPtr CreateDirectionalLight(
250  unsigned int _id) override;
251 
252  public: virtual DirectionalLightPtr CreateDirectionalLight(
253  const std::string &_name) override;
254 
255  public: virtual DirectionalLightPtr CreateDirectionalLight(
256  unsigned int _id, const std::string &_name) override;
257 
258  public: virtual PointLightPtr CreatePointLight() override;
259 
260  public: virtual PointLightPtr CreatePointLight(unsigned int _id) override;
261 
262  public: virtual PointLightPtr CreatePointLight(const std::string &_name)
263  override;
264 
265  public: virtual PointLightPtr CreatePointLight(unsigned int _id,
266  const std::string &_name) override;
267 
272  protected: virtual COMVisualPtr CreateCOMVisualImpl(unsigned int _id,
273  const std::string &_name) = 0;
274 
279  protected: virtual InertiaVisualPtr CreateInertiaVisualImpl(
280  unsigned int _id, const std::string &_name) = 0;
281 
286  protected: virtual JointVisualPtr CreateJointVisualImpl(unsigned int _id,
287  const std::string &_name) = 0;
288 
293  protected: virtual LightVisualPtr CreateLightVisualImpl(unsigned int _id,
294  const std::string &_name) = 0;
295 
296  public: virtual SpotLightPtr CreateSpotLight() override;
297 
298  public: virtual SpotLightPtr CreateSpotLight(unsigned int _id) override;
299 
300  public: virtual SpotLightPtr CreateSpotLight(const std::string &_name)
301  override;
302 
303  public: virtual SpotLightPtr CreateSpotLight(unsigned int _id,
304  const std::string &_name) override;
305 
306  public: virtual CameraPtr CreateCamera() override;
307 
308  public: virtual CameraPtr CreateCamera(unsigned int _id) override;
309 
310  public: virtual CameraPtr CreateCamera(const std::string &_name) override;
311 
312  public: virtual CameraPtr CreateCamera(unsigned int _id,
313  const std::string &_name) override;
314 
315  public: virtual DepthCameraPtr CreateDepthCamera() override;
316 
317  public: virtual DepthCameraPtr CreateDepthCamera(const unsigned int _id)
318  override;
319 
320  public: virtual DepthCameraPtr CreateDepthCamera(
321  const std::string &_name) override;
322 
323  public: virtual DepthCameraPtr CreateDepthCamera(const unsigned int _id,
324  const std::string &_name) override;
325 
326  // Documentation inherited.
327  public: virtual ThermalCameraPtr CreateThermalCamera() override;
328 
329  // Documentation inherited.
330  public: virtual ThermalCameraPtr CreateThermalCamera(
331  const unsigned int _id) override;
332 
333  // Documentation inherited.
334  public: virtual ThermalCameraPtr CreateThermalCamera(
335  const std::string &_name) override;
336 
337  // Documentation inherited.
338  public: virtual ThermalCameraPtr CreateThermalCamera(
339  const unsigned int _id, const std::string &_name) override;
340 
341  // Documentation inherited.
342  public: virtual BoundingBoxCameraPtr CreateBoundingBoxCamera() override;
343 
344  // Documentation inherited.
345  public: virtual BoundingBoxCameraPtr CreateBoundingBoxCamera(
346  const unsigned int _id) override;
347 
348  // Documentation inherited.
349  public: virtual BoundingBoxCameraPtr CreateBoundingBoxCamera(
350  const std::string &_name) override;
351 
352  // Documentation inherited.
353  public: virtual BoundingBoxCameraPtr CreateBoundingBoxCamera(
354  const unsigned int _id, const std::string &_name) override;
355 
356  // Documentation inherited.
357  public: virtual SegmentationCameraPtr CreateSegmentationCamera() override;
358 
359  // Documentation inherited.
360  public: virtual SegmentationCameraPtr CreateSegmentationCamera(
361  const unsigned int _id) override;
362 
363  // Documentation inherited.
364  public: virtual SegmentationCameraPtr CreateSegmentationCamera(
365  const std::string &_name) override;
366 
367  // Documentation inherited.
368  public: virtual SegmentationCameraPtr CreateSegmentationCamera(
369  const unsigned int _id, const std::string &_name) override;
370 
371  // Documentation inherited.
372  public: virtual GpuRaysPtr CreateGpuRays() override;
373 
374  // Documentation inherited.
375  public: virtual GpuRaysPtr CreateGpuRays(const unsigned int _id) override;
376 
377  // Documentation inherited.
378  public: virtual GpuRaysPtr CreateGpuRays(
379  const std::string &_name) override;
380 
381  // Documentation inherited.
382  public: virtual GpuRaysPtr CreateGpuRays(const unsigned int _id,
383  const std::string &_name) override;
384 
385  public: virtual VisualPtr CreateVisual() override;
386 
387  public: virtual VisualPtr CreateVisual(unsigned int _id) override;
388 
389  public: virtual VisualPtr CreateVisual(const std::string &_name) override;
390 
391  public: virtual VisualPtr CreateVisual(unsigned int _id,
392  const std::string &_name) override;
393 
394  public: virtual ArrowVisualPtr CreateArrowVisual() override;
395 
396  public: virtual ArrowVisualPtr CreateArrowVisual(unsigned int _id)
397  override;
398 
399  public: virtual ArrowVisualPtr CreateArrowVisual(
400  const std::string &_name) override;
401 
402  public: virtual ArrowVisualPtr CreateArrowVisual(unsigned int _id,
403  const std::string &_name) override;
404 
405  public: virtual AxisVisualPtr CreateAxisVisual() override;
406 
407  public: virtual AxisVisualPtr CreateAxisVisual(unsigned int _id) override;
408 
409  public: virtual AxisVisualPtr CreateAxisVisual(const std::string &_name)
410  override;
411 
412  public: virtual AxisVisualPtr CreateAxisVisual(unsigned int _id,
413  const std::string &_name) override;
414 
415  // Documentation inherited
416  public: virtual COMVisualPtr CreateCOMVisual() override;
417 
418  // Documentation inherited
419  public: virtual COMVisualPtr CreateCOMVisual(unsigned int _id)
420  override;
421 
422  // Documentation inherited
423  public: virtual COMVisualPtr CreateCOMVisual(const std::string &_name)
424  override;
425 
426  // Documentation inherited
427  public: virtual COMVisualPtr CreateCOMVisual(unsigned int _id,
428  const std::string &_name) override;
429 
430  public: virtual InertiaVisualPtr CreateInertiaVisual() override;
431 
432  // Documentation inherited
433  public: virtual InertiaVisualPtr CreateInertiaVisual(unsigned int _id)
434  override;
435 
436  // Documentation inherited
437  public: virtual InertiaVisualPtr CreateInertiaVisual(
438  const std::string &_name) override;
439 
440  // Documentation inherited
441  public: virtual InertiaVisualPtr CreateInertiaVisual(unsigned int _id,
442  const std::string &_name) override;
443 
444  // Documentation inherited
445  public: virtual JointVisualPtr CreateJointVisual() override;
446 
447  // Documentation inherited
448  public: virtual JointVisualPtr CreateJointVisual(unsigned int _id)
449  override;
450 
451  // Documentation inherited
452  public: virtual JointVisualPtr CreateJointVisual(
453  const std::string &_name) override;
454 
455  // Documentation inherited
456  public: virtual JointVisualPtr CreateJointVisual(unsigned int _id,
457  const std::string &_name) override;
458 
459  // Documentation inherited
460  public: virtual LightVisualPtr CreateLightVisual() override;
461 
462  // Documentation inherited
463  public: virtual LightVisualPtr CreateLightVisual(unsigned int _id)
464  override;
465 
466  // Documentation inherited
467  public: virtual LightVisualPtr CreateLightVisual(const std::string &_name)
468  override;
469 
470  // Documentation inherited
471  public: virtual LightVisualPtr CreateLightVisual(unsigned int _id,
472  const std::string &_name) override;
473 
474  // Documentation inherited
475  public: virtual GizmoVisualPtr CreateGizmoVisual() override;
476 
477  // Documentation inherited
478  public: virtual GizmoVisualPtr CreateGizmoVisual(unsigned int _id)
479  override;
480 
481  // Documentation inherited
482  public: virtual GizmoVisualPtr CreateGizmoVisual(const std::string &_name)
483  override;
484 
485  // Documentation inherited
486  public: virtual GizmoVisualPtr CreateGizmoVisual(unsigned int _id,
487  const std::string &_name) override;
488 
489 
490  public: virtual GeometryPtr CreateBox() override;
491 
492  public: virtual GeometryPtr CreateCone() override;
493 
494  public: virtual GeometryPtr CreateCylinder() override;
495 
496  public: virtual GeometryPtr CreatePlane() override;
497 
498  public: virtual GeometryPtr CreateSphere() override;
499 
500  public: virtual MeshPtr CreateMesh(const std::string &_meshName) override;
501 
502  public: virtual MeshPtr CreateMesh(const common::Mesh *_mesh) override;
503 
504  public: virtual MeshPtr CreateMesh(const MeshDescriptor &_desc) override;
505 
506  // Documentation inherited.
507  public: virtual CapsulePtr CreateCapsule() override;
508 
509  // Documentation inherited.
510  public: virtual GridPtr CreateGrid() override;
511 
512  // Documentation inherited.
513  public: virtual MarkerPtr CreateMarker() override;
514 
515  // Documentation inherited.
516  public: virtual LidarVisualPtr CreateLidarVisual() override;
517 
518  // Documentation inherited.
519  public: virtual LidarVisualPtr CreateLidarVisual(
520  unsigned int _id) override;
521 
522  // Documentation inherited.
523  public: virtual LidarVisualPtr CreateLidarVisual(
524  const std::string &_name) override;
525 
526  // Documentation inherited.
527  public: virtual LidarVisualPtr CreateLidarVisual(unsigned int _id,
528  const std::string &_name) override;
529 
530  // Documentation inherited.
531  public: virtual HeightmapPtr CreateHeightmap(
532  const HeightmapDescriptor &_desc) override;
533 
534  // Documentation inherited.
535  public: virtual WireBoxPtr CreateWireBox() override;
536 
537  // Documentation inherited.
538  public: virtual TextPtr CreateText() override;
539 
540  public: virtual MaterialPtr CreateMaterial(const std::string &_name = "")
541  override;
542 
543  public: virtual MaterialPtr CreateMaterial(
544  const common::Material &_material) override;
545 
546  public: virtual RenderTexturePtr CreateRenderTexture() override;
547 
548  // Documentation inherited.
549  public: virtual RenderWindowPtr CreateRenderWindow() override;
550 
551  public: virtual RayQueryPtr CreateRayQuery() override;
552 
553  // Documentation inherited.
554  public: virtual ParticleEmitterPtr CreateParticleEmitter() override;
555 
556  // Documentation inherited.
557  public: virtual ParticleEmitterPtr CreateParticleEmitter(unsigned int _id)
558  override;
559 
560  // Documentation inherited.
561  public: virtual ParticleEmitterPtr CreateParticleEmitter(
562  const std::string &_name) override;
563 
564  // Documentation inherited.
565  public: virtual ParticleEmitterPtr CreateParticleEmitter(
566  unsigned int _id, const std::string &_name) override;
567 
568  // Documentation inherited.
569  public: virtual void SetSkyEnabled(bool _enabled) override;
570 
571  // Documentation inherited.
572  public: virtual bool SkyEnabled() const override;
573 
574  public: virtual void PreRender() override;
575 
576  public: virtual void Clear() override;
577 
578  public: virtual void Destroy() override;
579 
580  // Documentation inherited.
581  public: virtual void PostRender() override;
582 
583  // Documentation inherited.
584  public: virtual void SetCameraPassCountPerGpuFlush(
585  uint8_t _numPass) override;
586 
587  // Documentation inherited.
588  public: virtual uint8_t CameraPassCountPerGpuFlush() const override;
589 
590  // Documentation inherited.
591  public: virtual bool LegacyAutoGpuFlush() const override;
592 
593  protected: virtual unsigned int CreateObjectId();
594 
595  protected: virtual std::string CreateObjectName(unsigned int _id,
596  const std::string &_prefix);
597 
598  protected: virtual bool RegisterLight(LightPtr _light);
599 
600  protected: virtual bool RegisterSensor(SensorPtr _vensor);
601 
602  protected: virtual bool RegisterVisual(VisualPtr _visual);
603 
604  protected: virtual DirectionalLightPtr CreateDirectionalLightImpl(
605  unsigned int _id, const std::string &_name) = 0;
606 
607  protected: virtual PointLightPtr CreatePointLightImpl(unsigned int _id,
608  const std::string &_name) = 0;
609 
610  protected: virtual SpotLightPtr CreateSpotLightImpl(unsigned int _id,
611  const std::string &_name) = 0;
612 
613  protected: virtual CameraPtr CreateCameraImpl(unsigned int _id,
614  const std::string &_name) = 0;
615 
616  protected: virtual DepthCameraPtr CreateDepthCameraImpl(unsigned int _id,
617  const std::string &_name) = 0;
618 
623  unsigned int _id, const std::string &_name)
624  {
625  // The following two lines will avoid doxygen warnings
626  (void)_id;
627  (void)_name;
628  ignerr << "Thermal camera not supported by: "
629  << this->Engine()->Name() << std::endl;
630  return ThermalCameraPtr();
631  }
632 
638  unsigned int _id, const std::string &_name)
639  {
640  // The following two lines will avoid doxygen warnings
641  (void)_id;
642  (void)_name;
643  ignerr << "BoundingBox camera not supported by: "
644  << this->Engine()->Name() << std::endl;
645  return BoundingBoxCameraPtr();
646  }
647 
653  unsigned int _id,
654  const std::string &_name)
655  {
656  // The following two lines will avoid doxygen warnings
657  (void)_id;
658  (void)_name;
659  ignerr << "Segmentation camera not supported by: "
660  << this->Engine()->Name() << std::endl;
661  return SegmentationCameraPtr();
662  }
663 
667  protected: virtual GpuRaysPtr CreateGpuRaysImpl(unsigned int _id,
668  const std::string & _name)
669  {
670  (void)_id;
671  (void)_name;
672  ignerr << "GpuRays not supported by: "
673  << this->Engine()->Name() << std::endl;
674  return GpuRaysPtr();
675  }
676 
677  protected: virtual VisualPtr CreateVisualImpl(unsigned int _id,
678  const std::string &_name) = 0;
679 
680  protected: virtual ArrowVisualPtr CreateArrowVisualImpl(unsigned int _id,
681  const std::string &_name) = 0;
682 
683  protected: virtual AxisVisualPtr CreateAxisVisualImpl(unsigned int _id,
684  const std::string &_name) = 0;
685 
689  protected: virtual GizmoVisualPtr CreateGizmoVisualImpl(unsigned int _id,
690  const std::string &_name)
691  {
692  (void)_id;
693  (void)_name;
694  ignerr << "GizmoVisual not supported by: "
695  << this->Engine()->Name() << std::endl;
696  return GizmoVisualPtr();
697  }
698 
699  protected: virtual GeometryPtr CreateBoxImpl(unsigned int _id,
700  const std::string &_name) = 0;
701 
702  protected: virtual GeometryPtr CreateConeImpl(unsigned int _id,
703  const std::string &_name) = 0;
704 
705  protected: virtual GeometryPtr CreateCylinderImpl(unsigned int _id,
706  const std::string &_name) = 0;
707 
708  protected: virtual GeometryPtr CreatePlaneImpl(unsigned int _id,
709  const std::string &_name) = 0;
710 
711  protected: virtual GeometryPtr CreateSphereImpl(unsigned int _id,
712  const std::string &_name) = 0;
713 
714  protected: virtual MeshPtr CreateMeshImpl(unsigned int _id,
715  const std::string &_name,
716  const MeshDescriptor &_desc) = 0;
717 
722  protected: virtual CapsulePtr CreateCapsuleImpl(unsigned int _id,
723  const std::string &_name) = 0;
724 
729  protected: virtual GridPtr CreateGridImpl(unsigned int _id,
730  const std::string &_name) = 0;
731 
736  protected: virtual MarkerPtr CreateMarkerImpl(unsigned int _id,
737  const std::string &_name) = 0;
738 
743  protected: virtual LidarVisualPtr CreateLidarVisualImpl(unsigned int _id,
744  const std::string &_name) = 0;
745 
751  protected: virtual HeightmapPtr CreateHeightmapImpl(unsigned int _id,
752  const std::string &_name,
753  const HeightmapDescriptor &_desc) = 0;
754 
759  protected: virtual WireBoxPtr CreateWireBoxImpl(unsigned int _id,
760  const std::string &_name) = 0;
761 
766  protected: virtual TextPtr CreateTextImpl(unsigned int _id,
767  const std::string &_name);
768 
769  protected: virtual MaterialPtr CreateMaterialImpl(unsigned int _id,
770  const std::string &_name) = 0;
771 
772  protected: virtual RenderTexturePtr CreateRenderTextureImpl(
773  unsigned int _id, const std::string &_name) = 0;
774 
780  protected: virtual RenderWindowPtr CreateRenderWindowImpl(
781  unsigned int _id, const std::string &_name) = 0;
782 
783  protected: virtual RayQueryPtr CreateRayQueryImpl(
784  unsigned int _id, const std::string &_name) = 0;
785 
791  unsigned int _id, const std::string &_name)
792  {
793  (void)_id;
794  (void)_name;
795  ignerr << "ParticleEmitter not supported by: "
796  << this->Engine()->Name() << std::endl;
797  return ParticleEmitterPtr();
798  }
799 
800  protected: virtual LightStorePtr Lights() const = 0;
801 
802  protected: virtual SensorStorePtr Sensors() const = 0;
803 
804  protected: virtual VisualStorePtr Visuals() const = 0;
805 
806  protected: virtual MaterialMapPtr Materials() const = 0;
807 
808  protected: virtual bool LoadImpl() = 0;
809 
810  protected: virtual bool InitImpl() = 0;
811 
812  private: virtual void CreateNodeStore();
813 
814  private: virtual void CreateMaterials();
815 
821  private: void DestroyNodeRecursive(NodePtr _node,
822  std::set<unsigned int> &_nodeIds);
823 
824  protected: unsigned int id;
825 
827  protected: std::string name;
829 
830  protected: common::Time IGN_DEPRECATED(4) simTime;
831 
832  protected: std::chrono::steady_clock::duration time =
833  std::chrono::steady_clock::duration::zero();
834 
835  protected: bool loaded;
836 
837  protected: bool initialized;
838 
840  protected: math::Color backgroundColor;
841 
849  protected: std::array<math::Color, 4> gradientBackgroundColor;
850 
852  protected: bool isGradientBackgroundColor = false;
853 
855  protected: MaterialPtr backgroundMaterial;
856 
857  private: unsigned int nextObjectId;
858 
859  IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
860  private: NodeStorePtr nodes;
861  IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
862  };
863  }
864  }
865 }
866 #endif
virtual PointLightPtr CreatePointLightImpl(unsigned int _id, const std::string &_name)=0
virtual void DestroyLight(LightPtr _light, bool _recursive=false) override
std::chrono::steady_clock::duration time
Definition: gz/rendering/base/BaseScene.hh:832
virtual void DestroyVisualByIndex(unsigned int _index) override
virtual MaterialPtr Material(const std::string &_name) const override
virtual SensorStorePtr Sensors() const =0
virtual LidarVisualPtr CreateLidarVisual() override
virtual BoundingBoxCameraPtr CreateBoundingBoxCameraImpl(unsigned int _id, const std::string &_name)
Implementation for creating a BoundingBox camera.
Definition: gz/rendering/base/BaseScene.hh:637
virtual AxisVisualPtr CreateAxisVisual() override
virtual SensorPtr SensorById(unsigned int _id) const override
virtual MaterialMapPtr Materials() const =0
shared_ptr< GpuRays > GpuRaysPtr
Shared pointer to GpuRays.
Definition: gz/rendering/RenderTypes.hh:127
STL class.
STL class.
virtual LightVisualPtr CreateLightVisualImpl(unsigned int _id, const std::string &_name)=0
Implementation for creating Light visual.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
virtual math::Color BackgroundColor() const override
virtual GeometryPtr CreateConeImpl(unsigned int _id, const std::string &_name)=0
virtual RayQueryPtr CreateRayQuery() override
virtual void DestroyNodeByIndex(unsigned int _index) override
Describes how a Heightmap should be loaded.
Definition: gz/rendering/HeightmapDescriptor.hh:146
virtual SensorPtr SensorByIndex(unsigned int _index) const override
Describes how a Mesh should be loaded.
Definition: gz/rendering/MeshDescriptor.hh:44
virtual MaterialPtr CreateMaterialImpl(unsigned int _id, const std::string &_name)=0
virtual std::string Name() const override
virtual bool HasLightName(const std::string &_name) const override
virtual SensorPtr SensorByName(const std::string &_name) const override
virtual void DestroySensor(SensorPtr _sensor, bool _recursive=false) override
virtual HeightmapPtr CreateHeightmap(const HeightmapDescriptor &_desc) override
virtual bool RegisterVisual(VisualPtr _visual)
virtual VisualPtr CreateVisual() override
virtual GeometryPtr CreatePlane() override
virtual bool HasSensor(ConstSensorPtr _sensor) const override
virtual void RegisterMaterial(const std::string &_name, MaterialPtr _material) override
virtual bool IsGradientBackgroundColor() const override
virtual RenderTexturePtr CreateRenderTexture() override
virtual bool HasSensorId(unsigned int _id) const override
virtual unsigned int Id() const override
virtual JointVisualPtr CreateJointVisualImpl(unsigned int _id, const std::string &_name)=0
Implementation for creating Joint visual.
virtual RenderTexturePtr CreateRenderTextureImpl(unsigned int _id, const std::string &_name)=0
virtual InertiaVisualPtr CreateInertiaVisualImpl(unsigned int _id, const std::string &_name)=0
Implementation for creating Inertia visual.
shared_ptr< ParticleEmitter > ParticleEmitterPtr
Shared pointer to ParticleEmitter.
Definition: gz/rendering/RenderTypes.hh:215
virtual LightPtr LightByName(const std::string &_name) const override
virtual WireBoxPtr CreateWireBox() override
virtual CapsulePtr CreateCapsuleImpl(unsigned int _id, const std::string &_name)=0
Implementation for creating a capsule geometry object.
virtual RayQueryPtr CreateRayQueryImpl(unsigned int _id, const std::string &_name)=0
virtual void DestroyNode(NodePtr _node, bool _recursive=false) override
virtual unsigned int VisualCount() const override
virtual bool HasLightId(unsigned int _id) const override
virtual void DestroyNodes() override
virtual void DestroySensors() override
virtual NodePtr NodeByIndex(unsigned int _index) const override
virtual GizmoVisualPtr CreateGizmoVisual() override
virtual bool LegacyAutoGpuFlush() const override
virtual VisualPtr VisualAt(const CameraPtr &_camera, const gz::math::Vector2i &_mousePos) override
virtual void Load() override
virtual COMVisualPtr CreateCOMVisualImpl(unsigned int _id, const std::string &_name)=0
Implementation for creating CoM visual.
virtual TextPtr CreateText() override
virtual DirectionalLightPtr CreateDirectionalLightImpl(unsigned int _id, const std::string &_name)=0
virtual GeometryPtr CreateBox() override
virtual void DestroyLightByName(const std::string &_name) override
virtual bool HasLight(ConstLightPtr _light) const override
virtual DepthCameraPtr CreateDepthCamera() override
virtual void SetGradientBackgroundColor(const std::array< math::Color, 4 > &_colors) override
virtual WireBoxPtr CreateWireBoxImpl(unsigned int _id, const std::string &_name)=0
Implementation for creating a wire box geometry.
virtual InertiaVisualPtr CreateInertiaVisual() override
virtual RenderWindowPtr CreateRenderWindowImpl(unsigned int _id, const std::string &_name)=0
Render engine specific implementation for creating a render window.
virtual bool HasNode(ConstNodePtr _node) const override
virtual std::chrono::steady_clock::duration Time() const override
virtual TextPtr CreateTextImpl(unsigned int _id, const std::string &_name)
Implementation for creating a text's geometry object.
virtual GeometryPtr CreateCylinder() override
#define ignerr
virtual unsigned int NodeCount() const override
virtual bool HasNodeName(const std::string &_name) const override
virtual MarkerPtr CreateMarker() override
Manages a single scene-graph. This class updates scene-wide properties and holds the root scene node....
Definition: gz/rendering/Scene.hh:49
virtual SpotLightPtr CreateSpotLightImpl(unsigned int _id, const std::string &_name)=0
virtual SegmentationCameraPtr CreateSegmentationCameraImpl(unsigned int _id, const std::string &_name)
Implementation for creating a segmentation camera.
Definition: gz/rendering/base/BaseScene.hh:652
virtual void DestroyVisualByName(const std::string &_name) override
virtual bool IsInitialized() const override
virtual std::array< math::Color, 4 > GradientBackgroundColor() const override
virtual SegmentationCameraPtr CreateSegmentationCamera() override
virtual bool RegisterLight(LightPtr _light)
virtual GeometryPtr CreateSphere() override
virtual void Fini() override
virtual void SetSkyEnabled(bool _enabled) override
virtual LightPtr LightByIndex(unsigned int _index) const override
virtual std::string CreateObjectName(unsigned int _id, const std::string &_prefix)
virtual void Clear() override
shared_ptr< BoundingBoxCamera > BoundingBoxCameraPtr
Shared pointer to BoundingBoxCamera.
Definition: gz/rendering/RenderTypes.hh:119
virtual GeometryPtr CreateCone() override
virtual void DestroySensorByName(const std::string &_name) override
virtual common::Time SimTime() const override
virtual NodePtr NodeById(unsigned int _id) const override
virtual unsigned int CreateObjectId()
virtual LightPtr LightById(unsigned int _id) const override
virtual MeshPtr CreateMeshImpl(unsigned int _id, const std::string &_name, const MeshDescriptor &_desc)=0
virtual BoundingBoxCameraPtr CreateBoundingBoxCamera() override
virtual VisualPtr VisualByName(const std::string &_name) const override
virtual LightStorePtr Lights() const =0
virtual GeometryPtr CreatePlaneImpl(unsigned int _id, const std::string &_name)=0
virtual void UnregisterMaterials() override
STL class.
common::Time simTime
Definition: gz/rendering/base/BaseScene.hh:830
virtual void DestroyLightById(unsigned int _id) override
virtual void SetTime(const std::chrono::steady_clock::duration &_time) override
math::Color backgroundColor
Scene background color. Default should be black.
Definition: gz/rendering/base/BaseScene.hh:840
virtual void PostRender() override
virtual void DestroyNodeById(unsigned int _id) override
virtual DirectionalLightPtr CreateDirectionalLight() override
virtual unsigned int LightCount() const override
virtual void DestroyLights() override
virtual GpuRaysPtr CreateGpuRays() override
virtual bool HasVisual(ConstVisualPtr _visual) const override
virtual void DestroyVisualById(unsigned int _id) override
virtual void SetBackgroundMaterial(MaterialPtr _material) override
virtual LidarVisualPtr CreateLidarVisualImpl(unsigned int _id, const std::string &_name)=0
Implementation for creating a lidar visual.
virtual ParticleEmitterPtr CreateParticleEmitter() override
shared_ptr< GizmoVisual > GizmoVisualPtr
Shared pointer to GizmoVisual.
Definition: gz/rendering/RenderTypes.hh:147
virtual void DestroyMaterials() override
virtual void DestroyVisual(VisualPtr _visual, bool _recursive=false) override
virtual ArrowVisualPtr CreateArrowVisualImpl(unsigned int _id, const std::string &_name)=0
virtual MaterialPtr BackgroundMaterial() const override
virtual VisualStorePtr Visuals() const =0
virtual void SetAmbientLight(double _r, double _g, double _b, double _a=1.0) override
virtual void DestroyNodeByName(const std::string &_name) override
virtual void Init() override
virtual CameraPtr CreateCamera() override
virtual void DestroyMaterial(MaterialPtr _material) override
virtual GpuRaysPtr CreateGpuRaysImpl(unsigned int _id, const std::string &_name)
Implementation for creating GpuRays sensor.
Definition: gz/rendering/base/BaseScene.hh:667
shared_ptr< ThermalCamera > ThermalCameraPtr
Shared pointer to ThermalCamera.
Definition: gz/rendering/RenderTypes.hh:115
virtual PointLightPtr CreatePointLight() override
virtual bool HasNodeId(unsigned int _id) const override
virtual void Destroy() override
virtual ThermalCameraPtr CreateThermalCamera() override
virtual GeometryPtr CreateBoxImpl(unsigned int _id, const std::string &_name)=0
T endl(T... args)
virtual uint8_t CameraPassCountPerGpuFlush() const override
Definition: gz/rendering/base/BaseScene.hh:37
virtual CameraPtr CreateCameraImpl(unsigned int _id, const std::string &_name)=0
virtual SpotLightPtr CreateSpotLight() override
virtual bool MaterialRegistered(const std::string &_name) const override
virtual void DestroyLightByIndex(unsigned int _index) override
virtual bool HasVisualId(unsigned int _id) const override
virtual VisualPtr VisualById(unsigned int _id) const override
virtual AxisVisualPtr CreateAxisVisualImpl(unsigned int _id, const std::string &_name)=0
virtual void DestroySensorById(unsigned int _id) override
STL namespace.
MaterialPtr backgroundMaterial
Scene background material.
Definition: gz/rendering/base/BaseScene.hh:855
virtual void DestroyVisuals() override
bool initialized
Definition: gz/rendering/base/BaseScene.hh:837
BaseScene(unsigned int _id, const std::string &_name)
virtual NodePtr NodeByName(const std::string &_name) const override
virtual bool HasVisualName(const std::string &_name) const override
virtual MeshPtr CreateMesh(const std::string &_meshName) override
virtual GridPtr CreateGrid() override
virtual bool IsLoaded() const
virtual GizmoVisualPtr CreateGizmoVisualImpl(unsigned int _id, const std::string &_name)
Implementation for creating a GizmoVisual.
Definition: gz/rendering/base/BaseScene.hh:689
virtual void DestroySensorByIndex(unsigned int _index) override
virtual CapsulePtr CreateCapsule() override
unsigned int id
Definition: gz/rendering/base/BaseScene.hh:824
virtual ArrowVisualPtr CreateArrowVisual() override
virtual ThermalCameraPtr CreateThermalCameraImpl(unsigned int _id, const std::string &_name)
Implementation for creating a thermal camera.
Definition: gz/rendering/base/BaseScene.hh:622
virtual void SetBackgroundColor(double _r, double _g, double _b, double _a=1.0) override
std::array< math::Color, 4 > gradientBackgroundColor
The four corners of the gradient background color. Next is the description of how to interpret each v...
Definition: gz/rendering/base/BaseScene.hh:849
virtual DepthCameraPtr CreateDepthCameraImpl(unsigned int _id, const std::string &_name)=0
virtual GridPtr CreateGridImpl(unsigned int _id, const std::string &_name)=0
Implementation for creating a grid geometry object.
virtual HeightmapPtr CreateHeightmapImpl(unsigned int _id, const std::string &_name, const HeightmapDescriptor &_desc)=0
Implementation for creating a heightmap geometry.
virtual COMVisualPtr CreateCOMVisual() override
virtual RenderWindowPtr CreateRenderWindow() override
virtual unsigned int SensorCount() const override
virtual void UnregisterMaterial(const std::string &_name) override
std::string name
Definition: gz/rendering/base/BaseScene.hh:827
Represents a surface material of a Geometry.
Definition: gz/rendering/Material.hh:47
virtual ParticleEmitterPtr CreateParticleEmitterImpl(unsigned int _id, const std::string &_name)
Implementation for creating a ParticleEmitter.
Definition: gz/rendering/base/BaseScene.hh:790
bool loaded
Definition: gz/rendering/base/BaseScene.hh:835
virtual GeometryPtr CreateSphereImpl(unsigned int _id, const std::string &_name)=0
virtual bool HasSensorName(const std::string &_name) const override
virtual VisualPtr CreateVisualImpl(unsigned int _id, const std::string &_name)=0
virtual MaterialPtr CreateMaterial(const std::string &_name="") override
STL class.
virtual void PreRender() override
shared_ptr< SegmentationCamera > SegmentationCameraPtr
Shared pointer to Segmentation Camera.
Definition: gz/rendering/RenderTypes.hh:123
virtual bool RegisterSensor(SensorPtr _vensor)
virtual void SetSimTime(const common::Time &_time) override
virtual GeometryPtr CreateCylinderImpl(unsigned int _id, const std::string &_name)=0
virtual VisualPtr VisualByIndex(unsigned int _index) const override
virtual LightVisualPtr CreateLightVisual() override
virtual MarkerPtr CreateMarkerImpl(unsigned int _id, const std::string &_name)=0
Implementation for creating a marker geometry object.
virtual bool SkyEnabled() const override
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING
virtual JointVisualPtr CreateJointVisual() override
virtual void SetCameraPassCountPerGpuFlush(uint8_t _numPass) override
bool isGradientBackgroundColor
Whether the scene has a gradient background.
Definition: gz/rendering/base/BaseScene.hh:852
virtual void RemoveGradientBackgroundColor() override