use bevy_reflect::{std_traits::ReflectDefault, Reflect};12// TODO: add discussion about performance.3/// Sets how a material's base color alpha channel is used for transparency.4#[derive(Debug, Default, Reflect, Copy, Clone, PartialEq)]5#[reflect(Default, Debug, Clone)]6pub enum AlphaMode {7/// Base color alpha values are overridden to be fully opaque (1.0).8#[default]9Opaque,10/// Reduce transparency to fully opaque or fully transparent11/// based on a threshold.12///13/// Compares the base color alpha value to the specified threshold.14/// If the value is below the threshold,15/// considers the color to be fully transparent (alpha is set to 0.0).16/// If it is equal to or above the threshold,17/// considers the color to be fully opaque (alpha is set to 1.0).18Mask(f32),19/// The base color alpha value defines the opacity of the color.20/// Standard alpha-blending is used to blend the fragment's color21/// with the color behind it.22Blend,23/// Similar to [`AlphaMode::Blend`], however assumes RGB channel values are24/// [premultiplied](https://en.wikipedia.org/wiki/Alpha_compositing#Straight_versus_premultiplied).25///26/// For otherwise constant RGB values, behaves more like [`AlphaMode::Blend`] for27/// alpha values closer to 1.0, and more like [`AlphaMode::Add`] for28/// alpha values closer to 0.0.29///30/// Can be used to avoid “border” or “outline” artifacts that can occur31/// when using plain alpha-blended textures.32Premultiplied,33/// Spreads the fragment out over a hardware-dependent number of sample34/// locations proportional to the alpha value. This requires multisample35/// antialiasing; if MSAA isn't on, this is identical to36/// [`AlphaMode::Mask`] with a value of 0.5.37///38/// Alpha to coverage provides improved performance and better visual39/// fidelity over [`AlphaMode::Blend`], as Bevy doesn't have to sort objects40/// when it's in use. It's especially useful for complex transparent objects41/// like foliage.42///43/// [alpha to coverage]: https://en.wikipedia.org/wiki/Alpha_to_coverage44AlphaToCoverage,45/// Combines the color of the fragments with the colors behind them in an46/// additive process, (i.e. like light) producing lighter results.47///48/// Black produces no effect. Alpha values can be used to modulate the result.49///50/// Useful for effects like holograms, ghosts, lasers and other energy beams.51Add,52/// Combines the color of the fragments with the colors behind them in a53/// multiplicative process, (i.e. like pigments) producing darker results.54///55/// White produces no effect. Alpha values can be used to modulate the result.56///57/// Useful for effects like stained glass, window tint film and some colored liquids.58Multiply,59}6061impl Eq for AlphaMode {}626364