aboutsummaryrefslogtreecommitdiff
path: root/src/systems.rs
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <[email protected]>2024-06-03 21:39:43 -0400
committerLibravatar Silas Bartha <[email protected]>2024-06-03 21:39:43 -0400
commitef6c2954156b2b0cf4abfe583d8faaf546f4e7c4 (patch)
treef5da21c83771023d55036ad94ee52d8db992ffbd /src/systems.rs
parent0ac133c0c396c8b75892cb6e43a52ad973046e2d (diff)
Removed toolchain config
Diffstat (limited to 'src/systems.rs')
-rw-r--r--src/systems.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/systems.rs b/src/systems.rs
index 244b82f..74f8dc8 100644
--- a/src/systems.rs
+++ b/src/systems.rs
@@ -1,11 +1,21 @@
-use bevy::{prelude::*, render::{render_asset::{RenderAssets, RenderAssetUsages}, renderer::RenderDevice, render_resource::{MapMode, Maintain, Extent3d, TextureDimension}}};
+use bevy::{
+ prelude::*,
+ render::{
+ render_asset::{RenderAssetUsages, RenderAssets},
+ render_resource::{Extent3d, Maintain, MapMode, TextureDimension},
+ renderer::RenderDevice,
+ },
+};
use pollster::FutureExt;
-use crate::{render_assets::FramebufferExtractSource, components::FramebufferExtractDestination};
+use crate::{components::FramebufferExtractDestination, render_assets::FramebufferExtractSource};
pub fn extract_framebuffers(
- mut extract_bundles: Query<(&Handle<FramebufferExtractSource>, &mut FramebufferExtractDestination)>,
+ mut extract_bundles: Query<(
+ &Handle<FramebufferExtractSource>,
+ &mut FramebufferExtractDestination,
+ )>,
sources: Res<RenderAssets<FramebufferExtractSource>>,
device: Res<RenderDevice>,
) {
@@ -25,7 +35,7 @@ pub fn extract_framebuffers(
device.poll(Maintain::Wait);
rx.block_on().unwrap().unwrap();
}
-
+
slice.get_mapped_range().to_vec()
};
@@ -39,7 +49,8 @@ pub fn extract_framebuffers(
std::thread::spawn(move || {
if bytes_per_row != padded_bytes_per_row {
- let mut unpadded_bytes = Vec::<u8>::with_capacity(source_size.height as usize * bytes_per_row);
+ let mut unpadded_bytes =
+ Vec::<u8>::with_capacity(source_size.height as usize * bytes_per_row);
for padded_row in image_bytes.chunks(padded_bytes_per_row) {
unpadded_bytes.extend_from_slice(&padded_row[..bytes_per_row]);
}
@@ -59,5 +70,4 @@ pub fn extract_framebuffers(
);
});
}
-
}