pub struct Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx> { /* private fields */ }Expand description
A builder for rendering a chunk of geometry as a batch.
Several values must be assigned before the render
method can be called:
- primitives: A list of primitives, each a tuple of indices into the list of vertices (TODO: handling oob)
- vertices: A list of vertices
- shader: The combined vertex and fragment shader used
- target: The render target to render into
- context: The rendering context and settings used. (TODO: optional?)
Additionally, setting the following values is optional:
Implementations§
Source§impl<Prim, Vtx, Uni, Shd, Tgt, Ctx> Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>
impl<Prim, Vtx, Uni, Shd, Tgt, Ctx> Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>
Sourcepub fn primitives<P: Clone>(
self,
prims: impl AsRef<[P]>,
) -> Batch<P, Vtx, Uni, Shd, Tgt, Ctx>
pub fn primitives<P: Clone>( self, prims: impl AsRef<[P]>, ) -> Batch<P, Vtx, Uni, Shd, Tgt, Ctx>
Sets the primitives to be rendered.
The primitives are copied into the batch.
Sourcepub fn vertices<V: Clone>(
self,
verts: impl AsRef<[V]>,
) -> Batch<Prim, V, Uni, Shd, Tgt, Ctx>
pub fn vertices<V: Clone>( self, verts: impl AsRef<[V]>, ) -> Batch<Prim, V, Uni, Shd, Tgt, Ctx>
Sets the vertices to be rendered.
The vertices are cloned into the batch.
Sourcepub fn mesh<A: Clone>(
self,
mesh: &Mesh<A>,
) -> Batch<Tri<usize>, Vertex3<A>, Uni, Shd, Tgt, Ctx>
pub fn mesh<A: Clone>( self, mesh: &Mesh<A>, ) -> Batch<Tri<usize>, Vertex3<A>, Uni, Shd, Tgt, Ctx>
Clones faces and vertices from a mesh to this batch.
Sourcepub fn uniform<U: Copy>(self, uniform: U) -> Batch<Prim, Vtx, U, Shd, Tgt, Ctx>
pub fn uniform<U: Copy>(self, uniform: U) -> Batch<Prim, Vtx, U, Shd, Tgt, Ctx>
Sets the uniform data to be passed to the vertex shaders.
Sourcepub fn shader<V: Vary, U, S: Shader<Vtx, V, U>>(
self,
shader: S,
) -> Batch<Prim, Vtx, Uni, S, Tgt, Ctx>
pub fn shader<V: Vary, U, S: Shader<Vtx, V, U>>( self, shader: S, ) -> Batch<Prim, Vtx, Uni, S, Tgt, Ctx>
Sets the combined vertex and fragment shader.
Sourcepub fn viewport(self, viewport: Mat4x4<NdcToScreen>) -> Self
pub fn viewport(self, viewport: Mat4x4<NdcToScreen>) -> Self
Sets the viewport matrix.
Trait Implementations§
Source§impl<Prim: Clone, Vtx: Clone, Uni: Clone, Shd: Clone, Tgt: Clone, Ctx: Clone> Clone for Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>
impl<Prim: Clone, Vtx: Clone, Uni: Clone, Shd: Clone, Tgt: Clone, Ctx: Clone> Clone for Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>
Auto Trait Implementations§
impl<Prim, Vtx, Uni, Shd, Tgt, Ctx> Freeze for Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>
impl<Prim, Vtx, Uni, Shd, Tgt, Ctx> RefUnwindSafe for Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>where
Uni: RefUnwindSafe,
Shd: RefUnwindSafe,
Tgt: RefUnwindSafe,
Ctx: RefUnwindSafe,
Prim: RefUnwindSafe,
Vtx: RefUnwindSafe,
impl<Prim, Vtx, Uni, Shd, Tgt, Ctx> Send for Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>
impl<Prim, Vtx, Uni, Shd, Tgt, Ctx> Sync for Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>
impl<Prim, Vtx, Uni, Shd, Tgt, Ctx> Unpin for Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>
impl<Prim, Vtx, Uni, Shd, Tgt, Ctx> UnwindSafe for Batch<Prim, Vtx, Uni, Shd, Tgt, Ctx>where
Uni: UnwindSafe,
Shd: UnwindSafe,
Tgt: UnwindSafe,
Ctx: UnwindSafe,
Prim: UnwindSafe,
Vtx: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more