pub struct ShaderPass<S>where
S: SequoiShader,{ /* private fields */ }Expand description
A configured shader draw that can be handed to a canvas or reused.
Inputs are optional: Painter samples transparent white for textures the
pass does not bind. Self::primary_input binds the shader’s first
declared texture, which is what most single-input effects need.
Implementations§
Source§impl<S> ShaderPass<S>where
S: SequoiShader,
impl<S> ShaderPass<S>where
S: SequoiShader,
pub fn new(shader: S) -> ShaderPass<S>
Sourcepub fn at(self, rect: Rect) -> ShaderPass<S>
pub fn at(self, rect: Rect) -> ShaderPass<S>
Draws into rect. Without it the canvas bounds are used.
Sourcepub fn uv(self, uv: [f32; 4]) -> ShaderPass<S>
pub fn uv(self, uv: [f32; 4]) -> ShaderPass<S>
Samples the shader inputs with an explicit UV window.
Sourcepub fn blend(self, blend: BlendMode) -> ShaderPass<S>
pub fn blend(self, blend: BlendMode) -> ShaderPass<S>
Overrides the blend mode for this pass only.
Sourcepub fn input(self, name: &'static str, input: TexInput) -> ShaderPass<S>
pub fn input(self, name: &'static str, input: TexInput) -> ShaderPass<S>
Binds input to the shader texture parameter name.
Sourcepub fn primary_input(self, input: TexInput) -> ShaderPass<S>
pub fn primary_input(self, input: TexInput) -> ShaderPass<S>
Binds the first texture declared by the shader, unless already bound.
This removes the need to repeat the parameter name at every call site.
Sourcepub fn layers(self, first: TexInput, second: TexInput) -> ShaderPass<S>
pub fn layers(self, first: TexInput, second: TexInput) -> ShaderPass<S>
Binds the first two declared textures in order.
pub fn name(&self) -> &'static str
pub fn target_rect(&self) -> Option<Rect>
Trait Implementations§
Source§impl<S> Clone for ShaderPass<S>where
S: Clone + SequoiShader,
impl<S> Clone for ShaderPass<S>where
S: Clone + SequoiShader,
Source§fn clone(&self) -> ShaderPass<S>
fn clone(&self) -> ShaderPass<S>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<S> Freeze for ShaderPass<S>where
S: Freeze,
impl<S> RefUnwindSafe for ShaderPass<S>where
S: RefUnwindSafe,
impl<S> Send for ShaderPass<S>where
S: Send,
impl<S> Sync for ShaderPass<S>where
S: Sync,
impl<S> Unpin for ShaderPass<S>where
S: Unpin,
impl<S> UnsafeUnpin for ShaderPass<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for ShaderPass<S>where
S: 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