Shader

Struct Shader 

Source
pub struct Shader<Vs, Fs> {
    pub vertex_shader: Vs,
    pub fragment_shader: Fs,
}
Expand description

A type that composes a vertex and a fragment shader.

Fields§

§vertex_shader: Vs§fragment_shader: Fs

Implementations§

Source§

impl<Vs, Fs> Shader<Vs, Fs>

Source

pub const fn new<In, Uni, Pos, Attr>(vs: Vs, fs: Fs) -> Self
where Vs: VertexShader<In, Uni, Output = Vertex<Pos, Attr>>, Fs: FragmentShader<Attr>,

Returns a new Shader with vs as the vertex shader and fs as the fragment shader.

Trait Implementations§

Source§

impl<Vs: Clone, Fs: Clone> Clone for Shader<Vs, Fs>

Source§

fn clone(&self) -> Shader<Vs, Fs>

Returns a duplicate 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<Vs, Fs, Var> FragmentShader<Var> for Shader<Vs, Fs>
where Fs: FragmentShader<Var>,

Source§

fn shade_fragment(&self, frag: Frag<Var>) -> Option<Color4>

Computes the color of frag. Returns either Some(color), or None if the fragment should be discarded. Read more
Source§

impl<In, Vs, Fs, Uni> VertexShader<In, Uni> for Shader<Vs, Fs>
where Vs: VertexShader<In, Uni>,

Source§

type Output = <Vs as VertexShader<In, Uni>>::Output

The type of the output vertex.
Source§

fn shade_vertex(&self, vertex: In, uniform: Uni) -> Self::Output

Transforms vertex and does performs other per-vertex computations needed, outputting a new vertex of type Self::Output. Custom data that is not vertex-specific can be passed in the uniform parameter. Read more
Source§

impl<Vs: Copy, Fs: Copy> Copy for Shader<Vs, Fs>

Auto Trait Implementations§

§

impl<Vs, Fs> Freeze for Shader<Vs, Fs>
where Vs: Freeze, Fs: Freeze,

§

impl<Vs, Fs> RefUnwindSafe for Shader<Vs, Fs>

§

impl<Vs, Fs> Send for Shader<Vs, Fs>
where Vs: Send, Fs: Send,

§

impl<Vs, Fs> Sync for Shader<Vs, Fs>
where Vs: Sync, Fs: Sync,

§

impl<Vs, Fs> Unpin for Shader<Vs, Fs>
where Vs: Unpin, Fs: Unpin,

§

impl<Vs, Fs> UnwindSafe for Shader<Vs, Fs>
where Vs: UnwindSafe, Fs: UnwindSafe,

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.
Source§

impl<S, Vtx, Var, Uni> Shader<Vtx, Var, Uni> for S
where S: VertexShader<Vtx, Uni, Output = Vertex<Vector<[f32; 4], Proj3>, Var>> + FragmentShader<Var>,