diff options
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | LICENSE-0BSD | 5 | ||||
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | assets/shaders/outline_post_process.wgsl | 5 | ||||
-rw-r--r-- | src/lib.rs | 4 |
5 files changed, 28 insertions, 8 deletions
@@ -1,7 +1,9 @@ [package] name = "bevy_outline_post_process" -version = "0.2.0" +version = "0.3.0" edition = "2021" +description = "An adaptive outline post-processing effect for the Bevy game engine." +license = "0BSD OR MIT OR Apache-2.0" [dependencies.bevy] -version = "0.13" +version = "0.14" diff --git a/LICENSE-0BSD b/LICENSE-0BSD new file mode 100644 index 0000000..7a39b21 --- /dev/null +++ b/LICENSE-0BSD @@ -0,0 +1,5 @@ +Copyright (C) 2024 by Silas Bartha [email protected] + +Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. @@ -1,6 +1,7 @@ # bevy_outline_post_process -![License](https://img.shields.io/badge/license-MIT%2FApache-blue.svg) +![Crates](https://img.shields.io/crates/v/bevy_outline_post_process) +![License](https://img.shields.io/badge/license-0BSD%2FMIT%2FApache-blue.svg) ![Tag](https://img.shields.io/github/v/tag/exvacuum/bevy_outline_post_process) ![Build](https://img.shields.io/github/actions/workflow/status/exvacuum/bevy_outline_post_process/rust.yml) [![Docs](https://img.shields.io/website?url=https%3A%2F%2Fexvacuum.github.io%2Fbevy_outline_post_process%2F&label=docs)](https://exvacuum.github.io/bevy_outline_post_process) @@ -20,10 +21,17 @@ bevy_outline_post_process::components::OutlinePostProcessSettings::new(2.0, 0.0, | Crate Version | Bevy Version | |--- |--- | -| 0.2 | 0.13 | +| 0.3 | 0.14 | +| 0.1-0.2 | 0.13 | ## Installation +### crates.io +```toml +[dependencies] +bevy_outline_post_process = "0.3" +``` + ### Using git URL in Cargo.toml ```toml [dependencies.bevy_outline_post_process] @@ -59,3 +67,7 @@ commands.spawn(( This effect will only run for cameras which contain this component. +## License + +This crate is licensed under your choice of 0BSD, Apache-2.0, or MIT license. + diff --git a/assets/shaders/outline_post_process.wgsl b/assets/shaders/outline_post_process.wgsl index 5e0bf9c..d442485 100644 --- a/assets/shaders/outline_post_process.wgsl +++ b/assets/shaders/outline_post_process.wgsl @@ -35,9 +35,10 @@ fn fragment( let delta_max = max(delta_top, max(delta_right, delta_top_right)); let delta_raw = max(delta_max.x, max(delta_max.y, delta_max.z)); - let delta_clipped = clamp((delta_raw * 2.0) - settings.threshold, 0.0, 1.0); + // let delta_clipped = clamp((delta_raw * 2.0) - settings.threshold, 0.0, 1.0); + let show_outline = f32(delta_raw > settings.threshold); - var outline = vec4f(delta_clipped, delta_clipped, delta_clipped, 0.0); + var outline = vec4f(show_outline, show_outline, show_outline, 0.0); let luma = (0.2126 * screen_color.r + 0.7152 * screen_color.g + 0.0722 * screen_color.b); if settings.adaptive != 0 && luma < 0.5 { outline = outline * -1; @@ -34,7 +34,7 @@ impl Plugin for OutlinePostProcessPlugin { ExtractComponentPlugin::<components::OutlinePostProcessSettings>::default(), )); - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + let Some(render_app) = app.get_sub_app_mut(RenderApp) else { return; }; @@ -54,7 +54,7 @@ impl Plugin for OutlinePostProcessPlugin { } fn finish(&self, app: &mut App) { - let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { + let Some(render_app) = app.get_sub_app_mut(RenderApp) else { return; }; |