Expand description
Mutable variable.
A Var<T>
is akin to an Expr<T>
that can be mutated. You can go from a Var<T>
to an Expr<T>
via
either the From
or Var::to_expr
method.
Variables, because they allow mutations, allow to write more complicated shader functions. Also, lots of graphics
pipelines’ properties are variables you will have to write to, such as [VertexShaderEnv::position
].
Tuple Fields
0: Expr<T>
Implementations
sourceimpl<T> Var<T> where
T: ?Sized,
impl<T> Var<T> where
T: ?Sized,
sourcepub fn to_expr(&self) -> Expr<T>
pub fn to_expr(&self) -> Expr<T>
Remember that doing so will move the Var<T>
. clone
it if you want to preserve the source variable.
Note: use this function only when necessary. Lots of functions will accept both
Expr<T>
andVar<T>
, performing the coercion for you automatically.
Return
The expression representation of Var<T>
, allowing to pass the variable to functions or expressions that don’t
easily coerce it automatically to Expr<T>
already.
Methods from Deref<Target = Expr<T>>
sourcepub fn lt(&self, rhs: impl Into<Expr<T>>) -> Expr<bool>
pub fn lt(&self, rhs: impl Into<Expr<T>>) -> Expr<bool>
Less-than expression.
This method builds an expression representing the binary operation a < b
.
Return
An Expr<bool>
representing a < b
.
sourcepub fn lte(&self, rhs: impl Into<Expr<T>>) -> Expr<bool>
pub fn lte(&self, rhs: impl Into<Expr<T>>) -> Expr<bool>
Less-than-or-equal expression.
This method builds an expression representing the binary operation a <= b
.
Return
An Expr<bool>
representing a <= b
.
sourcepub fn and(&self, rhs: impl Into<Expr<bool>>) -> Expr<bool>
pub fn and(&self, rhs: impl Into<Expr<bool>>) -> Expr<bool>
Logical and expression.
This method builds an expression representing the logical operation a AND b
.
Return
An Expr<bool>
representing a AND b
.
pub fn position(&self) -> Expr<V4<f32>>
pub fn point_size(&self) -> Expr<f32>
pub fn clip_distance(&self) -> Expr<[f32]>
pub fn cull_distance(&self) -> Expr<[f32]>
sourcepub fn point_size(&self) -> Expr<f32>
pub fn point_size(&self) -> Expr<f32>
Point size of the vertex.
sourcepub fn clip_distance(&self) -> Expr<[f32]>
pub fn clip_distance(&self) -> Expr<[f32]>
Clip distances to user-defined planes.
sourcepub fn cull_distance(&self) -> Expr<[f32]>
pub fn cull_distance(&self) -> Expr<[f32]>
Cull distances to user-defined planes.
sourcepub fn point_size(&self) -> Expr<f32>
pub fn point_size(&self) -> Expr<f32>
Provides the size point of the vertex if it’s currently being rendered in point mode.
sourcepub fn clip_distance(&self) -> Expr<[f32]>
pub fn clip_distance(&self) -> Expr<[f32]>
Clip distances to user planes of the vertex.
sourcepub fn cull_distance(&self) -> Expr<[f32]>
pub fn cull_distance(&self) -> Expr<[f32]>
Cull distances to user planes of the vertex.
sourcepub fn point_size(&self) -> Var<f32>
pub fn point_size(&self) -> Var<f32>
Point size of the vertex.
sourcepub fn clip_distance(&self) -> Var<[f32]>
pub fn clip_distance(&self) -> Var<[f32]>
Clip distances to user-defined planes.
sourcepub fn cull_distance(&self) -> Var<[f32]>
pub fn cull_distance(&self) -> Var<[f32]>
Cull distances to user-defined planes.
Trait Implementations
Auto Trait Implementations
impl<T: ?Sized> RefUnwindSafe for Var<T> where
T: RefUnwindSafe,
impl<T: ?Sized> Send for Var<T> where
T: Send,
impl<T: ?Sized> Sync for Var<T> where
T: Sync,
impl<T: ?Sized> Unpin for Var<T> where
T: Unpin,
impl<T: ?Sized> UnwindSafe for Var<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more