17 #ifndef GZ_RENDERING_SCENE_HH_
18 #define GZ_RENDERING_SCENE_HH_
24 #include <gz/common/Material.hh>
25 #include <gz/common/Mesh.hh>
27 #include <gz/math/Color.hh>
31 #include "gz/rendering/config.hh"
36 #include "gz/rendering/Export.hh"
42 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
51 class GZ_RENDERING_VISIBLE
Scene
54 public:
virtual ~
Scene();
57 public:
virtual void Load() = 0;
60 public:
virtual void Init() = 0;
63 public:
virtual void Fini() = 0;
67 public:
virtual bool IsInitialized()
const = 0;
71 public:
virtual unsigned int Id()
const = 0;
83 public:
virtual std::chrono::steady_clock::duration
88 public:
virtual void SetTime(
89 const std::chrono::steady_clock::duration &_time) = 0;
96 public:
virtual VisualPtr RootVisual()
const = 0;
107 public:
virtual math::Color AmbientLight()
const = 0;
114 public:
virtual void SetAmbientLight(
double _r,
double _g,
double _b,
115 double _a = 1.0) = 0;
119 public:
virtual void SetAmbientLight(
const math::Color &_color) = 0;
123 public:
virtual math::Color BackgroundColor()
const = 0;
130 public:
virtual void SetBackgroundColor(
double _r,
double _g,
double _b,
131 double _a = 1.0) = 0;
135 public:
virtual void SetBackgroundColor(
const math::Color &_color) = 0;
139 public:
virtual bool IsGradientBackgroundColor()
const = 0;
145 GradientBackgroundColor()
const = 0;
160 public:
virtual void SetGradientBackgroundColor(
166 public:
virtual void RemoveGradientBackgroundColor() = 0;
171 public:
virtual MaterialPtr BackgroundMaterial()
const = 0;
176 public:
virtual void SetBackgroundMaterial(
MaterialPtr _material) = 0;
181 public:
virtual unsigned int NodeCount()
const = 0;
186 public:
virtual bool HasNode(
ConstNodePtr _node)
const = 0;
192 public:
virtual bool HasNodeId(
unsigned int _id)
const = 0;
198 public:
virtual bool HasNodeName(
const std::string &_name)
const = 0;
204 public:
virtual NodePtr NodeById(
unsigned int _id)
const = 0;
216 public:
virtual NodePtr NodeByIndex(
unsigned int _index)
const = 0;
225 public:
virtual void DestroyNode(
NodePtr _node,
226 bool _recursive =
false) = 0;
232 public:
virtual void DestroyNodeById(
unsigned int _id) = 0;
238 public:
virtual void DestroyNodeByName(
const std::string &_name) = 0;
244 public:
virtual void DestroyNodeByIndex(
unsigned int _index) = 0;
247 public:
virtual void DestroyNodes() = 0;
252 public:
virtual unsigned int LightCount()
const = 0;
257 public:
virtual bool HasLight(
ConstLightPtr _light)
const = 0;
263 public:
virtual bool HasLightId(
unsigned int _id)
const = 0;
269 public:
virtual bool HasLightName(
const std::string &_name)
const = 0;
275 public:
virtual LightPtr LightById(
unsigned int _id)
const = 0;
281 public:
virtual LightPtr LightByName(
288 public:
virtual LightPtr LightByIndex(
unsigned int _index)
const = 0;
297 public:
virtual void DestroyLight(
LightPtr _light,
298 bool _recursive =
false) = 0;
304 public:
virtual void DestroyLightById(
unsigned int _id) = 0;
310 public:
virtual void DestroyLightByName(
const std::string &_name) = 0;
316 public:
virtual void DestroyLightByIndex(
unsigned int _index) = 0;
319 public:
virtual void DestroyLights() = 0;
324 public:
virtual unsigned int SensorCount()
const = 0;
335 public:
virtual bool HasSensorId(
unsigned int _id)
const = 0;
341 public:
virtual bool HasSensorName(
const std::string &_name)
const = 0;
347 public:
virtual SensorPtr SensorById(
unsigned int _id)
const = 0;
360 public:
virtual SensorPtr SensorByIndex(
unsigned int _index)
const = 0;
369 public:
virtual void DestroySensor(
SensorPtr _sensor,
370 bool _recursive =
false) = 0;
376 public:
virtual void DestroySensorById(
unsigned int _id) = 0;
382 public:
virtual void DestroySensorByName(
const std::string &_name) = 0;
388 public:
virtual void DestroySensorByIndex(
unsigned int _index) = 0;
391 public:
virtual void DestroySensors() = 0;
396 public:
virtual unsigned int VisualCount()
const = 0;
407 public:
virtual bool HasVisualId(
unsigned int _id)
const = 0;
413 public:
virtual bool HasVisualName(
const std::string &_name)
const = 0;
419 public:
virtual VisualPtr VisualById(
unsigned int _id)
const = 0;
432 public:
virtual VisualPtr VisualByIndex(
unsigned int _index)
const = 0;
442 public:
virtual void DestroyVisual(
VisualPtr _node,
443 bool _recursive =
false) = 0;
449 public:
virtual void DestroyVisualById(
unsigned int _id) = 0;
455 public:
virtual void DestroyVisualByName(
const std::string &_name) = 0;
461 public:
virtual void DestroyVisualByIndex(
unsigned int _index) = 0;
464 public:
virtual void DestroyVisuals() = 0;
469 public:
virtual bool MaterialRegistered(
483 public:
virtual void RegisterMaterial(
const std::string &_name,
489 public:
virtual void UnregisterMaterial(
const std::string &_name) = 0;
492 public:
virtual void UnregisterMaterials() = 0;
496 public:
virtual void DestroyMaterial(
MaterialPtr _material) = 0;
499 public:
virtual void DestroyMaterials() = 0;
512 unsigned int _id) = 0;
541 unsigned int _id) = 0;
570 unsigned int _id) = 0;
591 public:
virtual CameraPtr CreateCamera() = 0;
599 unsigned int _id) = 0;
628 unsigned int _id) = 0;
657 unsigned int _id) = 0;
686 unsigned int _id) = 0;
715 unsigned int _id) = 0;
744 unsigned int _id) = 0;
765 public:
virtual GpuRaysPtr CreateGpuRays() = 0;
772 public:
virtual GpuRaysPtr CreateGpuRays(
unsigned int _id) = 0;
793 public:
virtual VisualPtr CreateVisual() = 0;
801 unsigned int _id) = 0;
830 unsigned int _id) = 0;
859 unsigned int _id) = 0;
888 unsigned int _id) = 0;
917 unsigned int _id) = 0;
946 unsigned int _id) = 0;
975 unsigned int _id) = 0;
1004 unsigned int _id) = 0;
1028 public:
virtual CapsulePtr CreateCapsule() = 0;
1072 public:
virtual GridPtr CreateGrid() = 0;
1076 public:
virtual WireBoxPtr CreateWireBox() = 0;
1080 public:
virtual MarkerPtr CreateMarker() = 0;
1092 public:
virtual LidarVisualPtr CreateLidarVisual(
unsigned int _id) = 0;
1119 public:
virtual TextPtr CreateText() = 0;
1159 unsigned int _id) = 0;
1214 public:
virtual void SetSkyEnabled(
bool _enabled) = 0;
1218 public:
virtual bool SkyEnabled()
const = 0;
1222 public:
virtual void PreRender() = 0;
1229 public:
virtual void PostRender() = 0;
1324 public:
virtual void SetCameraPassCountPerGpuFlush(uint8_t _numPass) = 0;
1330 public:
virtual uint8_t CameraPassCountPerGpuFlush()
const = 0;
1336 public:
virtual bool LegacyAutoGpuFlush()
const = 0;
1341 public:
virtual void Clear() = 0;
1346 public:
virtual void Destroy() = 0;
1350 public:
SceneExt *Extension()
const;
1354 protected:
void SetExtension(
SceneExt *_ext);