pub struct ShaderBinding {
pub handle: ShaderHandle,
pub uniforms: UniformBlock,
}Expand description
A shader handle plus the uniforms to bind for one draw.
Fields§
§handle: ShaderHandle§uniforms: UniformBlockImplementations§
Source§impl ShaderBinding
impl ShaderBinding
pub fn stock(shader: StockShader) -> Self
Sourcepub fn custom(name: &'static str) -> Self
pub fn custom(name: &'static str) -> Self
Examples found in repository?
More examples
examples/custom_paint.rs (line 60)
44fn graph_cell(lane: u8, selected: bool) -> El {
45 let lane_color = lane_palette(lane);
46 let ring_color = if selected {
47 Color::srgb_u8(245, 245, 250)
48 } else {
49 lane_color
50 };
51 let ring_w = if selected { 2.5 } else { 1.5 };
52 let radius = 5.0;
53 let line_w = 2.0;
54 let lane_frac = (lane as f32 + 0.5) / LANE_COUNT as f32;
55
56 El::new(Kind::Custom("graph_cell"))
57 .width(Size::Fixed(GRAPH_WIDTH))
58 .height(Size::Fixed(ROW_HEIGHT))
59 .shader(
60 ShaderBinding::custom("commit_node")
61 .color("vec_a", tokens::BACKGROUND)
62 .color("vec_b", ring_color)
63 .vec4("vec_c", [radius, ring_w, line_w, lane_frac]),
64 )
65 .fill(lane_color)
66}pub fn with(self, key: &'static str, value: UniformValue) -> Self
pub fn set(&mut self, key: &'static str, value: UniformValue)
Sourcepub fn color(self, key: &'static str, c: Color) -> Self
pub fn color(self, key: &'static str, c: Color) -> Self
Examples found in repository?
More examples
examples/custom_paint.rs (line 61)
44fn graph_cell(lane: u8, selected: bool) -> El {
45 let lane_color = lane_palette(lane);
46 let ring_color = if selected {
47 Color::srgb_u8(245, 245, 250)
48 } else {
49 lane_color
50 };
51 let ring_w = if selected { 2.5 } else { 1.5 };
52 let radius = 5.0;
53 let line_w = 2.0;
54 let lane_frac = (lane as f32 + 0.5) / LANE_COUNT as f32;
55
56 El::new(Kind::Custom("graph_cell"))
57 .width(Size::Fixed(GRAPH_WIDTH))
58 .height(Size::Fixed(ROW_HEIGHT))
59 .shader(
60 ShaderBinding::custom("commit_node")
61 .color("vec_a", tokens::BACKGROUND)
62 .color("vec_b", ring_color)
63 .vec4("vec_c", [radius, ring_w, line_w, lane_frac]),
64 )
65 .fill(lane_color)
66}Sourcepub fn vec4(self, key: &'static str, v: [f32; 4]) -> Self
pub fn vec4(self, key: &'static str, v: [f32; 4]) -> Self
Examples found in repository?
examples/custom_paint.rs (line 63)
44fn graph_cell(lane: u8, selected: bool) -> El {
45 let lane_color = lane_palette(lane);
46 let ring_color = if selected {
47 Color::srgb_u8(245, 245, 250)
48 } else {
49 lane_color
50 };
51 let ring_w = if selected { 2.5 } else { 1.5 };
52 let radius = 5.0;
53 let line_w = 2.0;
54 let lane_frac = (lane as f32 + 0.5) / LANE_COUNT as f32;
55
56 El::new(Kind::Custom("graph_cell"))
57 .width(Size::Fixed(GRAPH_WIDTH))
58 .height(Size::Fixed(ROW_HEIGHT))
59 .shader(
60 ShaderBinding::custom("commit_node")
61 .color("vec_a", tokens::BACKGROUND)
62 .color("vec_b", ring_color)
63 .vec4("vec_c", [radius, ring_w, line_w, lane_frac]),
64 )
65 .fill(lane_color)
66}Trait Implementations§
Source§impl Clone for ShaderBinding
impl Clone for ShaderBinding
Source§fn clone(&self) -> ShaderBinding
fn clone(&self) -> ShaderBinding
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 Freeze for ShaderBinding
impl RefUnwindSafe for ShaderBinding
impl Send for ShaderBinding
impl Sync for ShaderBinding
impl Unpin for ShaderBinding
impl UnsafeUnpin for ShaderBinding
impl UnwindSafe for ShaderBinding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.