Mesh:attachAttributes

Attaches attributes from another Mesh onto this one. This can be used to share vertex data across multiple meshes without duplicating the data, and can also be used for instanced rendering by using the divisor parameter.

Attach all attributes from the other mesh.

Mesh:attachAttributes(mesh, divisor)

Arguments

NameTypeDefaultDescription
meshMeshThe Mesh to attach attributes from.
divisornumber0The attribute divisor for all attached attributes.

Returns

Nothing


Mesh:attachAttributes(mesh, divisor, ...)

Arguments

NameTypeDefaultDescription
meshMeshThe Mesh to attach attributes from.
divisornumber0The attribute divisor for all attached attributes.
...stringThe names of attributes to attach from the other Mesh.

Returns

Nothing


Mesh:attachAttributes(mesh, divisor, attributes)

Arguments

NameTypeDefaultDescription
meshMeshThe Mesh to attach attributes from.
divisornumber0The attribute divisor for all attached attributes.
attributestableA table of attribute names to attach from the other Mesh.

Returns

Nothing

Notes

The attribute divisor is a number used to control how the attribute data relates to instancing. If 0, then the attribute data is considered "per vertex", and each vertex will get the next element of the attribute's data. If the divisor 1 or more, then the attribute data is considered "per instance", and every N instances will get the next element of the attribute data.

To prevent cycles, it is not possible to attach attributes onto a Mesh that already has attributes attached to a different Mesh.

See also