Handle class for meshes (vertex buffers and an optional index buffer) on the GPU.
More...
#include <candlewick/core/Mesh.h>
Handle class for meshes (vertex buffers and an optional index buffer) on the GPU.
This class contains the layout, vertex (and index) count(s), and handles to the GPU vertex and index buffers the Mesh references.
A Mesh owns its vertex and index buffers.
- See also
- MeshView
◆ Mesh() [1/4]
◆ Mesh() [2/4]
◆ Mesh() [3/4]
candlewick::Mesh::Mesh |
( |
const Mesh & | | ) |
|
|
delete |
◆ Mesh() [4/4]
candlewick::Mesh::Mesh |
( |
Mesh && | other | ) |
|
|
noexcept |
◆ ~Mesh()
candlewick::Mesh::~Mesh |
( |
| ) |
|
|
inlinenoexcept |
◆ addView()
MeshView & candlewick::Mesh::addView |
( |
Uint32 | vertexOffset, |
|
|
Uint32 | vertexSubCount, |
|
|
Uint32 | indexOffset, |
|
|
Uint32 | indexSubCount ) |
Add a stored MeshView object. The added view will be drawn when calling Renderer::draw() with a Mesh argument.
- Returns
- Reference to the created MeshView object.
◆ bindVertexBuffer()
Mesh & candlewick::Mesh::bindVertexBuffer |
( |
Uint32 | slot, |
|
|
SDL_GPUBuffer * | buffer ) |
Bind an existing vertex buffer to a given slot of the Mesh.
- Warning
- This function will take ownership of the buffer.
- Parameters
-
slot | Binding slot of the vertex buffer. Used by SDL_GPUVertexAttribute. |
buffer | Existing buffer. |
- Returns
- Reference to
this
, for method chaining.
◆ getIndexBinding()
SDL_GPUBufferBinding candlewick::Mesh::getIndexBinding |
( |
| ) |
const |
|
inline |
◆ getVertexBinding()
SDL_GPUBufferBinding candlewick::Mesh::getVertexBinding |
( |
Uint32 | slot | ) |
const |
|
inline |
◆ isIndexed()
bool candlewick::Mesh::isIndexed |
( |
| ) |
const |
|
inline |
◆ layout()
const MeshLayout & candlewick::Mesh::layout |
( |
| ) |
const |
|
inline |
◆ numVertexBuffers()
Uint32 candlewick::Mesh::numVertexBuffers |
( |
| ) |
const |
|
inline |
Number of vertex buffers.
◆ numViews()
size_t candlewick::Mesh::numViews |
( |
| ) |
const |
|
inline |
◆ operator=() [1/2]
Mesh & candlewick::Mesh::operator= |
( |
const Mesh & | | ) |
|
|
delete |
◆ operator=() [2/2]
Mesh & candlewick::Mesh::operator= |
( |
Mesh && | other | ) |
|
|
noexcept |
◆ release()
void candlewick::Mesh::release |
( |
| ) |
|
|
noexcept |
Release all owned vertex and index buffers in the Mesh object.
◆ setIndexBuffer()
Mesh & candlewick::Mesh::setIndexBuffer |
( |
SDL_GPUBuffer * | buffer | ) |
|
Bind an existing index buffer for the Mesh.
This function does not check that the buffer is non-null. The lack of check is to allow method chaining with arguments which may or may not be null, depending on context.
- Warning
- This function will take ownership of the buffer.
- Parameters
-
buffer | Existing index buffer. |
- Returns
- Reference to
this
, for method chaining.
◆ view()
const MeshView & candlewick::Mesh::view |
( |
size_t | i | ) |
const |
|
inline |
◆ views()
std::span< const MeshView > candlewick::Mesh::views |
( |
| ) |
const |
|
inline |
◆ indexBuffer
SDL_GPUBuffer* candlewick::Mesh::indexBuffer {nullptr} |
Index buffer for the mesh's index data. If this is null, then the Mesh is considered to be non-indexed when it is bound or when draw commands are issued.
◆ indexCount
Uint32 candlewick::Mesh::indexCount {0u} |
◆ vertexBuffers
std::vector<SDL_GPUBuffer *> candlewick::Mesh::vertexBuffers |
Vertex buffers the Mesh has its vertex data in.
There may be multiple vertex buffers, depending on how the mesh data is laid out. For instance, some vertex attributes may be non-interleaved, e.g. the vertex positions, normals, and colors may be in different vertex buffers in GPU memory, instead of being laid out as [pos0, norm0, col0, pos1, ...]
.
◆ vertexCount
Uint32 candlewick::Mesh::vertexCount |
The documentation for this class was generated from the following file: