logo

Trait luminance::backend::tess::VertexSlice[][src]

pub unsafe trait VertexSlice<'a, V, I, W, S, T>: Tess<V, I, W, S> where
    V: TessVertexData<S>,
    I: TessIndex,
    W: TessVertexData<S>,
    S: ?Sized
{ type VertexSliceRepr: 'a + Deref<Target = [T]>; type VertexSliceMutRepr: 'a + DerefMut<Target = [T]>; unsafe fn vertices(
        tess: &'a mut Self::TessRepr
    ) -> Result<Self::VertexSliceRepr, TessMapError>;
unsafe fn vertices_mut(
        tess: &'a mut Self::TessRepr
    ) -> Result<Self::VertexSliceMutRepr, TessMapError>; }
Expand description

Slice vertex data on CPU.

This trait must be implemented by the backend so that it’s possible to slice the vertex data. The idea is that the vertex storage is backend-dependent; the backend can decide to cache the data, or not, and we should assume the data to live in a memory that is costly to access. For this reason, slicing the vertex data requires to get an object on which one can use Deref (and possibly DerefMut). The VertexSlice::vertices and VertexSlice::vertices_mut methods must get such objects. Implementations will typically map memory regions and retain the mapped data until the VertexSlice::VertexSliceRepr and VertexSlice::VertexSliceMutRepr objects are dropped (c.f. Drop).

Associated Types

Backend representation of an immutable vertex slice.

Backend representation of a mutable vertex slice.

Required methods

Obtain an immutable vertex slice.

Even though this method returns an immutable slice, it has to mutably borrow the tessellation to prevent having two immutable slices living at the same time. This is a limitation that some backends might need.

Obtain a mutable vertex slice.

Implementors