MeshVertexAttribute describes how Kanzi stores mesh vertex and instance data in memory, and (in CreateInfo context) carries the source data for the attribute. More...
#include <kanzi/core.ui/graphics3d/graphics_enums.hpp>
Public Member Functions | |
| MeshVertexAttribute () | |
| Constructor. | |
| MeshVertexAttribute (string_view name, Semantic semantic, unsigned int semanticIndex, gfx::Format format, unsigned int offset) | |
| Constructor. | |
Public Member Functions inherited from kanzi::VertexAttribute | |
| VertexAttribute ()=default | |
| Constructor. | |
| VertexAttribute (string_view name, Semantic semantic, unsigned int semanticIndex) | |
| Constructor. | |
Public Attributes | |
| gfx::BufferHandleGuard | bufferHandle |
| Optional pre-created buffer handle to reuse instead of allocating a new buffer. | |
| unsigned int | divisor |
| Attribute divisor. | |
| gfx::Format | format |
| Attribute format. | |
| vector< byte > | initialData |
| Source data for this attribute. | |
| unsigned int | offset |
| Attribute offset within its binding. | |
Public Attributes inherited from kanzi::VertexAttribute | |
| string | name |
| Name of the attribute. Not currently used. | |
| SemanticKey | semanticKey |
Friends | |
| bool | operator!= (const MeshVertexAttribute &attribute1, const MeshVertexAttribute &attribute2) |
| bool | operator== (const MeshVertexAttribute &attribute1, const MeshVertexAttribute &attribute2) |
| Compares the attribute specification. | |
| void | swap (MeshVertexAttribute &attribute1, MeshVertexAttribute &attribute2) |
Additional Inherited Members | |
Public Types inherited from kanzi::VertexAttribute | |
| enum | Semantic { SemanticPosition , SemanticNormal , SemanticTangent , SemanticTextureCoordinate , SemanticColor , SemanticWeight , SemanticMatrixPalette , SemanticBitangent , SemanticCount , SemanticCustom , SemanticInvalid } |
| Specifies the available vertex attributes. More... | |
MeshVertexAttribute describes how Kanzi stores mesh vertex and instance data in memory, and (in CreateInfo context) carries the source data for the attribute.
Since MeshVertexAttribute is derived from VertexAttribute, it has a name, a semantic, and a semantic index. Each mesh attribute also has:
The per-attribute stride is derived from the format at use-site via gfx::getPixelStride(format).
Instance attributes are similar to vertex attributes, but have a divisor set to a non-zero value, and are shared by all vertices of an instance. The divisor value indicates how many instances share the same attribute values. Value 1 means that every instance gets a new value. Value 2 means that two instances share the values and every other instance gets new values, and so on.
|
inlineexplicit |
Constructor.
|
inlineexplicit |
Constructor.
| name | Name of vertex attribute. |
| semantic | Semantic of vertex attribute. |
| semanticIndex | Semantic index of vertex attribute. |
| format | Format of vertex attribute. |
| offset | Offset of vertex attribute. |
|
friend |
|
friend |
Compares the attribute specification.
Does not compare initialData or bufferHandle — those are transient source fields and are not part of attribute identity.
|
friend |
| gfx::Format kanzi::MeshVertexAttribute::format |
Attribute format.
Attribute offset within its binding.
Always 0u for vertex attributes (each attribute owns its own de-interleaved buffer); meaningful only for interleaved instance attributes.
Attribute divisor.
Value 0 for vertex attributes, 1+ for instance attributes.
| vector<byte> kanzi::MeshVertexAttribute::initialData |
Source data for this attribute.
Size must not exceed vertexCount * gfx::getPixelStride(format). A smaller size is a partial upload — the remaining bytes can be written later via Mesh::setVertexSubData. An empty vector creates the buffer with no initial upload. Consumed by Mesh::create(); when memoryType != GpuOnly, retained on the Mesh and returned by Mesh::getVertexData(SemanticKey).
| gfx::BufferHandleGuard kanzi::MeshVertexAttribute::bufferHandle |
Optional pre-created buffer handle to reuse instead of allocating a new buffer.