[−][src]Struct luminance::tess::TessBuilder
Tess
builder object.
This type allows to create Tess
via a builder pattern. You have several flavors of
possible vertex storage situations, as well as data encoding, described below.
Vertex storage
Interleaved
You can pass around interleaved vertices and indices. Those are encoded in Vec<T>
. You
typically want to use this when you already have the vertices and/or indices allocated somewhere,
as the interface will use the input vector as a source of truth for lengths.
Deinterleaved
This is the same as interleaved data in terms of interface, but the T
type is interpreted
a bit differently. Here, the encoding is (Vec<Field0>, Vec<Field1>, …)
, where Field0
,
Field1
etc. are all the ordered fieds in T
.
That representation allows field-based operation later on Tess
, while it would be
impossible with the interleaved version (you would need to get all the fields at once, since
you would work onT
directly and each of its fields).
Data encoding
- Vectors: you can pass vectors as input data for both vertices and indices. Those will be interpreted differently based on the vertex storage you chose for vertices, and the normal way for indices.
- Buffers: you can pass
Buffer
objects, too. Those are more flexible than vectors as you can use all of theBuffer
API before sending them to the builder. - Disabled: disabling means that no data will be passed to the GPU. You can disable independently vertex data and/or index data.
Parametricity
B
is the backend typeV
is the vertex type.S
is the storage type.
Implementations
impl<'a, B, V, I, W, S> TessBuilder<'a, B, V, I, W, S> where
B: ?Sized,
V: TessVertexData<S>,
I: TessIndex,
W: TessVertexData<S>,
S: ?Sized,
[src]
B: ?Sized,
V: TessVertexData<S>,
I: TessIndex,
W: TessVertexData<S>,
S: ?Sized,
pub fn set_mode(self, mode: Mode) -> Self
[src]
Set the Mode
to connect vertices.
Calling that function twice replaces the previously set value.
pub fn set_vertex_nb(self, vert_nb: usize) -> Self
[src]
Set the default number of vertices to render.
Calling that function twice replaces the previously set value.
pub fn set_instance_nb(self, inst_nb: usize) -> Self
[src]
Set the default number of instances to render.
Calling that function twice replaces the previously set value.
pub fn set_primitive_restart_index(self, restart_index: I) -> Self
[src]
Set the primitive restart index.
Calling that function twice replaces the previously set value.
impl<'a, B, V, I, W, S> TessBuilder<'a, B, V, I, W, S> where
B: ?Sized,
V: TessVertexData<S>,
I: TessIndex,
W: TessVertexData<S>,
S: ?Sized,
[src]
B: ?Sized,
V: TessVertexData<S>,
I: TessIndex,
W: TessVertexData<S>,
S: ?Sized,
pub fn new<C>(ctx: &'a mut C) -> Self where
C: GraphicsContext<Backend = B>,
[src]
C: GraphicsContext<Backend = B>,
Create a new default TessBuilder
.
Notes
Feel free to use the GraphicsContext::new_tess
method for a simpler method.
impl<'a, B, V, W, S> TessBuilder<'a, B, V, (), W, S> where
B: ?Sized,
V: TessVertexData<S>,
W: TessVertexData<S>,
S: ?Sized,
[src]
B: ?Sized,
V: TessVertexData<S>,
W: TessVertexData<S>,
S: ?Sized,
pub fn set_indices<I, X>(self, indices: X) -> TessBuilder<'a, B, V, I, W, S> where
X: Into<Vec<I>>,
[src]
X: Into<Vec<I>>,
Add indices to be bundled in the Tess
.
Every time you call that function, the set of indices is replaced by the one you provided.
The type of expected indices is ruled by the II
type variable you chose.
impl<'a, B, I, W> TessBuilder<'a, B, (), I, W, Interleaved> where
B: ?Sized,
I: TessIndex,
W: TessVertexData<Interleaved>,
[src]
B: ?Sized,
I: TessIndex,
W: TessVertexData<Interleaved>,
pub fn set_vertices<V, X>(
self,
vertices: X
) -> TessBuilder<'a, B, V, I, W, Interleaved> where
X: Into<Vec<V>>,
V: TessVertexData<Interleaved, Data = Vec<V>>,
[src]
self,
vertices: X
) -> TessBuilder<'a, B, V, I, W, Interleaved> where
X: Into<Vec<V>>,
V: TessVertexData<Interleaved, Data = Vec<V>>,
Add vertices to be bundled in the Tess
.
Every time you call that function, the set of vertices is replaced by the one you provided.
impl<'a, B, I, V> TessBuilder<'a, B, V, I, (), Interleaved> where
B: ?Sized,
I: TessIndex,
V: TessVertexData<Interleaved>,
[src]
B: ?Sized,
I: TessIndex,
V: TessVertexData<Interleaved>,
pub fn set_instances<W, X>(
self,
instances: X
) -> TessBuilder<'a, B, V, I, W, Interleaved> where
X: Into<Vec<W>>,
W: TessVertexData<Interleaved, Data = Vec<W>>,
[src]
self,
instances: X
) -> TessBuilder<'a, B, V, I, W, Interleaved> where
X: Into<Vec<W>>,
W: TessVertexData<Interleaved, Data = Vec<W>>,
Add instances to be bundled in the Tess
.
Every time you call that function, the set of instances is replaced by the one you provided.
impl<'a, B, V, I, W> TessBuilder<'a, B, V, I, W, Deinterleaved> where
B: ?Sized,
V: TessVertexData<Deinterleaved, Data = Vec<DeinterleavedData>>,
I: TessIndex,
W: TessVertexData<Deinterleaved, Data = Vec<DeinterleavedData>>,
[src]
B: ?Sized,
V: TessVertexData<Deinterleaved, Data = Vec<DeinterleavedData>>,
I: TessIndex,
W: TessVertexData<Deinterleaved, Data = Vec<DeinterleavedData>>,
pub fn set_attributes<A, X>(self, attributes: X) -> Self where
X: Into<Vec<A>>,
V: Deinterleave<A>,
[src]
X: Into<Vec<A>>,
V: Deinterleave<A>,
Add vertices to be bundled in the Tess
.
Every time you call that function, the set of vertices is replaced by the one you provided.
pub fn set_instance_attributes<A, X>(self, attributes: X) -> Self where
X: Into<Vec<A>>,
W: Deinterleave<A>,
[src]
X: Into<Vec<A>>,
W: Deinterleave<A>,
Add instances to be bundled in the Tess
.
Every time you call that function, the set of instances is replaced by the one you provided.
impl<'a, B: ?Sized, V, I, W, S> TessBuilder<'a, B, V, I, W, S> where
B: TessBackend<V, I, W, S>,
V: TessVertexData<S>,
I: TessIndex,
W: TessVertexData<S>,
[src]
B: TessBackend<V, I, W, S>,
V: TessVertexData<S>,
I: TessIndex,
W: TessVertexData<S>,
pub fn build(self) -> Result<Tess<B, V, I, W, S>, TessError>
[src]
Build a Tess
if the TessBuilder
has enough data and is in a valid state. What is
needed is backend-dependent but most of the time, you will want to:
- Set a
Mode
. - Give vertex data and optionally indices, or give none of them but only a number of vertices (attributeless objects).
- If you provide vertex data by submitting several sets with
TessBuilder::set_attributes
and/orTessBuilder::set_instances
, do not forget that you must submit sets with the same size. Otherwise, the GPU will not know what values use for missing attributes in vertices.
Trait Implementations
impl<'a, B, V: Debug, I: Debug, W: Debug, S> Debug for TessBuilder<'a, B, V, I, W, S> where
B: Debug + ?Sized,
V: TessVertexData<S>,
W: TessVertexData<S>,
S: Debug + ?Sized,
V::Data: Debug,
W::Data: Debug,
[src]
B: Debug + ?Sized,
V: TessVertexData<S>,
W: TessVertexData<S>,
S: Debug + ?Sized,
V::Data: Debug,
W::Data: Debug,
Auto Trait Implementations
impl<'a, B: ?Sized, V, I, W, S: ?Sized> RefUnwindSafe for TessBuilder<'a, B, V, I, W, S> where
B: RefUnwindSafe,
I: RefUnwindSafe,
<V as TessVertexData<S>>::Data: RefUnwindSafe,
<W as TessVertexData<S>>::Data: RefUnwindSafe,
[src]
B: RefUnwindSafe,
I: RefUnwindSafe,
<V as TessVertexData<S>>::Data: RefUnwindSafe,
<W as TessVertexData<S>>::Data: RefUnwindSafe,
impl<'a, B: ?Sized, V, I, W, S: ?Sized> Send for TessBuilder<'a, B, V, I, W, S> where
B: Send,
I: Send,
<V as TessVertexData<S>>::Data: Send,
<W as TessVertexData<S>>::Data: Send,
[src]
B: Send,
I: Send,
<V as TessVertexData<S>>::Data: Send,
<W as TessVertexData<S>>::Data: Send,
impl<'a, B: ?Sized, V, I, W, S: ?Sized> Sync for TessBuilder<'a, B, V, I, W, S> where
B: Sync,
I: Sync,
<V as TessVertexData<S>>::Data: Sync,
<W as TessVertexData<S>>::Data: Sync,
[src]
B: Sync,
I: Sync,
<V as TessVertexData<S>>::Data: Sync,
<W as TessVertexData<S>>::Data: Sync,
impl<'a, B: ?Sized, V, I, W, S: ?Sized> Unpin for TessBuilder<'a, B, V, I, W, S> where
I: Unpin,
<V as TessVertexData<S>>::Data: Unpin,
<W as TessVertexData<S>>::Data: Unpin,
[src]
I: Unpin,
<V as TessVertexData<S>>::Data: Unpin,
<W as TessVertexData<S>>::Data: Unpin,
impl<'a, B, V, I = (), W = (), S = Interleaved> !UnwindSafe for TessBuilder<'a, B, V, I, W, S>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,