Skip to content

Commit

Permalink
completely remove bevy_pbr dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aevyrie committed Jul 11, 2023
1 parent 77d4136 commit 9f8c72a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ bitflags = "2.3"
bevy = { version = "0.11.0", default-features = false, features = [
"bevy_core_pipeline",
"bevy_render",
"bevy_pbr",
"bevy_asset",
] }

Expand All @@ -35,6 +34,7 @@ rand = "0.8.4"
ringbuffer = "0.14"
bevy = { version = "0.11.0", default-features = false, features = [
"bevy_winit",
"bevy_pbr",
"x11",
"tonemapping_luts",
"ktx2",
Expand Down
48 changes: 48 additions & 0 deletions src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,51 @@ pub fn queue_material_polylines(
}
}
}

/// Sets how a material's base color alpha channel is used for transparency.
#[derive(Debug, Default, Reflect, Copy, Clone, PartialEq)]
#[reflect(Default, Debug)]
pub enum AlphaMode {
/// Base color alpha values are overridden to be fully opaque (1.0).
#[default]
Opaque,
/// 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).
Mask(f32),
/// 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.
Blend,
/// Similar to [`AlphaMode::Blend`], however assumes RGB channel values are
/// [premultiplied](https://en.wikipedia.org/wiki/Alpha_compositing#Straight_versus_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.
Premultiplied,
/// 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.
Add,
/// 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.
Multiply,
}

impl Eq for AlphaMode {}

0 comments on commit 9f8c72a

Please sign in to comment.