Use Mesh::CreateInfo to describe and create meshes. More...
#include <kanzi/core.ui/graphics3d/mesh_create_info.hpp>
Classes | |
| struct | Adjustment |
| Describes a single adjustment made by adjustForDeviceCapabilities(). More... | |
| struct | AdjustmentKey |
| Named keys for Adjustment parameter maps. More... | |
| struct | Cluster |
| Parameters for Mesh::Cluster creation. More... | |
| struct | MorphData |
| Morph data associated with deforming this mesh. More... | |
Public Types | |
| enum class | AdjustmentType { VertexFormatFallback , MorphFormatFallback } |
| Identifies the type of adjustment performed by adjustForDeviceCapabilities(). More... | |
| typedef vector< PropertyEntry > | PropertyContainer |
| typedef pair< AbstractPropertyType, Variant > | PropertyEntry |
| enum class | Status { Valid , VertexCountZero , VertexDataSizeMismatch , InstanceBufferWithoutInstances , InstanceDataSizeMismatch , IndexBufferWithoutIndices , IndexDataSizeMismatch , ClusterExceedsIndexBounds , ClusterPrimitiveTypeInvalid , IndexOffsetNotAligned , VertexFormatAttributeOutOfBounds , MorphVertexCountZero , MorphVertexFormatEmpty , MorphVertexDataSizeMismatch , InstanceAttributeWithoutInstanceSize , BufferSizeOverflow , ClusterCountZero , MorphVertexCountMismatch , MaxVertexAttributesExceeded , MaxVertexAttributeStrideExceeded , MaxVertexAttributeOffsetExceeded , VertexFormatNotSupported } |
| Status tells if mesh creation parameters can be used to create a mesh. More... | |
Public Member Functions | |
| CreateInfo ()=default | |
| Default constructor. | |
Public Attributes | |
| Box | boundingBox |
| The bounding box for the mesh in the local coordinates of the mesh. | |
| vector< Mesh::CreateInfo::Cluster > | clusters |
| Clusters. | |
| gfx::AccessFlag | cpuAccessFlag |
| The Access Flags for the buffers created to support the mesh. | |
| gfx::BufferHandleGuard | indexBufferHandle |
| Kanzi graphics handle to the index buffer. | |
| size_t | indexCount |
| Number of indices in the mesh. | |
| vector< byte > | indexData |
| Index data. | |
| IndexBufferType | indexType |
| The data type of the index buffer: UInt16 or UInt32. | |
| gfx::BufferHandleGuard | instanceBufferHandle |
| Native handle to the instance buffer. | |
| size_t | instanceCount |
| Number of instances in the mesh. | |
| vector< byte > | instanceData |
| Instance buffer data. | |
| vector< Matrix4x4 > | instanceTransforms |
| Instance transforms. | |
| GPUResource::MemoryType | memoryType |
| Memory type for the mesh data. | |
| optional< Mesh::CreateInfo::MorphData > | morphData |
| Morph data. | |
| PropertyContainer | properties |
| Properties to copy to the mesh. | |
| Skeleton | skeleton |
| Mesh skeleton for bone animations. | |
| size_t | vertexCount |
| Number of vertices in the mesh. | |
| MeshVertexFormat | vertexFormat |
| Mesh vertex attributes. | |
Use Mesh::CreateInfo to describe and create meshes.
Vertex and index listings define meshes. Indices refer to vertices which define the faces of a mesh.
To define a mesh, you need:
When you render a large number of copies of the same mesh, performing a draw call for each copy consumes GPU time and decreases application performance. Instancing makes it possible to draw multiple copies of a mesh with different attributes, such as position, size, and color, with a single render call. For an example of how to render multiple instances of a cube mesh at different locations and with different colors, see Creating a mesh with instancing.
To enable the Kanzi Studio Preview to visualize the bounding volume of a mesh, set the bounding box for that mesh.
To create a cube mesh:
To create a mesh from native handles:
To create a mesh with instancing:
Status tells if mesh creation parameters can be used to create a mesh.
| Enumerator | |
|---|---|
| Valid | CreateInfo is valid and can be used to create a Mesh. |
| VertexCountZero | vertexCount is zero. |
| VertexDataSizeMismatch | For at least one vertex attribute, initialData size exceeds vertexCount * gfx::getPixelStride(attribute.format). |
| InstanceBufferWithoutInstances | instanceBufferHandle is valid but instanceCount is zero. |
| InstanceDataSizeMismatch | instanceData size exceeds instanceCount * vertexFormat.instanceSize. |
| IndexBufferWithoutIndices | indexBufferHandle is valid but indexCount is zero. |
| IndexDataSizeMismatch | indexData size exceeds indexCount * index type stride. |
| ClusterExceedsIndexBounds | A cluster's indexCount + indexOffset exceeds the total indexCount. |
| ClusterPrimitiveTypeInvalid | A cluster has an invalid primitiveType (e.g., GraphicsPrimitiveTypeInvalid). |
| IndexOffsetNotAligned | A cluster's indexOffset is not aligned to the index type stride. |
| VertexFormatAttributeOutOfBounds | A vertex attribute's offset + byte size exceeds vertexFormat.vertexSize. |
| MorphVertexCountZero | morphData is present but morphData.vertexCount is zero. |
| MorphVertexFormatEmpty | morphData is present but morphData.vertexFormat.attributes is empty. |
| MorphVertexDataSizeMismatch | morphData vertex data size exceeds morphData.vertexCount * morphData.vertexFormat.vertexSize. |
| InstanceAttributeWithoutInstanceSize | A vertex attribute has a non-zero divisor but vertexFormat.instanceSize is zero. |
| BufferSizeOverflow | A buffer size calculation (count * size) overflows or exceeds uint32_t max. |
| ClusterCountZero | clusters is empty. |
| MorphVertexCountMismatch | Vertex-buffer-path morph data: morphData.vertexCount does not equal createInfo.vertexCount. |
| MaxVertexAttributesExceeded | Number of non-instance vertex attributes exceeds device maximum. |
| MaxVertexAttributeStrideExceeded | Vertex stride exceeds device maximum. |
| MaxVertexAttributeOffsetExceeded | A vertex attribute's offset exceeds device maximum. |
| VertexFormatNotSupported | A vertex attribute's format is not supported for VertexAttribute usage. |
Identifies the type of adjustment performed by adjustForDeviceCapabilities().
|
explicitdefault |
Default constructor.
| GPUResource::MemoryType kanzi::Mesh::CreateInfo::memoryType |
Memory type for the mesh data.
If Gpu is not included, mesh data will not be deployed when created. If Ram is not included, mesh will not contain buffer data after it has been deployed. Default value is GpuOnly.
| vector<Mesh::CreateInfo::Cluster> kanzi::Mesh::CreateInfo::clusters |
Clusters.
| optional<Mesh::CreateInfo::MorphData> kanzi::Mesh::CreateInfo::morphData |
Morph data.
| Box kanzi::Mesh::CreateInfo::boundingBox |
The bounding box for the mesh in the local coordinates of the mesh.
When you do not set the size of a node with the Node::WidthProperty, Node::HeightProperty, and Node::DepthProperty properties, layout control nodes use the bounding box to determine the size of the node.
The Kanzi Studio Preview uses the bounding box to visualize the bounding volume of the mesh.
| MeshVertexFormat kanzi::Mesh::CreateInfo::vertexFormat |
Mesh vertex attributes.
| size_t kanzi::Mesh::CreateInfo::vertexCount |
Number of vertices in the mesh.
| size_t kanzi::Mesh::CreateInfo::instanceCount |
Number of instances in the mesh.
| vector<byte> kanzi::Mesh::CreateInfo::instanceData |
Instance buffer data.
The size of instanceData must not exceed instanceCount * vertexFormat.instanceSize.
| gfx::BufferHandleGuard kanzi::Mesh::CreateInfo::instanceBufferHandle |
Native handle to the instance buffer.
| vector<Matrix4x4> kanzi::Mesh::CreateInfo::instanceTransforms |
Instance transforms.
Instance transforms. Must be in sync with raw instance data.
| size_t kanzi::Mesh::CreateInfo::indexCount |
Number of indices in the mesh.
If indexCount is 0, no index buffer is created. If indexBufferHandle is valid, indexCount * kanzi::getIndexTypeStride(indexType) must be less than or equal the size of the indexBufferHandle.
| vector<byte> kanzi::Mesh::CreateInfo::indexData |
Index data.
The size of indexData must not exceed indexCount * kanzi::getIndexTypeStride(indexType).
| gfx::BufferHandleGuard kanzi::Mesh::CreateInfo::indexBufferHandle |
Kanzi graphics handle to the index buffer.
| IndexBufferType kanzi::Mesh::CreateInfo::indexType |
The data type of the index buffer: UInt16 or UInt32.
| gfx::AccessFlag kanzi::Mesh::CreateInfo::cpuAccessFlag |
The Access Flags for the buffers created to support the mesh.
| PropertyContainer kanzi::Mesh::CreateInfo::properties |
Properties to copy to the mesh.
Currently they are not used.