pub enum AlphaMode {
Opaque,
Mask(f32),
Blend,
Premultiplied,
Add,
Multiply,
}
Expand description
Sets how a material’s base color alpha channel is used for transparency.
Variants§
Opaque
Base color alpha values are overridden to be fully opaque (1.0).
Mask(f32)
Reduce transparency to fully opaque or fully transparent based on a threshold.
Compares the base color alpha value to the specified threshold. If the value is below the threshold, considers the color to be fully transparent (alpha is set to 0.0). If it is equal to or above the threshold, considers the color to be fully opaque (alpha is set to 1.0).
Blend
The base color alpha value defines the opacity of the color. Standard alpha-blending is used to blend the fragment’s color with the color behind it.
Premultiplied
Similar to AlphaMode::Blend
, however assumes RGB channel values are
premultiplied.
For otherwise constant RGB values, behaves more like AlphaMode::Blend
for
alpha values closer to 1.0, and more like AlphaMode::Add
for
alpha values closer to 0.0.
Can be used to avoid “border” or “outline” artifacts that can occur when using plain alpha-blended textures.
Add
Combines the color of the fragments with the colors behind them in an additive process, (i.e. like light) producing lighter results.
Black produces no effect. Alpha values can be used to modulate the result.
Useful for effects like holograms, ghosts, lasers and other energy beams.
Multiply
Combines the color of the fragments with the colors behind them in a multiplicative process, (i.e. like pigments) producing darker results.
White produces no effect. Alpha values can be used to modulate the result.
Useful for effects like stained glass, window tint film and some colored liquids.
Trait Implementations§
§impl Enum for AlphaModewhere
f32: FromReflect,
impl Enum for AlphaModewhere f32: FromReflect,
§fn field(&self, __name_param: &str) -> Option<&(dyn Reflect + 'static)>
fn field(&self, __name_param: &str) -> Option<&(dyn Reflect + 'static)>
§fn field_at(&self, __index_param: usize) -> Option<&(dyn Reflect + 'static)>
fn field_at(&self, __index_param: usize) -> Option<&(dyn Reflect + 'static)>
§fn field_mut(
&mut self,
__name_param: &str
) -> Option<&mut (dyn Reflect + 'static)>
fn field_mut( &mut self, __name_param: &str ) -> Option<&mut (dyn Reflect + 'static)>
§fn field_at_mut(
&mut self,
__index_param: usize
) -> Option<&mut (dyn Reflect + 'static)>
fn field_at_mut( &mut self, __index_param: usize ) -> Option<&mut (dyn Reflect + 'static)>
§fn index_of(&self, __name_param: &str) -> Option<usize>
fn index_of(&self, __name_param: &str) -> Option<usize>
§fn name_at(&self, __index_param: usize) -> Option<&str>
fn name_at(&self, __index_param: usize) -> Option<&str>
§fn iter_fields(&self) -> VariantFieldIter<'_> ⓘ
fn iter_fields(&self) -> VariantFieldIter<'_> ⓘ
§fn variant_name(&self) -> &str
fn variant_name(&self) -> &str
§fn variant_index(&self) -> usize
fn variant_index(&self) -> usize
§fn variant_type(&self) -> VariantType
fn variant_type(&self) -> VariantType
fn clone_dynamic(&self) -> DynamicEnum
§fn is_variant(&self, variant_type: VariantType) -> bool
fn is_variant(&self, variant_type: VariantType) -> bool
§fn variant_path(&self) -> String
fn variant_path(&self) -> String
§impl FromReflect for AlphaMode
impl FromReflect for AlphaMode
§fn from_reflect(__param0: &(dyn Reflect + 'static)) -> Option<AlphaMode>
fn from_reflect(__param0: &(dyn Reflect + 'static)) -> Option<AlphaMode>
Self
from a reflected value.§impl GetTypeRegistration for AlphaModewhere
f32: FromReflect,
impl GetTypeRegistration for AlphaModewhere f32: FromReflect,
§impl Reflect for AlphaModewhere
f32: FromReflect,
impl Reflect for AlphaModewhere f32: FromReflect,
§fn get_type_info(&self) -> &'static TypeInfo
fn get_type_info(&self) -> &'static TypeInfo
§fn into_any(self: Box<AlphaMode, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<AlphaMode, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Any>
.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any
.§fn into_reflect(
self: Box<AlphaMode, Global>
) -> Box<dyn Reflect + 'static, Global>
fn into_reflect( self: Box<AlphaMode, Global> ) -> Box<dyn Reflect + 'static, Global>
§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
§fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
fn clone_value(&self) -> Box<dyn Reflect + 'static, Global>
Reflect
trait object. Read more§fn set(
&mut self,
__value_param: Box<dyn Reflect + 'static, Global>
) -> Result<(), Box<dyn Reflect + 'static, Global>>
fn set( &mut self, __value_param: Box<dyn Reflect + 'static, Global> ) -> Result<(), Box<dyn Reflect + 'static, Global>>
§fn apply(&mut self, __value_param: &(dyn Reflect + 'static))
fn apply(&mut self, __value_param: &(dyn Reflect + 'static))
§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
§fn reflect_owned(self: Box<AlphaMode, Global>) -> ReflectOwned
fn reflect_owned(self: Box<AlphaMode, Global>) -> ReflectOwned
§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
§fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
fn reflect_partial_eq(&self, value: &(dyn Reflect + 'static)) -> Option<bool>
§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
§fn serializable(&self) -> Option<Serializable<'_>>
fn serializable(&self) -> Option<Serializable<'_>>
§impl Typed for AlphaModewhere
f32: FromReflect,
impl Typed for AlphaModewhere f32: FromReflect,
impl Copy for AlphaMode
impl Eq for AlphaMode
impl StructuralPartialEq for AlphaMode
Auto Trait Implementations§
impl RefUnwindSafe for AlphaMode
impl Send for AlphaMode
impl Sync for AlphaMode
impl Unpin for AlphaMode
impl UnwindSafe for AlphaMode
Blanket Implementations§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,
§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId) )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> Cwhere F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a, Aligned>,
fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_, Aligned>) )
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World§impl<T> GetPath for Twhere
T: Reflect,
impl<T> GetPath for Twhere T: Reflect,
§fn reflect_path<'r, 'p>(
&'r self,
path: &'p str
) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path<'r, 'p>( &'r self, path: &'p str ) -> Result<&'r (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more§fn reflect_path_mut<'r, 'p>(
&'r mut self,
path: &'p str
) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'r, 'p>( &'r mut self, path: &'p str ) -> Result<&'r mut (dyn Reflect + 'static), ReflectPathError<'p>>
path
. Read more