Mesh:getVertexFormat

Edit

Returns the vertex format of the Mesh, which is a list of "attributes" that make up the data for each vertex (position, color, UV, etc.).

format = Mesh:getVertexFormat()

Arguments

None

Returns

NameTypeDescription
formattable The vertex format.
.[][1]string The name of the attribute.
.[][2]DataType The type of the attribute.
.[][3]number The byte offset of the attribute.

Notes

If no vertex format is given when the Mesh is created, it will use a default format:

{
  { 'VertexPosition', 'vec3', 0 },
  { 'VertexNormal', 'vec3', 12 },
  { 'VertexUV', 'vec2', 24 }
}

The name of the vertex attribute corresponds to an in input variable in a vertex shader.

There are a few built-in attributes that all shaders will understand and use by default:

Name Description
VertexPosition The position of the vertex.
VertexNormal The normal vector of the vertex.
VertexUV The texture coordinate of the vertex.
VertexColor The color of the vertex (linear color space).
VertexTangent The tangent vector of the vertex.

See the Shaders and Meshes guides for more info.

See also