17 #ifndef GZ_RENDERING_BASE_BASESCENE_HH_
18 #define GZ_RENDERING_BASE_BASESCENE_HH_
24 #include <gz/common/Console.hh>
25 #include <gz/utils/SuppressWarning.hh>
35 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
38 GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
40 GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
47 public:
virtual void Load()
override;
49 public:
virtual void Init()
override;
51 public:
virtual void Fini()
override;
53 public:
virtual bool IsLoaded()
const;
55 public:
virtual bool IsInitialized()
const override;
57 public:
virtual unsigned int Id()
const override;
61 public:
virtual std::chrono::steady_clock::duration Time()
64 public:
virtual void SetTime(
65 const std::chrono::steady_clock::duration &_time)
override;
67 public:
virtual void SetAmbientLight(
double _r,
double _g,
double _b,
68 double _a = 1.0)
override;
70 public:
virtual void SetAmbientLight(
const math::Color &_color)
73 public:
virtual math::Color BackgroundColor()
const override;
75 public:
virtual void SetBackgroundColor(
double _r,
double _g,
double _b,
76 double _a = 1.0)
override;
78 public:
virtual void SetBackgroundColor(
const math::Color &_color)
82 public:
virtual bool IsGradientBackgroundColor()
const override;
89 public:
virtual void SetGradientBackgroundColor(
93 public:
virtual void RemoveGradientBackgroundColor()
override;
96 public:
virtual MaterialPtr BackgroundMaterial()
const override;
99 public:
virtual void SetBackgroundMaterial(
MaterialPtr _material)
102 public:
virtual unsigned int NodeCount()
const override;
104 public:
virtual bool HasNode(
ConstNodePtr _node)
const override;
106 public:
virtual bool HasNodeId(
unsigned int _id)
const override;
108 public:
virtual bool HasNodeName(
const std::string &_name)
const override;
110 public:
virtual NodePtr NodeById(
unsigned int _id)
const override;
115 public:
virtual NodePtr NodeByIndex(
unsigned int _index)
const override;
118 public:
virtual void DestroyNode(
NodePtr _node,
bool _recursive =
false)
121 public:
virtual void DestroyNodeById(
unsigned int _id)
override;
123 public:
virtual void DestroyNodeByName(
const std::string &_name)
override;
125 public:
virtual void DestroyNodeByIndex(
unsigned int _index)
override;
127 public:
virtual void DestroyNodes()
override;
129 public:
virtual unsigned int LightCount()
const override;
131 public:
virtual bool HasLight(
ConstLightPtr _light)
const override;
133 public:
virtual bool HasLightId(
unsigned int _id)
const override;
135 public:
virtual bool HasLightName(
const std::string &_name)
const
138 public:
virtual LightPtr LightById(
unsigned int _id)
const override;
143 public:
virtual LightPtr LightByIndex(
unsigned int _index)
const override;
146 public:
virtual void DestroyLight(
LightPtr _light,
147 bool _recursive =
false)
override;
149 public:
virtual void DestroyLightById(
unsigned int _id)
override;
151 public:
virtual void DestroyLightByName(
const std::string &_name)
154 public:
virtual void DestroyLightByIndex(
unsigned int _index)
override;
156 public:
virtual void DestroyLights()
override;
158 public:
virtual unsigned int SensorCount()
const override;
160 public:
virtual bool HasSensor(
ConstSensorPtr _sensor)
const override;
162 public:
virtual bool HasSensorId(
unsigned int _id)
const override;
164 public:
virtual bool HasSensorName(
const std::string &_name)
const
167 public:
virtual SensorPtr SensorById(
unsigned int _id)
const override;
172 public:
virtual SensorPtr SensorByIndex(
unsigned int _index)
const
176 public:
virtual void DestroySensor(
SensorPtr _sensor,
177 bool _recursive =
false)
override;
179 public:
virtual void DestroySensorById(
unsigned int _id)
override;
181 public:
virtual void DestroySensorByName(
const std::string &_name)
184 public:
virtual void DestroySensorByIndex(
unsigned int _index)
override;
186 public:
virtual void DestroySensors()
override;
188 public:
virtual unsigned int VisualCount()
const override;
190 public:
virtual bool HasVisual(
ConstVisualPtr _visual)
const override;
192 public:
virtual bool HasVisualId(
unsigned int _id)
const override;
194 public:
virtual bool HasVisualName(
const std::string &_name)
const
197 public:
virtual VisualPtr VisualById(
unsigned int _id)
const override;
202 public:
virtual VisualPtr VisualByIndex(
unsigned int _index)
const
210 public:
virtual void DestroyVisual(
VisualPtr _visual,
211 bool _recursive =
false)
override;
213 public:
virtual void DestroyVisualById(
unsigned int _id)
override;
215 public:
virtual void DestroyVisualByName(
const std::string &_name)
218 public:
virtual void DestroyVisualByIndex(
unsigned int _index)
override;
220 public:
virtual void DestroyVisuals()
override;
222 public:
virtual bool MaterialRegistered(
const std::string &_name)
const
228 public:
virtual void RegisterMaterial(
const std::string &_name,
231 public:
virtual void UnregisterMaterial(
const std::string &_name)
234 public:
virtual void UnregisterMaterials()
override;
237 public:
virtual void DestroyMaterial(
MaterialPtr _material)
override;
240 public:
virtual void DestroyMaterials()
override;
245 unsigned int _id)
override;
251 unsigned int _id,
const std::string &_name)
override;
255 public:
virtual PointLightPtr CreatePointLight(
unsigned int _id)
override;
260 public:
virtual PointLightPtr CreatePointLight(
unsigned int _id,
267 protected:
virtual COMVisualPtr CreateCOMVisualImpl(
unsigned int _id,
281 protected:
virtual JointVisualPtr CreateJointVisualImpl(
unsigned int _id,
288 protected:
virtual LightVisualPtr CreateLightVisualImpl(
unsigned int _id,
291 public:
virtual SpotLightPtr CreateSpotLight()
override;
293 public:
virtual SpotLightPtr CreateSpotLight(
unsigned int _id)
override;
298 public:
virtual SpotLightPtr CreateSpotLight(
unsigned int _id,
301 public:
virtual CameraPtr CreateCamera()
override;
303 public:
virtual CameraPtr CreateCamera(
unsigned int _id)
override;
307 public:
virtual CameraPtr CreateCamera(
unsigned int _id,
312 public:
virtual DepthCameraPtr CreateDepthCamera(
const unsigned int _id)
318 public:
virtual DepthCameraPtr CreateDepthCamera(
const unsigned int _id,
326 const unsigned int _id)
override;
334 const unsigned int _id,
const std::string &_name)
override;
341 const unsigned int _id)
override;
349 const unsigned int _id,
const std::string &_name)
override;
356 const unsigned int _id)
override;
364 const unsigned int _id,
const std::string &_name)
override;
371 const unsigned int _id)
override;
379 const unsigned int _id,
const std::string &_name)
override;
382 public:
virtual GpuRaysPtr CreateGpuRays()
override;
385 public:
virtual GpuRaysPtr CreateGpuRays(
const unsigned int _id)
override;
392 public:
virtual GpuRaysPtr CreateGpuRays(
const unsigned int _id,
395 public:
virtual VisualPtr CreateVisual()
override;
397 public:
virtual VisualPtr CreateVisual(
unsigned int _id)
override;
401 public:
virtual VisualPtr CreateVisual(
unsigned int _id,
406 public:
virtual ArrowVisualPtr CreateArrowVisual(
unsigned int _id)
412 public:
virtual ArrowVisualPtr CreateArrowVisual(
unsigned int _id,
417 public:
virtual AxisVisualPtr CreateAxisVisual(
unsigned int _id)
override;
422 public:
virtual AxisVisualPtr CreateAxisVisual(
unsigned int _id,
426 public:
virtual COMVisualPtr CreateCOMVisual()
override;
429 public:
virtual COMVisualPtr CreateCOMVisual(
unsigned int _id)
437 public:
virtual COMVisualPtr CreateCOMVisual(
unsigned int _id,
458 public:
virtual JointVisualPtr CreateJointVisual(
unsigned int _id)
466 public:
virtual JointVisualPtr CreateJointVisual(
unsigned int _id,
473 public:
virtual LightVisualPtr CreateLightVisual(
unsigned int _id)
481 public:
virtual LightVisualPtr CreateLightVisual(
unsigned int _id,
488 public:
virtual GizmoVisualPtr CreateGizmoVisual(
unsigned int _id)
496 public:
virtual GizmoVisualPtr CreateGizmoVisual(
unsigned int _id,
504 public:
virtual GeometryPtr CreateCylinder()
override;
506 public:
virtual GeometryPtr CreatePlane()
override;
508 public:
virtual GeometryPtr CreateSphere()
override;
517 public:
virtual CapsulePtr CreateCapsule()
override;
520 public:
virtual GridPtr CreateGrid()
override;
523 public:
virtual MarkerPtr CreateMarker()
override;
530 unsigned int _id)
override;
537 public:
virtual LidarVisualPtr CreateLidarVisual(
unsigned int _id,
545 public:
virtual WireBoxPtr CreateWireBox()
override;
548 public:
virtual TextPtr CreateText()
override;
561 public:
virtual RayQueryPtr CreateRayQuery()
override;
576 unsigned int _id,
const std::string &_name)
override;
598 public:
virtual void SetSkyEnabled(
bool _enabled)
override;
601 public:
virtual bool SkyEnabled()
const override;
603 public:
virtual void PreRender()
override;
605 public:
virtual void Clear()
override;
607 public:
virtual void Destroy()
override;
610 public:
virtual void PostRender()
override;
613 public:
virtual void SetCameraPassCountPerGpuFlush(
614 uint8_t _numPass)
override;
617 public:
virtual uint8_t CameraPassCountPerGpuFlush()
const override;
620 public:
virtual bool LegacyAutoGpuFlush()
const override;
622 protected:
virtual unsigned int CreateObjectId();
624 protected:
virtual std::string CreateObjectName(
unsigned int _id,
627 protected:
virtual bool RegisterLight(
LightPtr _light);
629 protected:
virtual bool RegisterSensor(
SensorPtr _vensor);
631 protected:
virtual bool RegisterVisual(
VisualPtr _visual);
636 protected:
virtual PointLightPtr CreatePointLightImpl(
unsigned int _id,
639 protected:
virtual SpotLightPtr CreateSpotLightImpl(
unsigned int _id,
642 protected:
virtual CameraPtr CreateCameraImpl(
unsigned int _id,
645 protected:
virtual DepthCameraPtr CreateDepthCameraImpl(
unsigned int _id,
657 gzerr <<
"Thermal camera not supported by: "
672 gzerr <<
"BoundingBox camera not supported by: "
688 gzerr <<
"Segmentation camera not supported by: "
704 gzerr <<
"Wide angle camera not supported by: "
717 gzerr <<
"GpuRays not supported by: "
722 protected:
virtual VisualPtr CreateVisualImpl(
unsigned int _id,
725 protected:
virtual ArrowVisualPtr CreateArrowVisualImpl(
unsigned int _id,
728 protected:
virtual AxisVisualPtr CreateAxisVisualImpl(
unsigned int _id,
739 gzerr <<
"GizmoVisual not supported by: "
744 protected:
virtual GeometryPtr CreateBoxImpl(
unsigned int _id,
747 protected:
virtual GeometryPtr CreateConeImpl(
unsigned int _id,
750 protected:
virtual GeometryPtr CreateCylinderImpl(
unsigned int _id,
753 protected:
virtual GeometryPtr CreatePlaneImpl(
unsigned int _id,
756 protected:
virtual GeometryPtr CreateSphereImpl(
unsigned int _id,
759 protected:
virtual MeshPtr CreateMeshImpl(
unsigned int _id,
767 protected:
virtual CapsulePtr CreateCapsuleImpl(
unsigned int _id,
774 protected:
virtual GridPtr CreateGridImpl(
unsigned int _id,
781 protected:
virtual MarkerPtr CreateMarkerImpl(
unsigned int _id,
788 protected:
virtual LidarVisualPtr CreateLidarVisualImpl(
unsigned int _id,
796 protected:
virtual HeightmapPtr CreateHeightmapImpl(
unsigned int _id,
804 protected:
virtual WireBoxPtr CreateWireBoxImpl(
unsigned int _id,
811 protected:
virtual TextPtr CreateTextImpl(
unsigned int _id,
814 protected:
virtual MaterialPtr CreateMaterialImpl(
unsigned int _id,
840 gzerr <<
"ParticleEmitter not supported by: "
868 protected:
virtual bool LoadImpl() = 0;
870 protected:
virtual bool InitImpl() = 0;
872 private:
virtual void CreateNodeStore();
874 private:
virtual void CreateMaterials();
881 private:
void DestroyNodeRecursive(
NodePtr _node,
884 protected:
unsigned int id;
886 GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
888 GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
890 protected: std::chrono::steady_clock::duration time =
891 std::chrono::steady_clock::duration::zero();
910 protected:
bool isGradientBackgroundColor =
false;
915 private:
unsigned int nextObjectId;
917 GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
919 GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING