aboutsummaryrefslogtreecommitdiff
path: root/src/components.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components.rs')
-rw-r--r--src/components.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/components.rs b/src/components.rs
index bdce6c9..05a4594 100644
--- a/src/components.rs
+++ b/src/components.rs
@@ -11,14 +11,16 @@ use bevy::{
pub struct OutlinePostProcessSettings {
/// Weight of outlines in pixels.
weight: f32,
+ /// Color of outlines.
+ color: LinearRgba,
/// A threshold for normal differences, values below this threshold will not become outlines.
/// Higher values will result in more outlines which may look better on smooth surfaces.
normal_threshold: f32,
/// A threshold for depth differences (in units), values below this threshold will not become outlines.
/// Higher values will result in more outlines which may look better on smooth surfaces.
depth_threshold: f32,
- /// Whether to use adaptive outlines. White outlines will be drawn around darker objects, while black ones will be drawn around lighter ones.
- adaptive: u32,
+ /// Luma threshold to invert outline color. A value of `1.0` means this feature is disabled.
+ adaptive_threshold: f32,
/// Near plane depth of camera, used for linearization of depth buffer values
pub(crate) camera_near: f32,
}
@@ -27,15 +29,17 @@ impl OutlinePostProcessSettings {
/// Create a new instance with the given settings
pub fn new(
weight: f32,
+ color: LinearRgba,
normal_threshold: f32,
depth_threshold: f32,
- adaptive: bool,
+ adaptive_threshold: f32,
) -> Self {
Self {
weight,
+ color,
normal_threshold,
- adaptive: adaptive as u32,
depth_threshold,
+ adaptive_threshold,
camera_near: 0.0,
}
}
@@ -45,9 +49,10 @@ impl Default for OutlinePostProcessSettings {
fn default() -> Self {
Self {
weight: 1.0,
- normal_threshold: 0.0,
- adaptive: 0,
+ color: LinearRgba::BLACK,
+ normal_threshold: 0.01,
depth_threshold: 0.05,
+ adaptive_threshold: 1.0,
camera_near: 0.0,
}
}