use std::sync::{Arc, Mutex}; use bevy::{ecs::query::QueryItem, prelude::*, render::extract_component::ExtractComponent}; use crate::render_assets::FramebufferExtractSource; /// Framebuffer extraction destination. Contains the image which the framebuffer is extracted to. #[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())) } } /// Bundle containing both a source and destination for framebuffer extraction. #[derive(Bundle)] pub struct ExtractFramebufferBundle { /// Source pub source: Handle, /// Destination pub dest: FramebufferExtractDestination, }