diff options
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | src/components.rs | 7 |
3 files changed, 8 insertions, 5 deletions
@@ -1,6 +1,6 @@ [package] name = "grex_dither_post_process" -version = "0.1.1" +version = "0.1.2" edition = "2021" [dependencies.bevy] @@ -10,7 +10,7 @@ The effect is implemented as a bilevel ordered dither using a Bayer matrix with ![](./doc/screenshot_plant.png) Configuration Used: ```rs -grex_dither_post_process::components::DitherPostProcessSettings::new(3, images); +grex_dither_post_process::components::DitherPostProcessSettings::new(3, &asset_server); ``` ## Compatibility @@ -47,7 +47,7 @@ When spawning a camera: ```rs commands.spawn(( // Camera3dBundle... - grex_dither_post_process::components::DitherPostProcessSettings::new(level, images); + grex_dither_post_process::components::DitherPostProcessSettings::new(level, &asset_server); )); ``` diff --git a/src/components.rs b/src/components.rs index 99bf946..d22524c 100644 --- a/src/components.rs +++ b/src/components.rs @@ -10,7 +10,10 @@ use bevy::{ pub struct DitherPostProcessSettings(Handle<Image>); impl DitherPostProcessSettings { - pub fn new(level: u32,images: &mut ResMut<Assets<Image>>) -> Self { + pub fn new( + level: u32, + asset_server: &AssetServer, + ) -> Self { let power = level + 1; let map_size: u32 = 1 << power; let mut buffer = Vec::<u8>::new(); @@ -52,7 +55,7 @@ impl DitherPostProcessSettings { image.texture_descriptor.usage = TextureUsages::COPY_DST | TextureUsages::STORAGE_BINDING | TextureUsages::TEXTURE_BINDING; - let handle = images.add(image); + let handle = asset_server.add(image); Self(handle) } |