Skip to main content

Mesh

Type Alias Mesh 

pub type Mesh = RefHandle<SkMesh>;
Expand description

A vertex buffer, a topology, optionally an index buffer, and a compatible MeshSpecification.

The data in the vertex buffer is expected to contain the attributes described by the spec for vertex_count vertices, beginning at vertex_offset. vertex_offset must be aligned to the MeshSpecification’s vertex stride. The size of the buffer must be at least vertex_offset + spec.stride() * vertex_count (even if vertex attributes contains pad at the end of the stride). If the specified bounds do not contain all the points output by the spec’s vertex program when applied to the vertices in the custom mesh, then the result is undefined.

Mesh::make_indexed() may be used to create an indexed mesh. index_count indices are read from the index buffer at the specified offset, which must be aligned to 2. The indices are always unsigned 16-bit integers. The index count must be at least 3.

If Mesh::make() is used, the implicit index sequence is 0, 1, 2, 3, … and vertex_count must be at least 3.

Both Mesh::make() and Mesh::make_indexed() take a Data with the uniform values. See MeshSpecification::uniform_size() and MeshSpecification::uniforms() for sizing and packing uniforms into the Data.

Aliased Type§

pub struct Mesh(/* private fields */);