|
Kanzi Graphics Engine
|
Mesh. More...
Functions | |
| kzsError | kzuMeshCreate (const struct KzuResourceManager *resourceManager, kzString name, struct KzuResourceLoader *loader, struct KzuMesh **out_mesh) |
| Creates a mesh that loads the data when needed using the given resource loader. More... | |
| kzsError | kzuMeshRegisterToFactory (const struct KzuFactory *factory) |
| Registers mesh node type to factory. More... | |
| kzsError | kzuMeshCreateFromMemory (const struct KzuResourceManager *resourceManager, kzString name, kzUint vertexAttributeCount, const kzString *vertexAttributeNames, const enum KzuMeshVertexAttributeSemantic *vertexAttributeSemantics, const enum KzuMeshVertexAttributeDataType *vertexAttributeDataTypes, const kzUint *vertexAttributeDimensions, kzUint vertexCount, const kzByte *vertexData, kzUint clusterCount, const kzUint *clusterIndexCounts, const kzU16 *const *clusterIndices, const enum KzcPrimitiveType *clusterTypes, struct KzuMaterial *const *clusterMaterials, struct KzuMesh **out_mesh) |
| Creates a mesh directly from the given data. More... | |
| kzsError | kzuMeshCreateSphere (const struct KzuResourceManager *resourceManager, kzString name, kzFloat radius, kzUint segmentCount, kzUint rowCount, struct KzuMaterial *material, struct KzuMesh **out_mesh) |
| Creates a sphere mesh. More... | |
| kzsError | kzuMeshCreateBox (const struct KzuResourceManager *resourceManager, kzString name, kzFloat width, kzFloat height, kzFloat depth, struct KzuMaterial *material, struct KzuMesh **out_mesh) |
| Creates a box mesh. More... | |
| kzsError | kzuMeshCreateCopy (const struct KzuResourceManager *resourceManager, kzString name, const struct KzuMesh *sourceMesh, struct KzuMesh **out_mesh) |
| Creates a copy of an existing mesh. More... | |
| kzsError | kzuMeshInitializeFromMemory (struct KzuMesh *mesh, kzUint vertexAttributeCount, const kzString *vertexAttributeNames, const enum KzuMeshVertexAttributeSemantic *vertexAttributeSemantics, const enum KzuMeshVertexAttributeDataType *vertexAttributeDataTypes, const kzUint *vertexAttributeDimensions, kzUint vertexCount, const kzByte *vertexData, kzUint clusterCount, const kzUint *clusterIndexCounts, const kzU16 *const *clusterIndices, const enum KzcPrimitiveType *clusterTypes, struct KzuMaterial *const *clusterMaterials) |
| Initializes a mesh with the given data. More... | |
| struct KzuGPUResource * | kzuMeshToGPUResource (const struct KzuMesh *mesh) |
| Converts mesh to GPU resource. More... | |
| struct KzuMesh * | kzuMeshFromGPUResource (const struct KzuGPUResource *gpuResource) |
| Converts GPU resource to mesh. More... | |
| struct KzuResource * | kzuMeshToResource (const struct KzuMesh *mesh) |
| Converts mesh to resource. More... | |
| struct KzuMesh * | kzuMeshFromResource (const struct KzuResource *resource) |
| Converts resource to mesh. More... | |
| struct KzuMesh * | kzuMeshCastFromResource (const struct KzuResource *resource) |
| Casts mesh from resource, KZ_NULL if invalid type. More... | |
| kzBool | kzuMeshIsRenderable (const struct KzuMesh *mesh) |
| Returns true if the mesh is deployed and valid. More... | |
| kzsError | kzuMeshBind (const struct KzuMesh *mesh, kzUint clusterIndex, const struct KzuShader *shader) |
| Binds a cluster of the mesh for rendering. More... | |
| kzsError | kzuMeshUnbind (struct KzuMesh *mesh, const struct KzuShader *shader) |
| Unbinds the mesh from rendering. More... | |
| kzsError | kzuMeshGetBoundingVolume (const struct KzuMesh *mesh, struct KzuBoundingVolume **out_boundingVolume) |
| Gets bounding volume from mesh. More... | |
| kzUint | kzuMeshGetVertexCount (const struct KzuMesh *mesh) |
| Gets the number of vertices in a mesh. More... | |
| kzUint | kzuMeshGetVertexAttributeCount (const struct KzuMesh *mesh) |
| Returns the number of vertex attribute in a mesh. More... | |
| kzsError | kzuMeshGetVertexAttributeInfo (const struct KzuMesh *mesh, kzUint index, kzString *out_name, enum KzuMeshVertexAttributeSemantic *out_semantic, enum KzuMeshVertexAttributeDataType *out_dataType, kzUint *out_dimension, kzUint *out_offset, kzUint *out_size) |
| Returns information about a vertex attribute with the given index. More... | |
| kzUint | kzuMeshGetVertexSize (const struct KzuMesh *mesh) |
| Returns the data size of a single vertex. More... | |
| const kzByte * | kzuMeshGetVertexData (const struct KzuMesh *mesh) |
| Returns the vertex data of the mesh. More... | |
| kzUint | kzuMeshGetClusterCount (const struct KzuMesh *mesh) |
| Gets the number of clusters in the mesh. More... | |
| kzUint | kzuMeshGetIndexCount (const struct KzuMesh *mesh, kzUint clusterIndex) |
| Gets the number of indices of a given cluster in a mesh. More... | |
| const kzU16 * | kzuMeshGetIndices (const struct KzuMesh *mesh, kzUint clusterIndex) |
| Returns the index data of a given cluster in a mesh. More... | |
| enum KzcPrimitiveType | kzuMeshGetClusterType (const struct KzuMesh *mesh, kzUint clusterIndex) |
| Returns the cluster type of a given cluster in a mesh. More... | |
| struct KzuMaterial * | kzuMeshGetMaterial (const struct KzuMesh *mesh, kzUint clusterIndex) |
| Gets the material of a given cluster in a mesh. More... | |
| kzsError | kzuMeshSetMaterial (const struct KzuMesh *mesh, kzUint clusterIndex, struct KzuMaterial *material) |
| Sets the material of a given cluster in a mesh. More... | |
| kzsError | kzuMeshApplyMorph (struct KzuMesh *mesh, const struct KzcMemoryManager *quickMemoryManager) |
| Applies morphing by calculating dynamic vertex attributes based on morph properties. More... | |
| kzsError | kzuMeshApplySkeleton (const struct KzuMesh *mesh, const struct KzuObjectNode *baseNode, const struct KzcMemoryManager *quickMemoryManager, const struct KzcDynamicArray *transformedObjectList) |
| Applies mesh skeleton (bones). More... | |
| kzsError | kzuMeshUpdateBoundingBox (const struct KzuMesh *mesh, struct KzuObjectNode *baseNode, const struct KzcDynamicArray *transformedObjectList, kzBool *out_isSkinned) |
| Updates the bounding box of a mesh based on the mesh skeleton and current pose. More... | |
| kzUint | kzuMeshGetBoneCount (const struct KzuMesh *mesh) |
| Returns the number of bones in a mesh skeleton. More... | |
| struct KzuObjectNode * | kzuMeshGetBoneNode (const struct KzuMesh *mesh, kzUint boneIndex) |
| Returns the bone node of a given bone in a mesh skeleton. More... | |
| struct KzuObjectNode * | kzuMeshGetBoneChildJoint (const struct KzuMesh *mesh, kzUint boneIndex) |
| Returns the child joint node of a given bone in a mesh skeleton. More... | |
| kzsError | kzuMeshAttach (struct KzuMesh *mesh, struct KzuObjectNode *baseNode) |
| Attach bone node for the mesh. More... | |
| kzsError | kzuMeshDetach (const struct KzuMesh *mesh) |
| Detach bone node for the mesh. More... | |
| void | kzuMeshSetPropertyManager (struct KzuMesh *mesh, struct KzuPropertyManager *propertyManager) |
| Sets the property manager of the mesh. More... | |
| kzsError | kzuMeshGetMappedShaders (const struct KzuMesh *mesh, struct KzcDynamicArray **out_mappedShaders) |
| Returns array of shaders having attribute mappings in this mesh. More... | |
| kzsError | kzuMeshRemoveAttributeMappingForShader (const struct KzuMesh *mesh, const struct KzuShader *shader) |
| Removes attribute mapping for the shader. More... | |
| kzsError | kzuMeshReplaceAttributeMappingForShader (const struct KzuMesh *mesh, const struct KzuShader *shader, const struct KzuShader *newShader) |
| Replaces attribute mapping for the shader. More... | |
| kzsError | kzuMeshSetAttributeMapping (const struct KzuMesh *mesh, const struct KzuShader *shader, kzString shaderAttribute, const struct KzuMesh *targetMesh, kzUint attributeIndex) |
| Sets attribute mapping for the shader attribute. More... | |
| kzBool | kzuMeshGetAttributeMapping (const struct KzuMesh *mesh, const struct KzuShader *shader, kzString shaderAttribute, const struct KzuMesh **out_targetMesh, kzUint *out_attributeIndex) |
| Gets attribute mapping for shader attribute. More... | |
| kzsError | kzuMeshRemoveAttributeMapping (const struct KzuMesh *mesh, const struct KzuShader *shader, kzString shaderAttribute) |
| Removes attribute mapping for shader attribute. More... | |
Variables | |
| const KzuResourceType | KZU_RESOURCE_TYPE_MESH |
| Resource type identifier for mesh. More... | |
Mesh.
Copyright 2008-2019 by Rightware. All rights reserved.
Vertex attribute semantic.
This specifies the meaning of a vertex attribute.
Vertex attribute data type.
| kzsError kzuMeshCreate | ( | const struct KzuResourceManager * | resourceManager, |
| kzString | name, | ||
| struct KzuResourceLoader * | loader, | ||
| struct KzuMesh ** | out_mesh | ||
| ) |
Creates a mesh that loads the data when needed using the given resource loader.
| kzsError kzuMeshRegisterToFactory | ( | const struct KzuFactory * | factory) |
Registers mesh node type to factory.
| kzsError kzuMeshCreateFromMemory | ( | const struct KzuResourceManager * | resourceManager, |
| kzString | name, | ||
| kzUint | vertexAttributeCount, | ||
| const kzString * | vertexAttributeNames, | ||
| const enum KzuMeshVertexAttributeSemantic * | vertexAttributeSemantics, | ||
| const enum KzuMeshVertexAttributeDataType * | vertexAttributeDataTypes, | ||
| const kzUint * | vertexAttributeDimensions, | ||
| kzUint | vertexCount, | ||
| const kzByte * | vertexData, | ||
| kzUint | clusterCount, | ||
| const kzUint * | clusterIndexCounts, | ||
| const kzU16 *const * | clusterIndices, | ||
| const enum KzcPrimitiveType * | clusterTypes, | ||
| struct KzuMaterial *const * | clusterMaterials, | ||
| struct KzuMesh ** | out_mesh | ||
| ) |
Creates a mesh directly from the given data.
Mesh consists of vertex attributes, vertex data and Clusters.
Each vertex attribute has:
Vertex data is an array of data in the following format:
Each cluster has:
| kzsError kzuMeshCreateSphere | ( | const struct KzuResourceManager * | resourceManager, |
| kzString | name, | ||
| kzFloat | radius, | ||
| kzUint | segmentCount, | ||
| kzUint | rowCount, | ||
| struct KzuMaterial * | material, | ||
| struct KzuMesh ** | out_mesh | ||
| ) |
Creates a sphere mesh.
| kzsError kzuMeshCreateBox | ( | const struct KzuResourceManager * | resourceManager, |
| kzString | name, | ||
| kzFloat | width, | ||
| kzFloat | height, | ||
| kzFloat | depth, | ||
| struct KzuMaterial * | material, | ||
| struct KzuMesh ** | out_mesh | ||
| ) |
Creates a box mesh.
| kzsError kzuMeshCreateCopy | ( | const struct KzuResourceManager * | resourceManager, |
| kzString | name, | ||
| const struct KzuMesh * | sourceMesh, | ||
| struct KzuMesh ** | out_mesh | ||
| ) |
Creates a copy of an existing mesh.
The source mesh will be loaded if the data is not yet available.
| kzsError kzuMeshInitializeFromMemory | ( | struct KzuMesh * | mesh, |
| kzUint | vertexAttributeCount, | ||
| const kzString * | vertexAttributeNames, | ||
| const enum KzuMeshVertexAttributeSemantic * | vertexAttributeSemantics, | ||
| const enum KzuMeshVertexAttributeDataType * | vertexAttributeDataTypes, | ||
| const kzUint * | vertexAttributeDimensions, | ||
| kzUint | vertexCount, | ||
| const kzByte * | vertexData, | ||
| kzUint | clusterCount, | ||
| const kzUint * | clusterIndexCounts, | ||
| const kzU16 *const * | clusterIndices, | ||
| const enum KzcPrimitiveType * | clusterTypes, | ||
| struct KzuMaterial *const * | clusterMaterials | ||
| ) |
Initializes a mesh with the given data.
Calling this function is safe only from a resource loader passed as an argument to kzuMeshCreate().
| struct KzuGPUResource* kzuMeshToGPUResource | ( | const struct KzuMesh * | mesh) |
Converts mesh to GPU resource.
| struct KzuMesh* kzuMeshFromGPUResource | ( | const struct KzuGPUResource * | gpuResource) |
Converts GPU resource to mesh.
| struct KzuResource* kzuMeshToResource | ( | const struct KzuMesh * | mesh) |
Converts mesh to resource.
| struct KzuMesh* kzuMeshFromResource | ( | const struct KzuResource * | resource) |
Converts resource to mesh.
| struct KzuMesh* kzuMeshCastFromResource | ( | const struct KzuResource * | resource) |
Casts mesh from resource, KZ_NULL if invalid type.
Returns true if the mesh is deployed and valid.
| kzsError kzuMeshBind | ( | const struct KzuMesh * | mesh, |
| kzUint | clusterIndex, | ||
| const struct KzuShader * | shader | ||
| ) |
Binds a cluster of the mesh for rendering.
Unbinds the mesh from rendering.
| kzsError kzuMeshGetBoundingVolume | ( | const struct KzuMesh * | mesh, |
| struct KzuBoundingVolume ** | out_boundingVolume | ||
| ) |
Gets bounding volume from mesh.
Returns the number of vertex attribute in a mesh.
| kzsError kzuMeshGetVertexAttributeInfo | ( | const struct KzuMesh * | mesh, |
| kzUint | index, | ||
| kzString * | out_name, | ||
| enum KzuMeshVertexAttributeSemantic * | out_semantic, | ||
| enum KzuMeshVertexAttributeDataType * | out_dataType, | ||
| kzUint * | out_dimension, | ||
| kzUint * | out_offset, | ||
| kzUint * | out_size | ||
| ) |
Returns information about a vertex attribute with the given index.
Any of the output parameters can be KZ_NULL.
Returns the data size of a single vertex.
This is the sum of all vertex attribute sizes.
Returns the vertex data of the mesh.
The size of the data is kzuMeshGetVertexCount(mesh) * kzuMeshGetVertexSize(mesh).
Gets the number of clusters in the mesh.
Gets the number of indices of a given cluster in a mesh.
Returns the index data of a given cluster in a mesh.
| enum KzcPrimitiveType kzuMeshGetClusterType | ( | const struct KzuMesh * | mesh, |
| kzUint | clusterIndex | ||
| ) |
Returns the cluster type of a given cluster in a mesh.
| struct KzuMaterial* kzuMeshGetMaterial | ( | const struct KzuMesh * | mesh, |
| kzUint | clusterIndex | ||
| ) |
Gets the material of a given cluster in a mesh.
| kzsError kzuMeshSetMaterial | ( | const struct KzuMesh * | mesh, |
| kzUint | clusterIndex, | ||
| struct KzuMaterial * | material | ||
| ) |
Sets the material of a given cluster in a mesh.
| kzsError kzuMeshApplyMorph | ( | struct KzuMesh * | mesh, |
| const struct KzcMemoryManager * | quickMemoryManager | ||
| ) |
Applies morphing by calculating dynamic vertex attributes based on morph properties.
| kzsError kzuMeshApplySkeleton | ( | const struct KzuMesh * | mesh, |
| const struct KzuObjectNode * | baseNode, | ||
| const struct KzcMemoryManager * | quickMemoryManager, | ||
| const struct KzcDynamicArray * | transformedObjectList | ||
| ) |
Applies mesh skeleton (bones).
| kzsError kzuMeshUpdateBoundingBox | ( | const struct KzuMesh * | mesh, |
| struct KzuObjectNode * | baseNode, | ||
| const struct KzcDynamicArray * | transformedObjectList, | ||
| kzBool * | out_isSkinned | ||
| ) |
Updates the bounding box of a mesh based on the mesh skeleton and current pose.
Returns the number of bones in a mesh skeleton.
| struct KzuObjectNode* kzuMeshGetBoneNode | ( | const struct KzuMesh * | mesh, |
| kzUint | boneIndex | ||
| ) |
Returns the bone node of a given bone in a mesh skeleton.
| struct KzuObjectNode* kzuMeshGetBoneChildJoint | ( | const struct KzuMesh * | mesh, |
| kzUint | boneIndex | ||
| ) |
Returns the child joint node of a given bone in a mesh skeleton.
| kzsError kzuMeshAttach | ( | struct KzuMesh * | mesh, |
| struct KzuObjectNode * | baseNode | ||
| ) |
Attach bone node for the mesh.
| void kzuMeshSetPropertyManager | ( | struct KzuMesh * | mesh, |
| struct KzuPropertyManager * | propertyManager | ||
| ) |
Sets the property manager of the mesh.
Warning: This function is deprecated and will be removed in future release.
| kzsError kzuMeshGetMappedShaders | ( | const struct KzuMesh * | mesh, |
| struct KzcDynamicArray ** | out_mappedShaders | ||
| ) |
Returns array of shaders having attribute mappings in this mesh.
Caller of this function should delete returned array after use.
| kzsError kzuMeshRemoveAttributeMappingForShader | ( | const struct KzuMesh * | mesh, |
| const struct KzuShader * | shader | ||
| ) |
Removes attribute mapping for the shader.
Nothing will happen if there is no mapping for this shader
| kzsError kzuMeshReplaceAttributeMappingForShader | ( | const struct KzuMesh * | mesh, |
| const struct KzuShader * | shader, | ||
| const struct KzuShader * | newShader | ||
| ) |
Replaces attribute mapping for the shader.
Nothing will happen if there is no mapping for this shader
| kzsError kzuMeshSetAttributeMapping | ( | const struct KzuMesh * | mesh, |
| const struct KzuShader * | shader, | ||
| kzString | shaderAttribute, | ||
| const struct KzuMesh * | targetMesh, | ||
| kzUint | attributeIndex | ||
| ) |
Sets attribute mapping for the shader attribute.
| kzBool kzuMeshGetAttributeMapping | ( | const struct KzuMesh * | mesh, |
| const struct KzuShader * | shader, | ||
| kzString | shaderAttribute, | ||
| const struct KzuMesh ** | out_targetMesh, | ||
| kzUint * | out_attributeIndex | ||
| ) |
Gets attribute mapping for shader attribute.
Returns KZ_TRUE if mapping has been found.
| kzsError kzuMeshRemoveAttributeMapping | ( | const struct KzuMesh * | mesh, |
| const struct KzuShader * | shader, | ||
| kzString | shaderAttribute | ||
| ) |
Removes attribute mapping for shader attribute.
| const KzuResourceType KZU_RESOURCE_TYPE_MESH |
Resource type identifier for mesh.