diff options
author | Silas Bartha <[email protected]> | 2024-04-26 01:23:11 -0400 |
---|---|---|
committer | Silas Bartha <[email protected]> | 2024-04-26 01:23:11 -0400 |
commit | ccf6a082ac040c42e428fde771834b2043735cb5 (patch) | |
tree | cbe788ead3a76feeb0baeeae63f77323b236e670 | |
parent | 7427c127662d91c7218639a2fb4d8fb7c9981611 (diff) |
Switched to asset server reference for adding threshold map texturev0.1.2
-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) } |