Blue Brain BioExplorer
Model.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2024, EPFL/Blue Brain Project
3  *
4  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
5  * scientific data from visualization
6  *
7  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
8  *
9  * This library is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU Lesser General Public License version 3.0 as published
11  * by the Free Software Foundation.
12  *
13  * This library is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #pragma once
24 
39 
40 #include <set>
41 
43 SERIALIZATION_ACCESS(ModelParams)
44 SERIALIZATION_ACCESS(ModelDescriptor)
45 SERIALIZATION_ACCESS(ModelInstance)
46 
47 namespace core
48 {
55 {
56  std::vector<SDFGeometry> geometries; // A vector of SDFGeometry objects
57  std::map<size_t, uint64_ts> geometryIndices; // A map where the keys are size_t values that represent
58  // the indices of geometries vector. The map values are
59  // vectors of uint64_t values that represent the indices of
60  // vertices that belong to the geometry.
61  std::vector<uint64_ts> neighbours; // A vector of vectors of uint64_t values that represent the indices
62  // of neighbouring vertices for each vertex.
63  std::vector<uint64_t> neighboursFlat; // A vector of uint64_t values that represents the indices of neighbouring
64  // vertices flattened into a single vector.
65 
66  void clear()
67  {
68  geometries.clear();
69  geometryIndices.clear();
70  neighbours.clear();
71  neighboursFlat.clear();
72  }
73 };
74 
79 class ModelInstance : public BaseObject
80 {
81 public:
86 
93  PLATFORM_API ModelInstance(const bool visible, const bool boundingBox, const Transformation& transformation)
94  : _visible(visible)
95  , _boundingBox(boundingBox)
96  , _transformation(transformation)
97  {
98  }
99 
104  PLATFORM_API bool getVisible() const { return _visible; }
105 
110  PLATFORM_API void setVisible(const bool visible) { _updateValue(_visible, visible); }
111 
116  PLATFORM_API bool getBoundingBox() const { return _boundingBox; }
117 
122  PLATFORM_API void setBoundingBox(const bool enabled) { _updateValue(_boundingBox, enabled); }
123 
129 
134  PLATFORM_API void setTransformation(const Transformation& transformation)
135  {
136  _updateValue(_transformation, transformation);
137  }
138 
143  PLATFORM_API void setModelID(const size_t id) { _updateValue(_modelID, id); }
144 
149  PLATFORM_API size_t getModelID() const { return _modelID; }
150 
155  PLATFORM_API void setInstanceID(const size_t id) { _updateValue(_instanceID, id); }
156 
161  PLATFORM_API size_t getInstanceID() const { return _instanceID; }
162 
163 protected:
164  size_t _modelID{0}; // A size_t representing the ID of the model
165  size_t _instanceID{0}; // A size_t representing the ID of the instance
166  bool _visible{true}; // A boolean indicating if the model instance is visible
167  bool _boundingBox{false}; // A boolean indicating if the model instance has a bounding box
168  Transformation _transformation; // A Transformation object representing the model's transformation
169 
171 };
172 
178 {
179 public:
180  /* Default constructor */
182 
187  PLATFORM_API ModelParams(const std::string& path);
188 
194  PLATFORM_API ModelParams(const std::string& name, const std::string& path);
195 
202  PLATFORM_API ModelParams(const std::string& name, const std::string& path, const PropertyMap& loaderProperties);
203 
206 
209 
211  PLATFORM_API ModelParams(const ModelParams& rhs) = default;
212 
215 
220  PLATFORM_API void setName(const std::string& name) { _updateValue(_name, name); }
221 
226  PLATFORM_API const std::string& getName() const { return _name; }
227 
232  PLATFORM_API void setPath(const std::string& path) { _updateValue(_path, path); }
233 
238  PLATFORM_API const std::string& getPath() const { return _path; }
239 
244  PLATFORM_API void setLoaderName(const std::string& loaderName) { _updateValue(_loaderName, loaderName); }
245 
250  PLATFORM_API const std::string& getLoaderName() const { return _loaderName; }
251 
257 
263 
264 protected:
265  std::string _name; // name of the model
266  std::string _path; // path of the model
267  std::string _loaderName; // loader name of the model
268  PropertyMap _loaderProperties; // loader properties of the model
269 
271 };
272 
285 {
286 public:
288  ModelDescriptor() = default;
289 
295 
302 
308  ModelDescriptor(ModelPtr model, const std::string& path);
309 
316  ModelDescriptor(ModelPtr model, const std::string& path, const ModelMetadata& metadata);
317 
325  ModelDescriptor(ModelPtr model, const std::string& name, const std::string& path, const ModelMetadata& metadata);
326 
333 
338  bool getEnabled() const { return _visible || _boundingBox; }
339 
344  void setMetadata(const ModelMetadata& metadata)
345  {
346  _metadata = metadata;
347  markModified();
348  }
349 
354  const ModelMetadata& getMetadata() const { return _metadata; }
355 
360  const Model& getModel() const { return *_model; }
361 
366  Model& getModel() { return *_model; }
367 
372  void addInstance(const ModelInstance& instance);
373 
378  void removeInstance(const size_t id);
379 
383  void clearInstances();
384 
390  ModelInstance* getInstance(const size_t id);
391 
396  const ModelInstances& getInstances() const { return _instances; }
397 
402  Boxd getBounds() const { return _bounds; }
403 
407  void computeBounds();
408 
413  void setProperties(const PropertyMap& properties)
414  {
415  _properties = properties;
416  markModified();
417  }
418 
423  const PropertyMap& getProperties() const { return _properties; }
424 
429  using RemovedCallback = std::function<void(const ModelDescriptor&)>;
430  void onRemoved(const RemovedCallback& callback) { _onRemovedCallback = callback; }
431 
434  {
435  if (_onRemovedCallback)
436  _onRemovedCallback(*this);
437  }
438 
440  void markForRemoval() { _markedForRemoval = true; }
441 
443  bool isMarkedForRemoval() const { return _markedForRemoval; }
444 
446  ModelDescriptorPtr clone(ModelPtr model) const;
447 
448 private:
449  size_t _nextInstanceID{0};
450  Boxd _bounds;
451  ModelMetadata _metadata;
452  ModelPtr _model;
453  ModelInstances _instances;
454  PropertyMap _properties;
455  RemovedCallback _onRemovedCallback;
456  bool _markedForRemoval = false;
457 
459 };
460 
468 class Model
469 {
470 public:
476  PLATFORM_API Model(AnimationParameters& animationParameters, VolumeParameters& volumeParameters,
477  GeometryParameters& geometryParameters, FieldParameters& fieldParameters);
478 
482  PLATFORM_API virtual ~Model();
483 
487  PLATFORM_API virtual void commitGeometry() = 0;
488 
494 
500 
508  PLATFORM_API MaterialPtr createMaterial(const size_t materialId, const std::string& name,
509  const PropertyMap& properties = {});
510 
520  const Vector3f& spacing, const DataType type) = 0;
521 
530  PLATFORM_API virtual BrickedVolumePtr createBrickedVolume(const Vector3ui& dimensions, const Vector3f& spacing,
531  const DataType type) = 0;
532 
537  PLATFORM_API virtual FieldPtr createField(const Vector3ui& dimensions, const Vector3f& spacing,
538  const Vector3f& offset, const uint32_ts& indices, const floats& values,
539  const OctreeDataType dataType) = 0;
540 
544  PLATFORM_API virtual void buildBoundingBox() = 0;
545 
549  PLATFORM_API bool empty() const;
550 
554  PLATFORM_API bool isDirty() const;
555 
560  PLATFORM_API const Boxd& getBounds() const { return _bounds; }
561 
566  void mergeBounds(const Boxd& bounds) { _bounds.merge(bounds); }
567 
572  PLATFORM_API const SpheresMap& getSpheres() const { return _geometries->_spheres; }
574  {
575  _spheresDirty = true;
576  return _geometries->_spheres;
577  }
578 
585  PLATFORM_API uint64_t addSphere(const size_t materialId, const Sphere& sphere);
586 
591  PLATFORM_API const CylindersMap& getCylinders() const { return _geometries->_cylinders; }
593  {
594  _cylindersDirty = true;
595  return _geometries->_cylinders;
596  }
597 
604  PLATFORM_API uint64_t addCylinder(const size_t materialId, const Cylinder& cylinder);
605 
610  PLATFORM_API const ConesMap& getCones() const { return _geometries->_cones; }
612  {
613  _conesDirty = true;
614  return _geometries->_cones;
615  }
616 
623  PLATFORM_API uint64_t addCone(const size_t materialId, const Cone& cone);
624 
630  PLATFORM_API void addStreamline(const size_t materialId, const Streamline& streamline);
631 
636  PLATFORM_API const StreamlinesDataMap& getStreamlines() const { return _geometries->_streamlines; }
638  {
639  _streamlinesDirty = true;
640  return _geometries->_streamlines;
641  }
642 
648  PLATFORM_API void addCurve(const size_t materialId, const Curve& curve);
649 
654  PLATFORM_API const CurvesMap& getCurves() const { return _geometries->_curves; }
656  {
657  _curvesDirty = true;
658  return _geometries->_curves;
659  }
660 
668  PLATFORM_API uint64_t addSDFGeometry(const size_t materialId, const SDFGeometry& geom,
669  const uint64_ts& neighbourIndices);
670 
677  {
678  _sdfGeometriesDirty = true;
679  return _geometries->_sdf;
680  }
681 
687  PLATFORM_API void updateSDFGeometryNeighbours(size_t geometryIdx, const uint64_ts& neighbourIndices);
688 
693  PLATFORM_API const TriangleMeshMap& getTriangleMeshes() const { return _geometries->_triangleMeshes; }
695  {
696  _triangleMeshesDirty = true;
697  return _geometries->_triangleMeshes;
698  }
699 
705  PLATFORM_API void addVolume(const size_t materialId, VolumePtr);
706 
712  PLATFORM_API void addField(const size_t materialId, FieldPtr);
713 
718  PLATFORM_API void removeVolume(const size_t materialId);
719 
724 
730 
735  PLATFORM_API const MaterialMap& getMaterials() const { return _materials; }
736 
742  PLATFORM_API MaterialPtr getMaterial(const size_t materialId) const;
743 
754 
760 
766 
771  PLATFORM_API size_t getSizeInBytes() const;
772 
777 
782 
787  PLATFORM_API const VolumesMap& getVolumes() const { return _geometries->_volumes; }
788 
793  PLATFORM_API bool isVolumesDirty() const { return _volumesDirty; }
794 
799 
804  PLATFORM_API void setBVHFlags(std::set<BVHFlag> bvhFlags) { _bvhFlags = std::move(bvhFlags); }
805 
810  PLATFORM_API const std::set<BVHFlag>& getBVHFlags() const { return _bvhFlags; }
811 
815  PLATFORM_API void updateBounds();
816 
821  PLATFORM_API void copyFrom(const Model& rhs);
822 
827 
828 protected:
829  void _updateSizeInBytes();
830 
832  PLATFORM_API virtual MaterialPtr createMaterialImpl(const PropertyMap& properties = {}) = 0;
833 
835  void _markGeometriesClean();
836 
837  virtual void _commitTransferFunctionImpl(const Vector3fs& colors, const floats& opacities,
838  const Vector2d valueRange) = 0;
839  virtual void _commitSimulationDataImpl(const float* frameData, const size_t frameSize) = 0;
840 
845 
848 
850 
851  struct Geometries
852  {
862 
872 
873  bool isEmpty() const
874  {
875  return _spheres.empty() && _cylinders.empty() && _cones.empty() && _triangleMeshes.empty() &&
876  _sdf.geometries.empty() && _streamlines.empty() && _volumes.empty() && _curves.empty();
877  }
878  };
879 
880  // the model clone actually shares all geometries to save memory. It will
881  // still create engine specific copies though (BVH only ideally) as part of
882  // commitGeometry()
883  std::shared_ptr<Geometries> _geometries{std::make_shared<Geometries>()};
884 
885  bool _spheresDirty{false};
886  bool _cylindersDirty{false};
887  bool _conesDirty{false};
888  bool _triangleMeshesDirty{false};
889  bool _streamlinesDirty{false};
890  bool _sdfGeometriesDirty{false};
891  bool _volumesDirty{false};
892  bool _curvesDirty{false};
893  bool _fieldsDirty{false};
894 
895  bool _areGeometriesDirty() const
896  {
899  }
900 
902  bool _instancesDirty{true};
903  std::set<BVHFlag> _bvhFlags;
904  size_t _sizeInBytes{0};
905 
906  // Whether this model has set the AnimationParameters "is ready" callback
907  bool _isReadyCallbackSet{false};
908 
910 };
911 } // namespace core
#define PLATFORM_API
Definition: Api.h:37
#define SERIALIZATION_FRIEND(type)
Definition: Macros.h:32
#define SERIALIZATION_ACCESS(type)
Definition: Macros.h:25
void _updateValue(T &member, const T &newValue, const bool triggerCallback=true)
Definition: BaseObject.h:87
void markModified(const bool triggerCallback=true)
Definition: BaseObject.h:65
void merge(const Box< T > &aabb)
Definition: MathTypes.h:64
The ModelDescriptor struct defines the metadata attached to a model.Model descriptor are exposed via ...
Definition: Model.h:285
Model & getModel()
Definition: Model.h:366
void removeInstance(const size_t id)
Definition: Model.cpp:139
ModelDescriptor(ModelDescriptor &&rhs)=default
std::function< void(const ModelDescriptor &)> RemovedCallback
Definition: Model.h:429
const Model & getModel() const
Definition: Model.h:360
ModelDescriptor & operator=(ModelDescriptor &&rhs)=default
const ModelInstances & getInstances() const
Definition: Model.h:396
void callOnRemoved()
Definition: Model.h:433
void onRemoved(const RemovedCallback &callback)
Definition: Model.h:430
const PropertyMap & getProperties() const
Definition: Model.h:423
void addInstance(const ModelInstance &instance)
Definition: Model.cpp:131
ModelInstance * getInstance(const size_t id)
Definition: Model.cpp:160
bool getEnabled() const
Definition: Model.h:338
bool isMarkedForRemoval() const
Definition: Model.h:443
const ModelMetadata & getMetadata() const
Definition: Model.h:354
ModelDescriptorPtr clone(ModelPtr model) const
Definition: Model.cpp:184
Boxd getBounds() const
Definition: Model.h:402
void markForRemoval()
Definition: Model.h:440
void setMetadata(const ModelMetadata &metadata)
Definition: Model.h:344
void setProperties(const PropertyMap &properties)
Definition: Model.h:413
A class representing an instance of a 3D model.
Definition: Model.h:80
PLATFORM_API ModelInstance()=default
Default constructor.
PLATFORM_API bool getBoundingBox() const
Get the value of _boundingBox.
Definition: Model.h:116
PLATFORM_API bool getVisible() const
Get the value of _visible.
Definition: Model.h:104
PLATFORM_API void setVisible(const bool visible)
Set the value of _visible.
Definition: Model.h:110
size_t _modelID
Definition: Model.h:164
Transformation _transformation
Definition: Model.h:168
size_t _instanceID
Definition: Model.h:165
PLATFORM_API void setTransformation(const Transformation &transformation)
Set the value of _transformation.
Definition: Model.h:134
PLATFORM_API void setInstanceID(const size_t id)
Set the value of _instanceID.
Definition: Model.h:155
PLATFORM_API size_t getInstanceID() const
Get the value of _instanceID.
Definition: Model.h:161
PLATFORM_API const Transformation & getTransformation() const
Get the value of _transformation.
Definition: Model.h:128
PLATFORM_API void setModelID(const size_t id)
Set the value of _modelID.
Definition: Model.h:143
PLATFORM_API size_t getModelID() const
Get the value of _modelID.
Definition: Model.h:149
PLATFORM_API void setBoundingBox(const bool enabled)
Set the value of _boundingBox.
Definition: Model.h:122
PLATFORM_API ModelInstance(const bool visible, const bool boundingBox, const Transformation &transformation)
Constructor with parameters.
Definition: Model.h:93
The ModelParams class represents the parameters needed for initializing a model instance.
Definition: Model.h:178
std::string _name
Definition: Model.h:265
PLATFORM_API const std::string & getLoaderName() const
getLoaderName gets the loader name of the model
Definition: Model.h:250
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
Definition: Model.h:256
PLATFORM_API const std::string & getPath() const
getPath gets the path of the model
Definition: Model.h:238
std::string _loaderName
Definition: Model.h:267
PLATFORM_API ModelParams & operator=(ModelParams &&rhs)=default
PLATFORM_API void setLoaderProperties(const PropertyMap &pm)
setLoaderProperties sets the loader properties of the model
Definition: Model.h:262
PLATFORM_API ModelParams(ModelParams &&rhs)=default
PLATFORM_API const std::string & getName() const
getName gets the name of the model
Definition: Model.h:226
PLATFORM_API void setPath(const std::string &path)
setPath sets the path of the model
Definition: Model.h:232
PLATFORM_API void setLoaderName(const std::string &loaderName)
setLoaderName sets the loader name of the model
Definition: Model.h:244
PLATFORM_API ModelParams(const ModelParams &rhs)=default
PropertyMap _loaderProperties
Definition: Model.h:268
std::string _path
Definition: Model.h:266
PLATFORM_API void setName(const std::string &name)
setName sets the name of the model
Definition: Model.h:220
The abstract Model class holds the geometry attached to an asset of the scene (mesh,...
Definition: Model.h:469
virtual PLATFORM_API ~Model()
Virtual destructor for Model class.
Definition: Model.cpp:208
PLATFORM_API void removeVolume(const size_t materialId)
Remove a volume from the model.
Definition: Model.cpp:318
PLATFORM_API void copyFrom(const Model &rhs)
Copies the model data from another model.
Definition: Model.cpp:476
std::set< BVHFlag > _bvhFlags
Definition: Model.h:903
PLATFORM_API bool empty() const
Definition: Model.cpp:214
Boxd _bounds
Definition: Model.h:901
TransferFunction _transferFunction
Definition: Model.h:847
AbstractSimulationHandlerPtr _simulationHandler
Definition: Model.h:846
void mergeBounds(const Boxd &bounds)
Merges model bounds with the given bounds.
Definition: Model.h:566
PLATFORM_API const CurvesMap & getCurves() const
Returns curves handled by the model.
Definition: Model.h:654
PLATFORM_API TriangleMeshMap & getTriangleMeshes()
Definition: Model.h:694
bool _cylindersDirty
Definition: Model.h:886
virtual PLATFORM_API MaterialPtr createMaterialImpl(const PropertyMap &properties={})=0
PLATFORM_API void addVolume(const size_t materialId, VolumePtr)
Add a volume to the model.
Definition: Model.cpp:306
PLATFORM_API StreamlinesDataMap & getStreamlines()
Definition: Model.h:637
PLATFORM_API void updateBounds()
Updates the bounds of the geometries.
Definition: Model.cpp:509
void _markGeometriesClean()
Definition: Model.cpp:612
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()
Definition: Model.h:592
PLATFORM_API const TriangleMeshMap & getTriangleMeshes() const
Definition: Model.h:693
virtual PLATFORM_API void buildBoundingBox()=0
Pure virtual function to build bounding box.
PLATFORM_API AbstractSimulationHandlerPtr getSimulationHandler() const
Returns the simulation handler.
Definition: Model.cpp:650
bool _curvesDirty
Definition: Model.h:892
bool _areGeometriesDirty() const
Definition: Model.h:895
PLATFORM_API void updateSDFGeometryNeighbours(size_t geometryIdx, const uint64_ts &neighbourIndices)
Update the list of neighbours for an SDF geometry.
Definition: Model.cpp:300
bool _sdfGeometriesDirty
Definition: Model.h:890
size_t _sizeInBytes
Definition: Model.h:904
PLATFORM_API bool isVolumesDirty() const
Returns whether the volumes are dirty.
Definition: Model.h:793
PLATFORM_API const StreamlinesDataMap & getStreamlines() const
Returns streamlines handled by the model.
Definition: Model.h:636
PLATFORM_API void resetVolumesDirty()
Resets the dirty status of the volumes.
Definition: Model.h:798
bool _streamlinesDirty
Definition: Model.h:889
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
Definition: Model.h:888
FieldParameters & _fieldParameters
Definition: Model.h:844
PLATFORM_API bool commitSimulationData()
Function to commit simulation data.
Definition: Model.cpp:667
PLATFORM_API uint64_t addSphere(const size_t materialId, const Sphere &sphere)
Adds a sphere to the model.
Definition: Model.cpp:219
VolumeParameters & _volumeParameters
Definition: Model.h:842
PLATFORM_API uint64_t addSDFGeometry(const size_t materialId, const SDFGeometry &geom, const uint64_ts &neighbourIndices)
Adds an SDFGeometry to the scene.
Definition: Model.cpp:290
PLATFORM_API uint64_t addCylinder(const size_t materialId, const Cylinder &cylinder)
Adds a cylinder to the model.
Definition: Model.cpp:226
GeometryParameters & _geometryParameters
Definition: Model.h:843
PLATFORM_API MaterialPtr createMaterial(const size_t materialId, const std::string &name, const PropertyMap &properties={})
Factory method to create an engine-specific material.
Definition: Model.cpp:625
MaterialMap _materials
Definition: Model.h:849
PLATFORM_API SpheresMap & getSpheres()
Definition: Model.h:573
PLATFORM_API void markInstancesClean()
Marks the instances as clean.
Definition: Model.h:781
void _updateSizeInBytes()
Definition: Model.cpp:443
PLATFORM_API const VolumesMap & getVolumes() const
Returns a const reference to the list of volumes.
Definition: Model.h:787
PLATFORM_API void setBVHFlags(std::set< BVHFlag > bvhFlags)
Sets the BVH flags.
Definition: Model.h:804
std::shared_ptr< Geometries > _geometries
Definition: Model.h:883
bool _conesDirty
Definition: Model.h:887
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.
Definition: Model.cpp:199
PLATFORM_API const std::set< BVHFlag > & getBVHFlags() const
Gets the BVH flags.
Definition: Model.h:810
PLATFORM_API void addField(const size_t materialId, FieldPtr)
Add a field to the model.
Definition: Model.cpp:312
PLATFORM_API uint64_t addCone(const size_t materialId, const Cone &cone)
Adds a cone to the model.
Definition: Model.cpp:233
bool _spheresDirty
Definition: Model.h:885
PLATFORM_API const MaterialMap & getMaterials() const
Returns a reference to the map of materials handled by the model.
Definition: Model.h:735
PLATFORM_API const SDFGeometryData & getSDFGeometryData() const
Returns SDF geometry data handled by the model.
Definition: Model.h:675
PLATFORM_API SDFGeometryData & getSDFGeometryData()
Definition: Model.h:676
bool _fieldsDirty
Definition: Model.h:893
AnimationParameters & _animationParameters
Definition: Model.h:841
bool _instancesDirty
Definition: Model.h:902
PLATFORM_API void applyDefaultColormap()
Applies a default color map (rainbow) to the model.
Definition: Model.cpp:696
PLATFORM_API const CylindersMap & getCylinders() const
Returns cylinders handled by the model.
Definition: Model.h:591
PLATFORM_API void markInstancesDirty()
Marks the instances as dirty.
Definition: Model.h:776
PLATFORM_API void addCurve(const size_t materialId, const Curve &curve)
Adds a curve to the model.
Definition: Model.cpp:270
PLATFORM_API ConesMap & getCones()
Definition: Model.h:611
PLATFORM_API void logInformation()
Logs information about the model, like the number of primitives, and the associated memory footprint.
Definition: Model.cpp:413
PLATFORM_API const SpheresMap & getSpheres() const
Returns spheres handled by the Model.
Definition: Model.h:572
PLATFORM_API void setSimulationHandler(AbstractSimulationHandlerPtr handler)
Sets the simulation handler.
Definition: Model.cpp:634
PLATFORM_API bool commitTransferFunction()
Function to commit transfer function.
Definition: Model.cpp:655
PLATFORM_API TransferFunction & getTransferFunction()
Returns the transfer function used for volumes and simulations.
Definition: Model.h:748
bool _volumesDirty
Definition: Model.h:891
PLATFORM_API bool isDirty() const
Definition: Model.cpp:328
PLATFORM_API const Boxd & getBounds() const
Returns the bounds for the Model.
Definition: Model.h:560
PLATFORM_API CurvesMap & getCurves()
Definition: Model.h:655
PLATFORM_API void addStreamline(const size_t materialId, const Streamline &streamline)
Adds a streamline to the model.
Definition: Model.cpp:240
PLATFORM_API MaterialPtr getMaterial(const size_t materialId) const
Returns a pointer to a specific material.
Definition: Model.cpp:435
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.
Definition: Model.cpp:642
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.
Definition: Model.cpp:333
PLATFORM_API const ConesMap & getCones() const
Returns cones handled by the model.
Definition: Model.h:610
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.
Definition: Model.h:753
bool _isReadyCallbackSet
Definition: Model.h:907
Defines the translation, rotation and scale parameters to be applied to a scene asset.
std::map< size_t, Cones > ConesMap
Definition: Types.h:134
std::map< size_t, StreamlinesData > StreamlinesDataMap
Definition: Types.h:140
std::map< std::string, std::string > ModelMetadata
Definition: Types.h:104
std::shared_ptr< Volume > VolumePtr
Definition: Types.h:153
glm::vec3 Vector3f
Definition: MathTypes.h:137
std::map< size_t, MaterialPtr > MaterialMap
Definition: Types.h:118
std::shared_ptr< BrickedVolume > BrickedVolumePtr
Definition: Types.h:155
glm::vec< 3, uint32_t > Vector3ui
Definition: MathTypes.h:134
std::map< size_t, Curves > CurvesMap
Definition: Types.h:144
std::shared_ptr< AbstractSimulationHandler > AbstractSimulationHandlerPtr
Definition: Types.h:179
MaterialsColorMap
Definition: Types.h:287
std::shared_ptr< SharedDataVolume > SharedDataVolumePtr
Definition: Types.h:154
std::map< size_t, FieldPtr > FieldsMap
Definition: Types.h:148
DataType
Definition: Types.h:344
std::map< size_t, Cylinders > CylindersMap
Definition: Types.h:130
std::map< size_t, TriangleMesh > TriangleMeshMap
Definition: Types.h:137
glm::vec< 2, double > Vector2d
Definition: MathTypes.h:142
std::shared_ptr< ModelDescriptor > ModelDescriptorPtr
Definition: Types.h:112
std::shared_ptr< Field > FieldPtr
Definition: Types.h:147
std::map< size_t, Spheres > SpheresMap
Definition: Types.h:126
std::map< size_t, VolumePtr > VolumesMap
Definition: Types.h:156
std::vector< ModelInstance > ModelInstances
Definition: Types.h:114
std::unique_ptr< Model > ModelPtr
Definition: Types.h:103
std::shared_ptr< Material > MaterialPtr
Definition: Types.h:117
std::vector< Vector3f > Vector3fs
Definition: MathTypes.h:139
Box< double > Boxd
Definition: MathTypes.h:119
OctreeDataType
Definition: CommonTypes.h:66
std::vector< uint32_t > uint32_ts
Definition: Types.h:53
std::vector< uint64_t > uint64_ts
Definition: Types.h:55
std::vector< float > floats
Definition: Types.h:45
Definition: Cone.h:35
Definition: Sphere.h:35
Boxd _triangleMeshesBounds
Definition: Model.h:866
bool isEmpty() const
Definition: Model.h:873
StreamlinesDataMap _streamlines
Definition: Model.h:857
VolumesMap _volumes
Definition: Model.h:859
CylindersMap _cylinders
Definition: Model.h:854
FieldsMap _fields
Definition: Model.h:861
CurvesMap _curves
Definition: Model.h:860
SDFGeometryData _sdf
Definition: Model.h:858
SpheresMap _spheres
Definition: Model.h:853
TriangleMeshMap _triangleMeshes
Definition: Model.h:856
A struct that holds data for Signed Distance Field (SDF) calculations. Since this struct holds data f...
Definition: Model.h:55
std::vector< SDFGeometry > geometries
Definition: Model.h:56
std::vector< uint64_ts > neighbours
Definition: Model.h:61
std::vector< uint64_t > neighboursFlat
Definition: Model.h:63
std::map< size_t, uint64_ts > geometryIndices
Definition: Model.h:57