Struct MeshDataTool
Helper tool to access and edit Mesh
data.
struct MeshDataTool
;
MeshDataTool provides access to individual vertices in a Mesh
. It allows users to read and edit vertex data of meshes. It also creates an array of faces and edges.
To use MeshDataTool, load a mesh with createFromSurface
. When you are finished editing the data commit the data to a mesh with commitToSurface
.
Below is an example of how MeshDataTool may be used.
var mdt = MeshDataTool.new() mdt.create_from_surface(mesh, 0) for i in range(mdt.get_vertex_count()): var vertex = mdt.get_vertex(i) ... mdt.set_vertex(i, vertex) mesh.surface_remove(0) mdt.commit_to_surface(mesh)
Methods
Name | Description |
---|---|
clear
|
Clears all data currently in MeshDataTool. |
commitToSurface
|
Adds a new surface to specified Mesh with edited data.
|
createFromSurface
|
Uses specified surface of given Mesh to populate data for MeshDataTool.
Requires Mesh with primitive type constant Mesh .
|
getEdgeCount
|
Returns the number of edges in this Mesh .
|
getEdgeFaces
|
Returns array of faces that touch given edge. |
getEdgeMeta
|
Returns meta information assigned to given edge. |
getEdgeVertex
|
Returns index of specified vertex connected to given edge. Vertex argument can only be 0 or 1 because edges are comprised of two vertices. |
getFaceCount
|
Returns the number of faces in this Mesh .
|
getFaceEdge
|
Returns specified edge associated with given face. Edge argument must 2 or less because a face only has three edges. |
getFaceMeta
|
Returns the metadata associated with the given face. |
getFaceNormal
|
Calculates and returns the face normal of the given face. |
getFaceVertex
|
Returns the specified vertex of the given face. Vertex argument must be 2 or less because faces contain three vertices. |
getFormat
|
Returns the Mesh 's format. Format is an integer made up of Mesh format flags combined together. For example, a mesh containing both vertices and normals would return a format of 3 because constant ArrayMesh is 1 and constant ArrayMesh is 2 .
See ArrayMesh for a list of format flags.
|
getMaterial
|
Returns the material assigned to the Mesh .
|
getVertex
|
Returns the vertex at given index. |
getVertexBones
|
Returns the bones of the given vertex. |
getVertexColor
|
Returns the color of the given vertex. |
getVertexCount
|
Returns the total number of vertices in Mesh .
|
getVertexEdges
|
Returns an array of edges that share the given vertex. |
getVertexFaces
|
Returns an array of faces that share the given vertex. |
getVertexMeta
|
Returns the metadata associated with the given vertex. |
getVertexNormal
|
Returns the normal of the given vertex. |
getVertexTangent
|
Returns the tangent of the given vertex. |
getVertexUv
|
Returns the UV of the given vertex. |
getVertexUv2
|
Returns the UV2 of the given vertex. |
getVertexWeights
|
Returns bone weights of the given vertex. |
setEdgeMeta
|
Sets the metadata of the given edge. |
setFaceMeta
|
Sets the metadata of the given face. |
setMaterial
|
Sets the material to be used by newly-constructed Mesh .
|
setVertex
|
Sets the position of the given vertex. |
setVertexBones
|
Sets the bones of the given vertex. |
setVertexColor
|
Sets the color of the given vertex. |
setVertexMeta
|
Sets the metadata associated with the given vertex. |
setVertexNormal
|
Sets the normal of the given vertex. |
setVertexTangent
|
Sets the tangent of the given vertex. |
setVertexUv
|
Sets the UV of the given vertex. |
setVertexUv2
|
Sets the UV2 of the given vertex. |
setVertexWeights
|
Sets the bone weights of the given vertex. |