346 _metadata = metadata;
415 _properties = properties;
435 if (_onRemovedCallback)
436 _onRemovedCallback(*
this);
449 size_t _nextInstanceID{0};
454 PropertyMap _properties;
456 bool _markedForRemoval =
false;
883 std::shared_ptr<Geometries>
_geometries{std::make_shared<Geometries>()};
#define SERIALIZATION_FRIEND(type)
#define SERIALIZATION_ACCESS(type)
void _updateValue(T &member, const T &newValue, const bool triggerCallback=true)
void markModified(const bool triggerCallback=true)
void merge(const Box< T > &aabb)
The ModelDescriptor struct defines the metadata attached to a model.Model descriptor are exposed via ...
void removeInstance(const size_t id)
ModelDescriptor()=default
ModelDescriptor(ModelDescriptor &&rhs)=default
std::function< void(const ModelDescriptor &)> RemovedCallback
const Model & getModel() const
ModelDescriptor & operator=(ModelDescriptor &&rhs)=default
const ModelInstances & getInstances() const
void onRemoved(const RemovedCallback &callback)
const PropertyMap & getProperties() const
void addInstance(const ModelInstance &instance)
ModelInstance * getInstance(const size_t id)
bool isMarkedForRemoval() const
const ModelMetadata & getMetadata() const
ModelDescriptorPtr clone(ModelPtr model) const
void setMetadata(const ModelMetadata &metadata)
void setProperties(const PropertyMap &properties)
A class representing an instance of a 3D model.
PLATFORM_API ModelInstance()=default
Default constructor.
PLATFORM_API bool getBoundingBox() const
Get the value of _boundingBox.
PLATFORM_API bool getVisible() const
Get the value of _visible.
PLATFORM_API void setVisible(const bool visible)
Set the value of _visible.
Transformation _transformation
PLATFORM_API void setTransformation(const Transformation &transformation)
Set the value of _transformation.
PLATFORM_API void setInstanceID(const size_t id)
Set the value of _instanceID.
PLATFORM_API size_t getInstanceID() const
Get the value of _instanceID.
PLATFORM_API const Transformation & getTransformation() const
Get the value of _transformation.
PLATFORM_API void setModelID(const size_t id)
Set the value of _modelID.
PLATFORM_API size_t getModelID() const
Get the value of _modelID.
PLATFORM_API void setBoundingBox(const bool enabled)
Set the value of _boundingBox.
PLATFORM_API ModelInstance(const bool visible, const bool boundingBox, const Transformation &transformation)
Constructor with parameters.
The ModelParams class represents the parameters needed for initializing a model instance.
PLATFORM_API const std::string & getLoaderName() const
getLoaderName gets the loader name of the model
PLATFORM_API ModelParams()=default
PLATFORM_API ModelParams & operator=(const ModelParams &rhs)=default
PLATFORM_API const PropertyMap & getLoaderProperties() const
getLoaderProperties gets the loader properties of the model
PLATFORM_API const std::string & getPath() const
getPath gets the path of the model
PLATFORM_API ModelParams & operator=(ModelParams &&rhs)=default
PLATFORM_API void setLoaderProperties(const PropertyMap &pm)
setLoaderProperties sets the loader properties of the model
PLATFORM_API ModelParams(ModelParams &&rhs)=default
PLATFORM_API const std::string & getName() const
getName gets the name of the model
PLATFORM_API void setPath(const std::string &path)
setPath sets the path of the model
PLATFORM_API void setLoaderName(const std::string &loaderName)
setLoaderName sets the loader name of the model
PLATFORM_API ModelParams(const ModelParams &rhs)=default
PropertyMap _loaderProperties
PLATFORM_API void setName(const std::string &name)
setName sets the name of the model
The abstract Model class holds the geometry attached to an asset of the scene (mesh,...
virtual PLATFORM_API ~Model()
Virtual destructor for Model class.
PLATFORM_API void removeVolume(const size_t materialId)
Remove a volume from the model.
PLATFORM_API void copyFrom(const Model &rhs)
Copies the model data from another model.
std::set< BVHFlag > _bvhFlags
PLATFORM_API bool empty() const
TransferFunction _transferFunction
AbstractSimulationHandlerPtr _simulationHandler
void mergeBounds(const Boxd &bounds)
Merges model bounds with the given bounds.
PLATFORM_API const CurvesMap & getCurves() const
Returns curves handled by the model.
PLATFORM_API TriangleMeshMap & getTriangleMeshes()
virtual PLATFORM_API MaterialPtr createMaterialImpl(const PropertyMap &properties={})=0
PLATFORM_API void addVolume(const size_t materialId, VolumePtr)
Add a volume to the model.
PLATFORM_API StreamlinesDataMap & getStreamlines()
PLATFORM_API void updateBounds()
Updates the bounds of the geometries.
void _markGeometriesClean()
virtual PLATFORM_API FieldPtr createField(const Vector3ui &dimensions, const Vector3f &spacing, const Vector3f &offset, const uint32_ts &indices, const floats &values, const OctreeDataType dataType)=0
Create a computed field with the given dimensions, voxel spacing and data type.
PLATFORM_API CylindersMap & getCylinders()
PLATFORM_API const TriangleMeshMap & getTriangleMeshes() const
virtual PLATFORM_API void buildBoundingBox()=0
Pure virtual function to build bounding box.
PLATFORM_API AbstractSimulationHandlerPtr getSimulationHandler() const
Returns the simulation handler.
bool _areGeometriesDirty() const
PLATFORM_API void updateSDFGeometryNeighbours(size_t geometryIdx, const uint64_ts &neighbourIndices)
Update the list of neighbours for an SDF geometry.
PLATFORM_API bool isVolumesDirty() const
Returns whether the volumes are dirty.
PLATFORM_API const StreamlinesDataMap & getStreamlines() const
Returns streamlines handled by the model.
PLATFORM_API void resetVolumesDirty()
Resets the dirty status of the volumes.
virtual PLATFORM_API SharedDataVolumePtr createSharedDataVolume(const Vector3ui &dimensions, const Vector3f &spacing, const DataType type)=0
Create a volume with the given dimensions, voxel spacing and data type where the voxels are set via s...
bool _triangleMeshesDirty
FieldParameters & _fieldParameters
PLATFORM_API bool commitSimulationData()
Function to commit simulation data.
PLATFORM_API uint64_t addSphere(const size_t materialId, const Sphere &sphere)
Adds a sphere to the model.
VolumeParameters & _volumeParameters
PLATFORM_API uint64_t addSDFGeometry(const size_t materialId, const SDFGeometry &geom, const uint64_ts &neighbourIndices)
Adds an SDFGeometry to the scene.
PLATFORM_API uint64_t addCylinder(const size_t materialId, const Cylinder &cylinder)
Adds a cylinder to the model.
GeometryParameters & _geometryParameters
PLATFORM_API MaterialPtr createMaterial(const size_t materialId, const std::string &name, const PropertyMap &properties={})
Factory method to create an engine-specific material.
PLATFORM_API SpheresMap & getSpheres()
PLATFORM_API void markInstancesClean()
Marks the instances as clean.
void _updateSizeInBytes()
PLATFORM_API const VolumesMap & getVolumes() const
Returns a const reference to the list of volumes.
PLATFORM_API void setBVHFlags(std::set< BVHFlag > bvhFlags)
Sets the BVH flags.
std::shared_ptr< Geometries > _geometries
virtual void _commitSimulationDataImpl(const float *frameData, const size_t frameSize)=0
PLATFORM_API Model(AnimationParameters &animationParameters, VolumeParameters &volumeParameters, GeometryParameters &geometryParameters, FieldParameters &fieldParameters)
Constructor for Model class.
PLATFORM_API const std::set< BVHFlag > & getBVHFlags() const
Gets the BVH flags.
PLATFORM_API void addField(const size_t materialId, FieldPtr)
Add a field to the model.
PLATFORM_API uint64_t addCone(const size_t materialId, const Cone &cone)
Adds a cone to the model.
PLATFORM_API const MaterialMap & getMaterials() const
Returns a reference to the map of materials handled by the model.
PLATFORM_API const SDFGeometryData & getSDFGeometryData() const
Returns SDF geometry data handled by the model.
PLATFORM_API SDFGeometryData & getSDFGeometryData()
AnimationParameters & _animationParameters
PLATFORM_API void applyDefaultColormap()
Applies a default color map (rainbow) to the model.
PLATFORM_API const CylindersMap & getCylinders() const
Returns cylinders handled by the model.
PLATFORM_API void markInstancesDirty()
Marks the instances as dirty.
PLATFORM_API void addCurve(const size_t materialId, const Curve &curve)
Adds a curve to the model.
PLATFORM_API ConesMap & getCones()
PLATFORM_API void logInformation()
Logs information about the model, like the number of primitives, and the associated memory footprint.
PLATFORM_API const SpheresMap & getSpheres() const
Returns spheres handled by the Model.
PLATFORM_API void setSimulationHandler(AbstractSimulationHandlerPtr handler)
Sets the simulation handler.
PLATFORM_API bool commitTransferFunction()
Function to commit transfer function.
PLATFORM_API TransferFunction & getTransferFunction()
Returns the transfer function used for volumes and simulations.
PLATFORM_API bool isDirty() const
PLATFORM_API const Boxd & getBounds() const
Returns the bounds for the Model.
PLATFORM_API CurvesMap & getCurves()
PLATFORM_API void addStreamline(const size_t materialId, const Streamline &streamline)
Adds a streamline to the model.
PLATFORM_API MaterialPtr getMaterial(const size_t materialId) const
Returns a pointer to a specific material.
virtual PLATFORM_API BrickedVolumePtr createBrickedVolume(const Vector3ui &dimensions, const Vector3f &spacing, const DataType type)=0
Create a volume with the given dimensions, voxel spacing and data type where the voxels are copied vi...
PLATFORM_API size_t getSizeInBytes() const
Returns the size in bytes of all geometries.
virtual void _commitTransferFunctionImpl(const Vector3fs &colors, const floats &opacities, const Vector2d valueRange)=0
PLATFORM_API void setMaterialsColorMap(const MaterialsColorMap colorMap)
Sets the materials handled by the model, and available to the geometry.
PLATFORM_API const ConesMap & getCones() const
Returns cones handled by the model.
virtual PLATFORM_API void commitGeometry()=0
Pure virtual function to commit geometry.
PLATFORM_API const TransferFunction & getTransferFunction() const
Returns the transfer function used for volumes and simulations.
std::map< size_t, Cones > ConesMap
std::map< size_t, StreamlinesData > StreamlinesDataMap
std::map< std::string, std::string > ModelMetadata
std::shared_ptr< Volume > VolumePtr
std::map< size_t, MaterialPtr > MaterialMap
std::shared_ptr< BrickedVolume > BrickedVolumePtr
glm::vec< 3, uint32_t > Vector3ui
std::map< size_t, Curves > CurvesMap
std::shared_ptr< AbstractSimulationHandler > AbstractSimulationHandlerPtr
std::shared_ptr< SharedDataVolume > SharedDataVolumePtr
std::map< size_t, FieldPtr > FieldsMap
std::map< size_t, Cylinders > CylindersMap
std::map< size_t, TriangleMesh > TriangleMeshMap
glm::vec< 2, double > Vector2d
std::shared_ptr< ModelDescriptor > ModelDescriptorPtr
std::shared_ptr< Field > FieldPtr
std::map< size_t, Spheres > SpheresMap
std::map< size_t, VolumePtr > VolumesMap
std::vector< ModelInstance > ModelInstances
std::unique_ptr< Model > ModelPtr
std::shared_ptr< Material > MaterialPtr
std::vector< Vector3f > Vector3fs
Boxd _triangleMeshesBounds
StreamlinesDataMap _streamlines
Boxd _sdfGeometriesBounds
TriangleMeshMap _triangleMeshes
A struct that holds data for Signed Distance Field (SDF) calculations. Since this struct holds data f...
std::vector< SDFGeometry > geometries
std::vector< uint64_ts > neighbours
std::vector< uint64_t > neighboursFlat
std::map< size_t, uint64_ts > geometryIndices