logo
pub trait TessVertexData<S>: Vertex where
    S: ?Sized
{ type Data; fn coherent_len(data: &Self::Data) -> Result<usize, TessError>; }
Expand description

Vertex input data of a TessBuilder.

This trait defines the storage of vertices that a TessBuilder will use to build its internal storage on the backend.

There are two implementors of this trait:

  • impl<V> TessVertexData<Interleaved> for V where V: Vertex
  • impl<V> TessVertexData<Deinterleaved> for V where V: Vertex

For the situation where S is Interleaved, this trait associates the data (with TessVertexData::Data) to be a Vec<V>. What it means is that the TessBuilder will build the vertices as a Vec<V>, where V: Vertex, implementing an interleaved memory layout.

For the situation where S is Deinterleaved, this trait associates the data to be a Vec<DeinterleavedData>. DeinterleavedData is a special type used to store a collection of one of the attributes of a V: Vertex. For instance, if V: Vertex has two attributes, vertices will end up in two DeinterleavedData: the first one for the first attribute, the second one for the second attribute. The TessBuilder will handle that logic for you when you will use the TessBuilder::set_vertices by tracking at the type-level which set of attributes you are setting.

Parametricity

Required Associated Types

Vertex storage type.

Required Methods

Coherent length of the vertices.

Vertices length can be incoherent for some implementations of TessVertexData::Data, especially with deinterleaved memory. For this reason, this method can fail with TessError.

Implementors