From 98d21d244bb92a1a8d35b1dff35d9c10bdcab19a Mon Sep 17 00:00:00 2001 From: Silas Bartha Date: Wed, 24 Apr 2024 21:05:55 -0400 Subject: Render Texture Extraction --- src/components.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/components.rs (limited to 'src/components.rs') 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>); + +impl ExtractComponent for FramebufferExtractDestination { + type QueryData = ( + &'static Self, + &'static Handle, + ); + + type QueryFilter = (); + + type Out = (Self, Handle); + + fn extract_component((destination, source_handle): QueryItem<'_, Self::QueryData>) -> Option { + Some(( + destination.clone(), + source_handle.clone(), + )) + } +} + +#[derive(Bundle)] +pub struct ExtractFramebufferBundle { + pub source: Handle, + pub dest: FramebufferExtractDestination, +} + -- cgit v1.2.3