rendy_mesh

Struct MeshBuilder

Source
pub struct MeshBuilder<'a> { /* private fields */ }
Expand description

Generics-free mesh builder.

Implementations§

Source§

impl<'a> MeshBuilder<'a>

Source

pub fn new() -> Self

Create empty builder.

Source

pub fn into_owned(self) -> MeshBuilder<'static>

Convert builder into fully owned type. This forces internal vertex and index buffers to be cloned, which allows borrowed source buffers to be released.

Source

pub fn with_indices<I>(self, indices: I) -> Self
where I: Into<Indices<'a>>,

Set indices buffer to the MeshBuilder

Source

pub fn set_indices<I>(&mut self, indices: I) -> &mut Self
where I: Into<Indices<'a>>,

Set indices buffer to the MeshBuilder

Source

pub fn with_vertices<V, D>(self, vertices: D) -> Self
where V: AsVertex + 'a, D: Into<Cow<'a, [V]>>,

Add another vertices to the MeshBuilder

Source

pub fn add_vertices<V, D>(&mut self, vertices: D) -> &mut Self
where V: AsVertex + 'a, D: Into<Cow<'a, [V]>>,

Add another vertices to the MeshBuilder

Source

pub fn with_prim_type(self, prim: Primitive) -> Self

Sets the primitive type of the mesh.

By default, meshes are constructed as triangle lists.

Source

pub fn set_prim_type(&mut self, prim: Primitive) -> &mut Self

Sets the primitive type of the mesh.

By default, meshes are constructed as triangle lists.

Source

pub fn build<B>( &self, queue: QueueId, factory: &Factory<B>, ) -> Result<Mesh<B>, UploadError>
where B: Backend,

Builds and returns the new mesh.

A mesh expects all vertex buffers to have the same number of elements. If those are not equal, the length of smallest vertex buffer is selected, effectively discaring extra data from larger buffers.

Note that contents of index buffer is not validated.

Trait Implementations§

Source§

impl<'a> Clone for MeshBuilder<'a>

Source§

fn clone(&self) -> MeshBuilder<'a>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for MeshBuilder<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<()> for MeshBuilder<'a>

Source§

fn from(vertices: ()) -> Self

Converts to this type from the input type.
Source§

impl<'a, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> From<(Vec<A>, Vec<B>, Vec<C>, Vec<D>, Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where A: AsVertex + 'a, B: AsVertex + 'a, C: AsVertex + 'a, D: AsVertex + 'a, E: AsVertex + 'a, F: AsVertex + 'a, G: AsVertex + 'a, H: AsVertex + 'a, I: AsVertex + 'a, J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<A>, Vec<B>, Vec<C>, Vec<D>, Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> From<(Vec<B>, Vec<C>, Vec<D>, Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where B: AsVertex + 'a, C: AsVertex + 'a, D: AsVertex + 'a, E: AsVertex + 'a, F: AsVertex + 'a, G: AsVertex + 'a, H: AsVertex + 'a, I: AsVertex + 'a, J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<B>, Vec<C>, Vec<D>, Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, C, D, E, F, G, H, I, J, K, L, M, N, O, P> From<(Vec<C>, Vec<D>, Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where C: AsVertex + 'a, D: AsVertex + 'a, E: AsVertex + 'a, F: AsVertex + 'a, G: AsVertex + 'a, H: AsVertex + 'a, I: AsVertex + 'a, J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<C>, Vec<D>, Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, D, E, F, G, H, I, J, K, L, M, N, O, P> From<(Vec<D>, Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where D: AsVertex + 'a, E: AsVertex + 'a, F: AsVertex + 'a, G: AsVertex + 'a, H: AsVertex + 'a, I: AsVertex + 'a, J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<D>, Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, E, F, G, H, I, J, K, L, M, N, O, P> From<(Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where E: AsVertex + 'a, F: AsVertex + 'a, G: AsVertex + 'a, H: AsVertex + 'a, I: AsVertex + 'a, J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<E>, Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, F, G, H, I, J, K, L, M, N, O, P> From<(Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where F: AsVertex + 'a, G: AsVertex + 'a, H: AsVertex + 'a, I: AsVertex + 'a, J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<F>, Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, G, H, I, J, K, L, M, N, O, P> From<(Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where G: AsVertex + 'a, H: AsVertex + 'a, I: AsVertex + 'a, J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<G>, Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, H, I, J, K, L, M, N, O, P> From<(Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where H: AsVertex + 'a, I: AsVertex + 'a, J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<H>, Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, I, J, K, L, M, N, O, P> From<(Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where I: AsVertex + 'a, J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<I>, Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, J, K, L, M, N, O, P> From<(Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where J: AsVertex + 'a, K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from( vertices: (Vec<J>, Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>), ) -> Self

Converts to this type from the input type.
Source§

impl<'a, K, L, M, N, O, P> From<(Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where K: AsVertex + 'a, L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from(vertices: (Vec<K>, Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)) -> Self

Converts to this type from the input type.
Source§

impl<'a, L, M, N, O, P> From<(Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where L: AsVertex + 'a, M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from(vertices: (Vec<L>, Vec<M>, Vec<N>, Vec<O>, Vec<P>)) -> Self

Converts to this type from the input type.
Source§

impl<'a, M, N, O, P> From<(Vec<M>, Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where M: AsVertex + 'a, N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from(vertices: (Vec<M>, Vec<N>, Vec<O>, Vec<P>)) -> Self

Converts to this type from the input type.
Source§

impl<'a, N, O, P> From<(Vec<N>, Vec<O>, Vec<P>)> for MeshBuilder<'a>
where N: AsVertex + 'a, O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from(vertices: (Vec<N>, Vec<O>, Vec<P>)) -> Self

Converts to this type from the input type.
Source§

impl<'a, O, P> From<(Vec<O>, Vec<P>)> for MeshBuilder<'a>
where O: AsVertex + 'a, P: AsVertex + 'a,

Source§

fn from(vertices: (Vec<O>, Vec<P>)) -> Self

Converts to this type from the input type.
Source§

impl<'a, P> From<(Vec<P>,)> for MeshBuilder<'a>
where P: AsVertex + 'a,

Source§

fn from(vertices: (Vec<P>,)) -> Self

Converts to this type from the input type.
Source§

impl<'a, A> From<Vec<A>> for MeshBuilder<'a>
where A: AsVertex + 'a,

Source§

fn from(vertices: Vec<A>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for MeshBuilder<'a>

§

impl<'a> RefUnwindSafe for MeshBuilder<'a>

§

impl<'a> Send for MeshBuilder<'a>

§

impl<'a> Sync for MeshBuilder<'a>

§

impl<'a> Unpin for MeshBuilder<'a>

§

impl<'a> UnwindSafe for MeshBuilder<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.