diff options
author | Silas Bartha <[email protected]> | 2024-06-03 22:00:19 -0400 |
---|---|---|
committer | Silas Bartha <[email protected]> | 2024-06-03 22:00:19 -0400 |
commit | 5560d5d092a4849cfe1ce63d85cef57c07ce8d8b (patch) | |
tree | 9c3f9f6c72c437b5ef10d4428dfdfbfd6e12c51c /src | |
parent | ef6c2954156b2b0cf4abfe583d8faaf546f4e7c4 (diff) |
Added docs + renamed
Diffstat (limited to 'src')
-rw-r--r-- | src/components.rs | 4 | ||||
-rw-r--r-- | src/lib.rs | 11 | ||||
-rw-r--r-- | src/render_assets.rs | 15 |
3 files changed, 23 insertions, 7 deletions
diff --git a/src/components.rs b/src/components.rs index c1122d0..f9fe912 100644 --- a/src/components.rs +++ b/src/components.rs @@ -4,6 +4,7 @@ use bevy::{ecs::query::QueryItem, prelude::*, render::extract_component::Extract 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<Mutex<Image>>); @@ -21,8 +22,11 @@ impl ExtractComponent for FramebufferExtractDestination { } } +/// Bundle containing both a source and destination for framebuffer extraction. #[derive(Bundle)] pub struct ExtractFramebufferBundle { + /// Source pub source: Handle<FramebufferExtractSource>, + /// Destination pub dest: FramebufferExtractDestination, } @@ -1,3 +1,8 @@ +#![warn(missing_docs)] + +//! Plugin for the Bevy game engine which provides the ability to extract the frambuffer image after rendering +//! to use for whatever you want. + use bevy::{ prelude::*, render::{ @@ -9,11 +14,15 @@ use components::FramebufferExtractDestination; use nodes::{FramebufferExtractLabel, FramebufferExtractNode}; use render_assets::FramebufferExtractSource; +/// Components used by this plugin. pub mod components; -mod nodes; +/// Render assets used by this plugin. pub mod render_assets; + +mod nodes; mod systems; +/// Plugin which handles framebuffer extraction. pub struct FramebufferExtractPlugin; impl Plugin for FramebufferExtractPlugin { diff --git a/src/render_assets.rs b/src/render_assets.rs index 0e2cd4d..e5277d7 100644 --- a/src/render_assets.rs +++ b/src/render_assets.rs @@ -8,15 +8,18 @@ use bevy::{ }, }; +/// Render-world version of FramebufferExtractSource pub struct GpuFramebufferExtractSource { - pub buffer: Buffer, - pub source_handle: Handle<Image>, - pub source_size: Extent3d, - pub bytes_per_row: u32, - pub padded_bytes_per_row: u32, - pub format: TextureFormat, + pub(crate) buffer: Buffer, + pub(crate) source_handle: Handle<Image>, + pub(crate) source_size: Extent3d, + pub(crate) bytes_per_row: u32, + pub(crate) padded_bytes_per_row: u32, + pub(crate) format: TextureFormat, } +/// Framebuffer extraction source. Contains a handle to the render texture which will be extracted +/// from. #[derive(Asset, Reflect, Clone, Default)] pub struct FramebufferExtractSource(pub Handle<Image>); |