A list of attribute descriptors that together define the layout and size of the vertex they make up in GPU memory.
More...
#include <vertex.hpp>
|
| VertexLayout (std::vector< VertexAttributeDescriptor > attributeList) |
| Create a vertex layout from a list of attribute descriptors.
|
|
std::vector< VertexAttributeDescriptor > | getAttributeList () const |
| Gets the list of attribute descriptors making up this layout.
|
|
std::size_t | computeStride () const |
| Computes the total space occupied by a single vertex including all its attributes in memory.
|
|
std::size_t | computeRelativeOffset (std::size_t attributeIndex) const |
| Given the index of an attribute descriptor within the layout, computes the offset to that attribute from the beginning of the vertex, in GPU memory.
|
|
bool | isSubsetOf (const VertexLayout &other) const |
| Tests whether this vertex layout is the subset of another.
|
|
A list of attribute descriptors that together define the layout and size of the vertex they make up in GPU memory.
- Todo
- This isn't particularly intuitive or useful yet; expand on this so that shaders can declare their vertex layouts in their json headers maybe? At present we've just hardcoded this into the render stages.
◆ VertexLayout()
Create a vertex layout from a list of attribute descriptors.
- Parameters
-
attributeList | The list of attributes in the layout. |
◆ computeRelativeOffset()
std::size_t ToyMaker::VertexLayout::computeRelativeOffset |
( |
std::size_t | attributeIndex | ) |
const |
|
inline |
Given the index of an attribute descriptor within the layout, computes the offset to that attribute from the beginning of the vertex, in GPU memory.
- Parameters
-
attributeIndex | The index of the attribute whose offset we want. |
- Returns
- std::size_t The number of bytes from the start of the vertex data to the start of the attribute.
◆ computeStride()
std::size_t ToyMaker::VertexLayout::computeStride |
( |
| ) |
const |
|
inline |
Computes the total space occupied by a single vertex including all its attributes in memory.
- Returns
- std::size_t The total size of a single vertex in memory.
◆ getAttributeList()
Gets the list of attribute descriptors making up this layout.
- Returns
- std::vector<VertexAttributeDescriptor> This layout's attribute descriptor.
◆ isSubsetOf()
bool ToyMaker::VertexLayout::isSubsetOf |
( |
const VertexLayout & | other | ) |
const |
|
inline |
Tests whether this vertex layout is the subset of another.
This vertex must have attributes in the same order as the other, but may skip any attributes present on the other.
Used mainly to determine whether the layout requested by a RenderStage is compatible with the layout describing some vertex data.
- Parameters
-
other | The layout this one is possibly a subset of. |
- Return values
-
true | This layout is a subset of the other. |
false | This layout is not a subset of the other. |
The documentation for this struct was generated from the following file: