pub struct Batch<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:
- faces: A list of triangles, each a triplet 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<Vtx, Uni, Shd, Tgt, Ctx> Batch<Vtx, Uni, Shd, Tgt, Ctx>
impl<Vtx, Uni, Shd, Tgt, Ctx> Batch<Vtx, Uni, Shd, Tgt, Ctx>
Sourcepub fn faces(self, faces: impl AsRef<[Tri<usize>]>) -> Self
pub fn faces(self, faces: impl AsRef<[Tri<usize>]>) -> Self
Sets the faces to be rendered.
The faces are copied into the batch.
Sourcepub fn vertices<V: Clone>(
self,
verts: impl AsRef<[V]>,
) -> Batch<V, Uni, Shd, Tgt, Ctx>
pub fn vertices<V: Clone>( self, verts: impl AsRef<[V]>, ) -> Batch<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<Vertex<A>, Uni, Shd, Tgt, Ctx>
pub fn mesh<A: Clone>( self, mesh: &Mesh<A>, ) -> Batch<Vertex<A>, Uni, Shd, Tgt, Ctx>
Clones faces and vertices from a mesh to this batch.
Sourcepub fn uniform<U: Copy>(self, uniform: U) -> Batch<Vtx, U, Shd, Tgt, Ctx>
pub fn uniform<U: Copy>(self, uniform: U) -> Batch<Vtx, U, Shd, Tgt, Ctx>
Sets the uniform data to be passed to the vertex shaders.
Sourcepub fn shader<V: Vary, S: Shader<Vtx, V, Uni>>(
self,
shader: S,
) -> Batch<Vtx, Uni, S, Tgt, Ctx>
pub fn shader<V: Vary, S: Shader<Vtx, V, Uni>>( self, shader: S, ) -> Batch<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<Vtx: Clone, Uni: Clone, Shd: Clone, Tgt: Clone, Ctx: Clone> Clone for Batch<Vtx, Uni, Shd, Tgt, Ctx>
impl<Vtx: Clone, Uni: Clone, Shd: Clone, Tgt: Clone, Ctx: Clone> Clone for Batch<Vtx, Uni, Shd, Tgt, Ctx>
Auto Trait Implementations§
impl<Vtx, Uni, Shd, Tgt, Ctx> Freeze for Batch<Vtx, Uni, Shd, Tgt, Ctx>
impl<Vtx, Uni, Shd, Tgt, Ctx> RefUnwindSafe for Batch<Vtx, Uni, Shd, Tgt, Ctx>where
Uni: RefUnwindSafe,
Shd: RefUnwindSafe,
Tgt: RefUnwindSafe,
Ctx: RefUnwindSafe,
Vtx: RefUnwindSafe,
impl<Vtx, Uni, Shd, Tgt, Ctx> Send for Batch<Vtx, Uni, Shd, Tgt, Ctx>
impl<Vtx, Uni, Shd, Tgt, Ctx> Sync for Batch<Vtx, Uni, Shd, Tgt, Ctx>
impl<Vtx, Uni, Shd, Tgt, Ctx> Unpin for Batch<Vtx, Uni, Shd, Tgt, Ctx>
impl<Vtx, Uni, Shd, Tgt, Ctx> UnwindSafe for Batch<Vtx, Uni, Shd, Tgt, Ctx>
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