pub struct ShaderBuilder { /* private fields */ }Expand description
Builder for a Shader node.
Implementations§
Source§impl ShaderBuilder
impl ShaderBuilder
Sourcepub fn width(self, v: impl Into<Span>) -> Self
pub fn width(self, v: impl Into<Span>) -> Self
Width in pixels, or pct(100) for the whole frame.
Sourcepub fn height(self, v: impl Into<Span>) -> Self
pub fn height(self, v: impl Into<Span>) -> Self
Height in pixels, or a percentage of the frame.
Sourcepub fn size(self, width: impl Into<Span>, height: impl Into<Span>) -> Self
pub fn size(self, width: impl Into<Span>, height: impl Into<Span>) -> Self
Width and height together: .size(800.0, 450.0) or
.size(pct(100), 300.0).
Sourcepub fn fullscreen(self) -> Self
pub fn fullscreen(self) -> Self
Uses the frame as the box. Put the node on the view so a camera does not move it.
Sourcepub fn uniform(self, name: impl Into<String>, value: f64) -> Self
pub fn uniform(self, name: impl Into<String>, value: f64) -> Self
Sets a numeric Params field. A name that is not in the shader
fails check (param_unknown).
Sourcepub fn uniform_vec2(
self,
name: impl Into<String>,
value: impl Into<Vec2>,
) -> Self
pub fn uniform_vec2( self, name: impl Into<String>, value: impl Into<Vec2>, ) -> Self
Sets a vec2<f32> field from a point.
Sourcepub fn uniform_color(
self,
name: impl Into<String>,
value: impl IntoPaint,
) -> Self
pub fn uniform_color( self, name: impl Into<String>, value: impl IntoPaint, ) -> Self
Sets a vec4<f32> field from a color or a theme role such as Accent.
Sourcepub fn uniform_bool(self, name: impl Into<String>, value: bool) -> Self
pub fn uniform_bool(self, name: impl Into<String>, value: bool) -> Self
Sets a bool field.
Sourcepub fn amp(self, value: f64) -> Self
pub fn amp(self, value: f64) -> Self
Wave height, as a fraction of the box. The preset default is 0.05.
Sourcepub fn deep(self, value: impl IntoPaint) -> Self
pub fn deep(self, value: impl IntoPaint) -> Self
Color below the crest. A theme role such as Accent follows the theme.
Sourcepub fn input(self, name: impl Into<String>, input: Input) -> Self
pub fn input(self, name: impl Into<String>, input: Input) -> Self
Names what the shader reads. lens_drops reads "scene", which is
the frame drawn before it whether or not this is called. A name the
preset does not read fails check (param_unknown).
A custom shade reads input "photo" with sample_photo(uv):
Shader::file("shaders/wobble.wgsl").input("photo", Input::file("photo.png"))
// in WGSL: return sample_photo(i.uv + vec2<f32>(sin(i.uv.y * 40.0) * 0.01, 0.0));With Input::frame the shader reads what was drawn before it and
is painted over it inside its box: sample_scene(i.screen / ox.resolution).
Sourcepub fn wetness(self, value: f64) -> Self
pub fn wetness(self, value: f64) -> Self
How many drops cover the lens of lens_drops, 0 to 1. The preset
default is 0.6; start from 0 to keep the lens dry until a splash.
Trait Implementations§
Source§impl NodeBuilder for ShaderBuilder
impl NodeBuilder for ShaderBuilder
Source§fn name(self, v: impl Into<String>) -> Self
fn name(self, v: impl Into<String>) -> Self
oxframe check / oxframe inspect.
Without it, the node is labeled by the add call site (src/main.rs:42).Source§fn position(self, v: impl Into<Vec2>) -> Self
fn position(self, v: impl Into<Vec2>) -> Self
x and y together, e.g. .position((100.0, -50.0)).Source§fn scale(self, v: impl IntoScale) -> Self
fn scale(self, v: impl IntoScale) -> Self
1.5) or a
pair ((2.0, 0.5), a Vec2).Source§fn fill(self, v: impl IntoPaint) -> Self
fn fill(self, v: impl IntoPaint) -> Self
Color or a theme role such as Accent.
Default: transparent, except text, which uses the theme’s text color.Source§fn stroke(self, v: impl IntoPaint) -> Self
fn stroke(self, v: impl IntoPaint) -> Self
line_width. A theme role works the same as a color.
Default: transparent.Source§fn line_width(self, v: f64) -> Self
fn line_width(self, v: f64) -> Self
Source§fn start(self, v: f64) -> Self
fn start(self, v: f64) -> Self
Source§fn end(self, v: f64) -> Self
fn end(self, v: f64) -> Self
Source§fn fill_gradient(self, g: Gradient) -> Self
fn fill_gradient(self, g: Gradient) -> Self
fill.Source§fn stroke_gradient(self, g: Gradient) -> Self
fn stroke_gradient(self, g: Gradient) -> Self
stroke.Source§fn dash(self, pattern: impl Into<Vec<f64>>) -> Self
fn dash(self, pattern: impl Into<Vec<f64>>) -> Self
dash_offset for
marching ants.Source§fn dash_offset(self, v: f64) -> Self
fn dash_offset(self, v: f64) -> Self
Source§fn blur(self, v: f64) -> Self
fn blur(self, v: f64) -> Self
Source§fn shadow(
self,
color: impl IntoPaint,
blur: f64,
offset: impl Into<Vec2>,
) -> Self
fn shadow( self, color: impl IntoPaint, blur: f64, offset: impl Into<Vec2>, ) -> Self
Source§fn elevation(self, step: Step) -> Self
fn elevation(self, step: Step) -> Self
Xs and Sm are the small one, Xl the large).Source§fn offscreen(self) -> Self
fn offscreen(self) -> Self
Input::node.
check skips them.Source§fn anchor(self, v: impl Into<Vec2>) -> Self
fn anchor(self, v: impl Into<Vec2>) -> Self
Source§fn shrink(self, v: f64) -> Self
fn shrink(self, v: f64) -> Self
Layout: how much this node gives up when space is short.Source§fn margin(self, v: impl Len) -> Self
fn margin(self, v: impl Len) -> Self
Layout: space around this node, in pixels or a theme step (.margin(Md)).Source§fn align_self(self, v: LayoutAlign) -> Self
fn align_self(self, v: LayoutAlign) -> Self
Layout: overrides the layout’s cross-axis alignment.Source§fn next_to(self, other: impl Into<Node>, side: Side) -> Self
fn next_to(self, other: impl Into<Node>, side: Side) -> Self
other, on side. The gap is the theme’s Md
step. Recomputed every frame, so this node follows other.Source§fn align_to(self, other: impl Into<Node>, edge: Edge) -> Self
fn align_to(self, other: impl Into<Node>, edge: Edge) -> Self
edge up with the same edge of other.Source§fn to_edge(self, edge: Edge) -> Self
fn to_edge(self, edge: Edge) -> Self
x or y.Source§fn center_in(self, other: impl Into<Node>) -> Self
fn center_in(self, other: impl Into<Node>) -> Self
other. Pass the view to center in the frame.Source§fn child<C: NodeBuilder>(self, child: C) -> Self
fn child<C: NodeBuilder>(self, child: C) -> Self
Node::add when
you need the child’s handle.Auto Trait Implementations§
impl !RefUnwindSafe for ShaderBuilder
impl !Send for ShaderBuilder
impl !Sync for ShaderBuilder
impl !UnwindSafe for ShaderBuilder
impl Freeze for ShaderBuilder
impl Unpin for ShaderBuilder
impl UnsafeUnpin for ShaderBuilder
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
replaced by palette::chromatic_adaptation::AdaptIntoUnclamped
Source§impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
impl<T, C> AdaptIntoUnclamped<T> for Cwhere
T: AdaptFromUnclamped<C>,
Source§type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
type Scalar = <T as AdaptFromUnclamped<C>>::Scalar
Source§fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
fn adapt_into_unclamped_with<M>(self) -> Twhere
M: LmsToXyz<<C as AdaptIntoUnclamped<T>>::Scalar> + XyzToLms<<C as AdaptIntoUnclamped<T>>::Scalar>,
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T, C> ComponentsInto<C> for T
impl<T, C> ComponentsInto<C> for T
Source§fn components_into(self) -> C
fn components_into(self) -> C
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self into C, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds error is returned which contains
the unclamped color. Read more