Generic abstraction of a GPU vertex array object and its associated buffers.
More...
#include <GREM/graphics/Mesh.hpp>
|
| | Mesh (Device &device, VertexAttributeMask activeVertexAttributes=~VertexAttributeMask{}) |
| | Construct an empty mesh.
|
| | Mesh (Device &device, const Parameters ¶meters, VertexAttributeMask activeVertexAttributes=~VertexAttributeMask{}) |
| | Construct an empty mesh.
|
| | Mesh (Device &device, Span< const Vertex > vertices, VertexAttributeMask activeVertexAttributes=~VertexAttributeMask{}) |
| | Constructor for meshes that only have a vertex buffer.
|
| | Mesh (Device &device, Span< const Vertex > vertices, Span< const Index > indices, VertexAttributeMask activeVertexAttributes=~VertexAttributeMask{}) |
| | Constructor for meshes that have a vertex buffer and an index buffer.
|
| | Mesh (Device &device, Span< const Vertex > vertices, const Parameters ¶meters, VertexAttributeMask activeVertexAttributes=~VertexAttributeMask{}) |
| | Constructor for meshes that have a vertex buffer and a uniform buffer.
|
| | Mesh (Device &device, Span< const Vertex > vertices, Span< const Index > indices, const Parameters ¶meters, VertexAttributeMask activeVertexAttributes=~VertexAttributeMask{}) |
| | Constructor for meshes that have a vertex buffer, an index buffer and a uniform buffer.
|
| void | setVertices (Span< const Vertex > newVertices) noexcept |
| | Upload new vertices to the vertex buffer, overriding any previous contents.
|
template<typename... AttributeArrays>
requires (sizeof...(AttributeArrays) == meta::aggregate_size_v<Vertex>) |
| void | setVertexAttributes (const AttributeArrays &... vertexAttributes) noexcept |
| | Upload new deinterleaved vertex attributes to the vertex buffer, overriding any previous contents.
|
| void | setIndices (Span< const Index > newIndices) noexcept |
| | Upload new indices to the index buffer, overriding any previous contents.
|
| void | setVerticesAndIndices (Span< const Vertex > newVertices, Span< const Index > newIndices) noexcept |
| | Upload new vertices and indices to the vertex and index buffers, overriding any previous contents.
|
template<typename... AttributeArrays>
requires (!same_as<Index, NoIndex> && sizeof...(AttributeArrays) == meta::aggregate_size_v<Vertex>) |
| void | setIndicesAndVertexAttributes (Span< const Index > newIndices, const AttributeArrays &... vertexAttributes) noexcept |
| | Upload new indices and deinterleaved vertex attributes to the index and vertex buffers, overriding any previous contents.
|
| void | setParameters (const Parameters &newParameters) noexcept |
| | Upload new parameter values to the uniform buffer, overriding any previous contents.
|
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
class grem::graphics::Mesh< Vertex, Index, Parameters, Instance >
Generic abstraction of a GPU vertex array object and its associated buffers.
- Template Parameters
-
| Vertex | type of vertices stored in the vertex buffer. Must meet the requirements of the grem::graphics::mesh_vertex concept. |
| Index | type of indices stored in the index buffer, or NoIndex for no index buffer. Must meet the requirements of the grem::graphics::mesh_index concept. |
| Parameters | user-defined aggregate type of parameters that the uniform buffer of the mesh should contain. |
| Instance | type of instances stored in the instance buffer, or NoInstance for no instance buffer. Must meet the requirements of the grem::graphics::mesh_instance concept. |
◆ vertex_type
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
◆ index_type
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
◆ parameters_type
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Parameters type of the mesh.
◆ instance_type
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Instance type of the mesh.
◆ Mesh() [1/6]
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Construct an empty mesh.
- Parameters
-
| device | device to create the mesh for. Must outlive the mesh. |
| activeVertexAttributes | mask of active vertex attributes for this mesh. Inactive vertex attributes must not be read by any shader that receives this mesh as input. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ Mesh() [2/6]
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Construct an empty mesh.
- Parameters
-
| device | device to create the mesh for. Must outlive the mesh. |
| parameters | initial parameter values to upload to the uniform buffer. |
| activeVertexAttributes | mask of active vertex attributes for this mesh. Inactive vertex attributes must not be read by any shader that receives this mesh as input. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ Mesh() [3/6]
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Constructor for meshes that only have a vertex buffer.
- Parameters
-
| device | device to create the mesh for. Must outlive the mesh. |
| vertices | initial data to upload to the vertex buffer. |
| activeVertexAttributes | mask of active vertex attributes for this mesh. Inactive vertex attributes must not be read by any shader that receives this mesh as input. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ Mesh() [4/6]
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Constructor for meshes that have a vertex buffer and an index buffer.
- Parameters
-
| device | device to create the mesh for. Must outlive the mesh. |
| vertices | initial data to upload to the vertex buffer. |
| indices | initial data to upload to the index buffer. |
| activeVertexAttributes | mask of active vertex attributes for this mesh. Inactive vertex attributes must not be read by any shader that receives this mesh as input. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ Mesh() [5/6]
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Constructor for meshes that have a vertex buffer and a uniform buffer.
- Parameters
-
| device | device to create the mesh for. Must outlive the mesh. |
| vertices | initial data to upload to the vertex buffer. |
| parameters | initial parameter values to upload to the uniform buffer. |
| activeVertexAttributes | mask of active vertex attributes for this mesh. Inactive vertex attributes must not be read by any shader that receives this mesh as input. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ Mesh() [6/6]
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Constructor for meshes that have a vertex buffer, an index buffer and a uniform buffer.
- Parameters
-
| device | device to create the mesh for. Must outlive the mesh. |
| vertices | initial data to copy into the vertex buffer. |
| indices | initial data to copy into the index buffer. |
| parameters | initial parameter values to upload to the uniform buffer. |
| activeVertexAttributes | mask of active vertex attributes for this mesh. Inactive vertex attributes must not be read by any shader that receives this mesh as input. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ setVertices()
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Upload new vertices to the vertex buffer, overriding any previous contents.
- Parameters
-
| newVertices | new data to upload to the vertex buffer. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ setVertexAttributes()
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
| void grem::graphics::Mesh< Vertex, Index, Parameters, Instance >::setVertexAttributes |
( |
const AttributeArrays &... | vertexAttributes | ) |
|
|
inlinenoexcept |
Upload new deinterleaved vertex attributes to the vertex buffer, overriding any previous contents.
- Parameters
-
| vertexAttributes | new arrays of attribute values to upload to the vertex buffer. Each attribute array must either be empty or have the same size as all other non-empty arrays. If a given array is empty, its corresponding vertex attribute must have been specified as inactive in the mesh constructor. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ setIndices()
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
Upload new indices to the index buffer, overriding any previous contents.
- Parameters
-
| newIndices | new data to upload to the index buffer. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ setVerticesAndIndices()
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
| void grem::graphics::Mesh< Vertex, Index, Parameters, Instance >::setVerticesAndIndices |
( |
Span< const Vertex > | newVertices, |
|
|
Span< const Index > | newIndices ) |
|
inlinenoexcept |
Upload new vertices and indices to the vertex and index buffers, overriding any previous contents.
- Parameters
-
| newVertices | new data to upload to the vertex buffer. |
| newIndices | new data to upload to the index buffer. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ setIndicesAndVertexAttributes()
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
| void grem::graphics::Mesh< Vertex, Index, Parameters, Instance >::setIndicesAndVertexAttributes |
( |
Span< const Index > | newIndices, |
|
|
const AttributeArrays &... | vertexAttributes ) |
|
inlinenoexcept |
Upload new indices and deinterleaved vertex attributes to the index and vertex buffers, overriding any previous contents.
- Parameters
-
| newIndices | new data to upload to the index buffer. |
| vertexAttributes | new arrays of attribute values to upload to the vertex buffer. Each attribute array must either be empty or have the same size as all other non-empty arrays. If a given array is empty, its corresponding vertex attribute must have been specified as inactive in the mesh constructor. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ setParameters()
template<typename Vertex, typename Index = NoIndex, typename Parameters = NoParameters, typename Instance = NoInstance>
| void grem::graphics::Mesh< Vertex, Index, Parameters, Instance >::setParameters |
( |
const Parameters & | newParameters | ) |
|
|
inlinenoexcept |
Upload new parameter values to the uniform buffer, overriding any previous contents.
- Parameters
-
| newParameters | new parameter values to upload. |
- Exceptions
-
| graphics::Error | if resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
The documentation for this class was generated from the following file: