|
Lagrange
|
Simple scene container for instanced meshes. More...
#include <lagrange/scene/SimpleScene.h>
Public Types | |
| using | MeshType = SurfaceMesh< Scalar, Index > |
| Mesh type. | |
| using | InstanceType = MeshInstance< Scalar, Index, Dimension > |
| Instance type. | |
| using | AffineTransform = typename InstanceType::AffineTransform |
| Affine transform matrix. | |
Public Member Functions | |
| Index | get_num_meshes () const |
| Gets the number of meshes in the scene. More... | |
| Index | get_num_instances (Index mesh_index) const |
| Gets the number of instances for a given mesh. More... | |
| Index | compute_num_instances () const |
| Calculates the total number instances for all meshes in the scene. More... | |
| const MeshType & | get_mesh (Index mesh_index) const |
| Gets a const reference to a mesh in the scene. More... | |
| MeshType & | ref_mesh (Index mesh_index) |
| Gets a modifiable reference to a mesh in a scene. More... | |
| const InstanceType & | get_instance (Index mesh_index, Index instance_index) const |
| Get a const reference to a mesh instance in the scene. More... | |
| InstanceType & | ref_instance (Index mesh_index, Index instance_index) |
| Get a reference to a mesh instance in the scene. More... | |
| void | reserve_meshes (Index num_meshes) |
| Pre-allocate a number of meshes in the scene. More... | |
| Index | add_mesh (MeshType mesh) |
| Adds a mesh to the scene, possibly with existing instances. More... | |
| void | reserve_instances (Index mesh_index, Index num_instances) |
| Pre-allocate a number of instances for a given mesh. More... | |
| Index | add_instance (InstanceType instance) |
| Adds a new instance of an existing mesh. More... | |
| void | foreach_instances_for_mesh (Index mesh_index, function_ref< void(const InstanceType &)> func) const |
| Iterates over all instances of a specific mesh. More... | |
| void | foreach_instances (function_ref< void(const InstanceType &)> func) const |
| Iterates over all instances of the scene. More... | |
Static Public Attributes | |
| static constexpr size_t | Dim = Dimension |
| Access dimension from outside the class. | |
Protected Attributes | |
| std::vector< MeshType > | m_meshes |
| List of meshes in the scene. | |
| std::vector< std::vector< InstanceType > > | m_instances |
| List of mesh instances in the scene. Stored as a list of instance per parent mesh. | |
Simple scene container for instanced meshes.
|
inline |
Gets the number of meshes in the scene.
|
inline |
Gets the number of instances for a given mesh.
| [in] | mesh_index | Mesh index. |
| Index compute_num_instances |
Calculates the total number instances for all meshes in the scene.
|
inline |
Gets a const reference to a mesh in the scene.
| [in] | mesh_index | Mesh index. |
|
inline |
Gets a modifiable reference to a mesh in a scene.
| [in] | mesh_index | Mesh index. |
|
inline |
Get a const reference to a mesh instance in the scene.
| [in] | mesh_index | Index of the parent mesh in the scene. |
| [in] | instance_index | Local instance index respective to the parent mesh. |
|
inline |
Get a reference to a mesh instance in the scene.
| [in] | mesh_index | Index of the parent mesh in the scene. |
| [in] | instance_index | Local instance index respective to the parent mesh. |
| void reserve_meshes | ( | Index | num_meshes | ) |
Pre-allocate a number of meshes in the scene.
| [in] | num_meshes | Number of meshes to reserve in the scene. |
| Index add_mesh | ( | MeshType | mesh | ) |
Adds a mesh to the scene, possibly with existing instances.
| [in] | mesh | Mesh to be added to the scene. The object will be moved into the scene. |
| void reserve_instances | ( | Index | mesh_index, |
| Index | num_instances | ||
| ) |
Pre-allocate a number of instances for a given mesh.
| [in] | mesh_index | Mesh index. |
| [in] | num_instances | Number of instances to reserve for this mesh. |
| Index add_instance | ( | InstanceType | instance | ) |
Adds a new instance of an existing mesh.
| [in] | instance | Mesh instance to add to the scene. |
| void foreach_instances_for_mesh | ( | Index | mesh_index, |
| function_ref< void(const InstanceType &)> | func | ||
| ) | const |
Iterates over all instances of a specific mesh.
| [in] | mesh_index | Mesh index on which to iterate over. |
| [in] | func | Callback function to call for each mesh instance. |
| void foreach_instances | ( | function_ref< void(const InstanceType &)> | func | ) | const |
Iterates over all instances of the scene.
| [in] | func | Callback function to call for each mesh instance. |