diff options
author | Silas Bartha <[email protected]> | 2024-04-24 21:05:55 -0400 |
---|---|---|
committer | Silas Bartha <[email protected]> | 2024-04-24 21:05:55 -0400 |
commit | 98d21d244bb92a1a8d35b1dff35d9c10bdcab19a (patch) | |
tree | 8d1729071750d879ca2123e69df2c6bfbf1857c5 /src/components.rs |
Render Texture Extraction
Diffstat (limited to 'src/components.rs')
-rw-r--r-- | src/components.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/components.rs b/src/components.rs new file mode 100644 index 0000000..3179f0c --- /dev/null +++ b/src/components.rs @@ -0,0 +1,33 @@ +use std::sync::{Mutex, Arc}; + +use bevy::{prelude::*, render::extract_component::ExtractComponent, ecs::query::QueryItem}; + +use crate::render_assets::FramebufferExtractSource; + +#[derive(Component, Default, Clone)] +pub struct FramebufferExtractDestination(pub Arc<Mutex<Image>>); + +impl ExtractComponent for FramebufferExtractDestination { + type QueryData = ( + &'static Self, + &'static Handle<FramebufferExtractSource>, + ); + + type QueryFilter = (); + + type Out = (Self, Handle<FramebufferExtractSource>); + + fn extract_component((destination, source_handle): QueryItem<'_, Self::QueryData>) -> Option<Self::Out> { + Some(( + destination.clone(), + source_handle.clone(), + )) + } +} + +#[derive(Bundle)] +pub struct ExtractFramebufferBundle { + pub source: Handle<FramebufferExtractSource>, + pub dest: FramebufferExtractDestination, +} + |