31 #include <shared_mutex>
#define SERIALIZATION_FRIEND(type)
#define SERIALIZATION_ACCESS(type)
Manages light sources in a scene.
The ModelParams class represents the parameters needed for initializing a model instance.
The abstract Model class holds the geometry attached to an asset of the scene (mesh,...
Scene object This object contains collections of geometries, materials and light sources that are use...
ModelDescriptors _modelDescriptors
PLATFORM_API size_t addModel(ModelDescriptorPtr model)
Adds a model to the scene.
virtual PLATFORM_API ModelPtr createModel() const =0
Factory method to create an engine-specific model.
PLATFORM_API bool setEnvironmentMap(const std::string &envMap)
Set a new environment map as the background image.
PLATFORM_API void computeBounds()
Compute the bounds of the geometry handled by the scene.
PLATFORM_API MaterialPtr getBackgroundMaterial() const
Get the background material.
std::shared_timed_mutex _modelMutex
PLATFORM_API size_t getNumModels() const
Get the current number of models in the scene.
PLATFORM_API ModelDescriptorPtr loadModel(Blob &&blob, const ModelParams ¶ms, LoaderProgress cb)
Load a model from the given blob.
LoaderRegistry _loaderRegistry
PLATFORM_API size_t getSizeInBytes() const
Get the current size in bytes of the loaded geometry.
PLATFORM_API size_t addClipPlane(const Plane &plane)
Add a clip plane to the scene.
PLATFORM_API const Boxd & getBounds() const
Returns the bounding box of the scene.
GeometryParameters & _geometryParameters
std::string _environmentMap
PLATFORM_API const ClipPlanes & getClipPlanes() const
Get all clip planes in the scene.
virtual PLATFORM_API void commit()
Called after scene-related changes have been made before rendering the scene.
FieldParameters & _fieldParameters
VolumeParameters & _volumeParameters
LightManager _lightManager
PLATFORM_API void removeClipPlane(const size_t id)
Remove a clip plane by its ID, or no-op if not found.
PLATFORM_API void buildDefault()
Builds a default scene made of a Cornell box, a reflective cube, and a transparent sphere.
PLATFORM_API void visitModels(const std::function< void(Model &)> &functor)
Apply the given functor to every model in the scene.
PLATFORM_API void setMaterialsColorMap(MaterialsColorMap colorMap)
Initializes materials for all models in the scene.
AnimationParameters & _animationParameters
PLATFORM_API ModelDescriptorPtr getModel(const size_t id) const
Get a model descriptor given its ID.
PLATFORM_API void copyFrom(const Scene &rhs)
Copy the scene from another scene.
PLATFORM_API auto acquireReadAccess() const
virtual bool supportsConcurrentSceneUpdates() const
Check whether this scene supports scene updates from any thread.
PLATFORM_API const std::string & getEnvironmentMap() const
Get the current environment map texture file, or empty if no environment is set.
MaterialPtr _backgroundMaterial
void _loadIBLMaps(const std::string &envMap)
PLATFORM_API bool hasEnvironmentMap() const
Check if an environment map is currently set in the scene.
PLATFORM_API LoaderRegistry & getLoaderRegistry()
Get the registry for all supported loaders of this scene.
PLATFORM_API ClipPlanePtr getClipPlane(const size_t id) const
Get a clip plane by its ID.
PLATFORM_API bool removeModel(const size_t id)
Removes a model from the scene.
PLATFORM_API Scene(AnimationParameters &animationParameters, GeometryParameters &geometryParameters, VolumeParameters &volumeParameters, FieldParameters &fieldParameters)
Creates a scene object responsible for handling models, simulations and light sources.
PLATFORM_API const ModelDescriptors & getModelDescriptors() const
Get all model descriptors.
PLATFORM_API bool empty() const
Checks whether the scene is empty.
virtual PLATFORM_API bool commitLights()=0
Commits lights to renderers.
PLATFORM_API LightManager & getLightManager()
Gets the light manager.
std::vector< ModelDescriptorPtr > ModelDescriptors
std::shared_ptr< ClipPlane > ClipPlanePtr
std::vector< ClipPlanePtr > ClipPlanes
std::shared_ptr< ModelDescriptor > ModelDescriptorPtr
std::unique_ptr< Model > ModelPtr
std::shared_ptr< Material > MaterialPtr
std::array< double, 4 > Plane