aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <silas@exvacuum.dev>2024-06-03 21:10:39 -0400
committerLibravatar Silas Bartha <silas@exvacuum.dev>2024-06-03 21:10:39 -0400
commit369cac3c3245214ebf9d03e33e98fb68acb96c10 (patch)
tree27c0455b7510bd20fef702410e870ce05759f836 /src/lib.rs
parent6dec61d81f0475560f336f17ab1243796d585317 (diff)
Renamed + Added docs
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs49
1 files changed, 33 insertions, 16 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 430e5d9..28eecd8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,40 +1,57 @@
-use bevy::{prelude::*, render::{RenderApp, render_graph::{RenderGraphApp, ViewNodeRunner}, extract_component::ExtractComponentPlugin}, asset::embedded_asset, core_pipeline::core_3d::graph::{Core3d, Node3d}};
+#![warn(missing_docs)]
+
+//! A plugin for the Bevy game engine which provides a black and white dither post-process effect
+//! using Bayer ordered dithering.
+
+use bevy::{
+ asset::embedded_asset,
+ core_pipeline::core_3d::graph::{Core3d, Node3d},
+ prelude::*,
+ render::{
+ extract_component::ExtractComponentPlugin,
+ render_graph::{RenderGraphApp, ViewNodeRunner},
+ RenderApp,
+ },
+};
use crate::components::DitherPostProcessSettings;
pub use nodes::DitherRenderLabel;
+/// Plugin which provides dither post-processing functionality
pub struct DitherPostProcessPlugin;
+/// Components used by this plugin
pub mod components;
-mod resources;
+
mod nodes;
+mod resources;
impl Plugin for DitherPostProcessPlugin {
fn build(&self, app: &mut App) {
embedded_asset!(app, "../assets/shaders/dither_post_process.wgsl");
- app.add_plugins((
- ExtractComponentPlugin::<DitherPostProcessSettings>::default(),
- ));
+ app.add_plugins((ExtractComponentPlugin::<DitherPostProcessSettings>::default(),));
let Ok(render_app) = app.get_sub_app_mut(RenderApp) else {
return;
};
- render_app.add_render_graph_node::<ViewNodeRunner<nodes::DitherRenderNode>>(
- Core3d,
- nodes::DitherRenderLabel,
- ).add_render_graph_edges(
- Core3d,
- (
- Node3d::Tonemapping,
+ render_app
+ .add_render_graph_node::<ViewNodeRunner<nodes::DitherRenderNode>>(
+ Core3d,
nodes::DitherRenderLabel,
- Node3d::EndMainPassPostProcessing,
- ),
- );
+ )
+ .add_render_graph_edges(
+ Core3d,
+ (
+ Node3d::Tonemapping,
+ nodes::DitherRenderLabel,
+ Node3d::EndMainPassPostProcessing,
+ ),
+ );
}
-
+
fn finish(&self, app: &mut App) {
let Ok(render_app) = app.get_sub_app_mut(RenderApp) else {
return;