spitfire_glow::graphics

Struct Shader

Source
pub struct Shader { /* private fields */ }

Implementations§

Source§

impl Shader

Source

pub const PASS_VERTEX_2D: &'static str = r#"#version 300 es layout(location = 0) in vec2 a_position; layout(location = 2) in vec4 a_color; out vec4 v_color; void main() { gl_Position = vec4(a_position, 0.0, 1.0); v_color = a_color; } "#

Source

pub const PASS_VERTEX_3D: &'static str = r#"#version 300 es layout(location = 0) in vec3 a_position; layout(location = 3) in vec4 a_color; out vec4 v_color; void main() { gl_Position = vec4(a_position, 1.0); v_color = a_color; } "#

Source

pub const PASS_FRAGMENT: &'static str = r#"#version 300 es precision highp float; precision highp int; in vec4 v_color; out vec4 o_color; void main() { o_color = v_color; } "#

Source

pub const COLORED_VERTEX_2D: &'static str = r#"#version 300 es layout(location = 0) in vec2 a_position; layout(location = 2) in vec4 a_color; out vec4 v_color; uniform mat4 u_projection_view; void main() { gl_Position = u_projection_view * vec4(a_position, 0.0, 1.0); v_color = a_color; } "#

Source

pub const COLORED_VERTEX_3D: &'static str = r#"#version 300 es layout(location = 0) in vec3 a_position; layout(location = 3) in vec4 a_color; out vec4 v_color; uniform mat4 u_projection_view; void main() { gl_Position = u_projection_view * vec4(a_position, 1.0); v_color = a_color; } "#

Source

pub const TEXTURED_VERTEX_2D: &'static str = r#"#version 300 es layout(location = 0) in vec2 a_position; layout(location = 1) in vec3 a_uv; layout(location = 2) in vec4 a_color; out vec4 v_color; out vec3 v_uv; uniform mat4 u_projection_view; void main() { gl_Position = u_projection_view * vec4(a_position, 0.0, 1.0); v_color = a_color; v_uv = a_uv; } "#

Source

pub const TEXTURED_VERTEX_3D: &'static str = r#"#version 300 es layout(location = 0) in vec3 a_position; layout(location = 2) in vec3 a_uv; layout(location = 3) in vec4 a_color; out vec4 v_color; out vec3 v_uv; uniform mat4 u_projection_view; void main() { gl_Position = u_projection_view * vec4(a_position, 1.0); v_color = a_color; v_uv = a_uv; } "#

Source

pub const TEXTURED_FRAGMENT: &'static str = r#"#version 300 es precision highp float; precision highp int; precision highp sampler2DArray; in vec4 v_color; in vec3 v_uv; out vec4 o_color; uniform sampler2DArray u_image; void main() { o_color = texture(u_image, v_uv) * v_color; } "#

Source

pub const TEXT_VERTEX: &'static str = r#"#version 300 es layout(location = 0) in vec2 a_position; layout(location = 1) in vec3 a_uv; layout(location = 2) in vec4 a_color; out vec4 v_color; out vec3 v_uv; uniform mat4 u_projection_view; void main() { gl_Position = u_projection_view * vec4(a_position, 0.0, 1.0); v_color = a_color; v_uv = a_uv; } "#

Source

pub const TEXT_FRAGMENT: &'static str = r#"#version 300 es precision highp float; precision highp int; precision highp sampler2DArray; in vec4 v_color; in vec3 v_uv; out vec4 o_color; uniform sampler2DArray u_image; void main() { float alpha = texture(u_image, v_uv).x; o_color = vec4(v_color.xyz, v_color.w * alpha); } "#

Source

pub fn handle(&self) -> GlowProgram

Source

pub fn set_shared_uniform( &mut self, id: impl Into<Cow<'static, str>>, value: GlowUniformValue, )

Source

pub fn unset_shared_uniform(&mut self, id: &str)

Source

pub fn get_shared_uniform(&self, id: &str) -> Option<GlowUniformValue>

Source

pub fn clear_shared_uniforms(&mut self)

Trait Implementations§

Source§

impl Clone for Shader

Source§

fn clone(&self) -> Shader

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 Debug for Shader

Source§

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

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

impl PartialEq for Shader

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

§

impl Freeze for Shader

§

impl !RefUnwindSafe for Shader

§

impl !Send for Shader

§

impl !Sync for Shader

§

impl Unpin for Shader

§

impl !UnwindSafe for Shader

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 u8)

🔬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.