Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cs50victor committed Jan 23, 2024
1 parent dd98bfa commit cd9ebb6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions new_media/src/frame_capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ pub mod scene {
render::{camera::RenderTarget, renderer::RenderDevice},
};

use image::{DynamicImage, ImageBuffer, ImageOutputFormat, Rgba, RgbaImage};
use image::{ImageBuffer, ImageOutputFormat, Rgba, RgbaImage};
use wgpu::{Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages};

use super::image_copy::ImageCopier;
Expand Down Expand Up @@ -340,15 +340,15 @@ pub mod scene {
}
}

fn image_to_browser_base64(img: &ImageBuffer<Rgba<u8>, Vec<u8>>)-> Result<String> {
fn image_to_browser_base64(img: &ImageBuffer<Rgba<u8>, Vec<u8>>) -> Result<String> {
let mut image_data: Vec<u8> = Vec::new();
img.write_to(&mut Cursor::new(&mut image_data), ImageOutputFormat::Png)?;
let res_base64 = general_purpose::STANDARD.encode(image_data);
Ok(format!("data:image/png;base64,{}", res_base64))
}

pub fn white_img_placeholder(w: u32, h: u32) -> String {
let mut img = RgbaImage::new(w,h);
let img = RgbaImage::new(w, h);
// img.iter_mut().for_each(|pixel| *pixel = 255);
image_to_browser_base64(&img).unwrap()
}
Expand Down
2 changes: 1 addition & 1 deletion new_media/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct AudioSync {

fn setup_gaussian_cloud(
mut commands: Commands,
asset_server: Res<AssetServer>,
_asset_server: Res<AssetServer>,
mut gaussian_assets: ResMut<Assets<GaussianCloud>>,
mut scene_controller: ResMut<frame_capture::scene::SceneController>,
mut images: ResMut<Assets<Image>>,
Expand Down
7 changes: 5 additions & 2 deletions new_media/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ pub fn start_ws(listener: Res<WsListener>) {
};
}

pub fn receive_message(mut commands: Commands, curr_base64_img: Res<CurrImageBase64>, connections: Query<(Entity, &WsConnection)>) {
pub fn receive_message(
mut commands: Commands,
curr_base64_img: Res<CurrImageBase64>,
connections: Query<(Entity, &WsConnection)>,
) {
for (entity, conn) in connections.iter() {
loop {
match conn.receive() {
Expand All @@ -84,4 +88,3 @@ pub fn receive_message(mut commands: Commands, curr_base64_img: Res<CurrImageBas
}
}
}

0 comments on commit cd9ebb6

Please sign in to comment.