Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
weitsang committed May 28, 2024
1 parent 84ab378 commit b61b320
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
8 changes: 3 additions & 5 deletions src/bin/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ use std::path::Path;
use std::path::PathBuf;
use vivotk::codec::{decoder::Tmc2rsDecoder, Decoder};
use vivotk::dash::fetcher::Fetcher;
use vivotk::render::wgpu::png::{
PngWriter,
RenderFormat};
use vivotk::render::wgpu::png::{PngWriter, RenderFormat};
use vivotk::simulation::CameraTrace;
use vivotk::utils::read_file_to_point_cloud;

Expand Down Expand Up @@ -111,10 +109,10 @@ async fn main() {
args.width,
args.height,
"#000000",
RenderFormat::Png
RenderFormat::Png,
);
png_writer.set_background_color(wgpu::Color::WHITE);

let camera_trace = CameraTrace::new(&args.camera_trace, false);

if let Some(quality) = args.quality {
Expand Down
3 changes: 1 addition & 2 deletions src/dash/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ pub struct Fetcher {
enable_optimizations: bool,
}

#[derive(Debug)]
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct FetchResult {
pub paths: [Option<PathBuf>; 6],
pub throughput: f64,
Expand Down
4 changes: 1 addition & 3 deletions src/render/wgpu/png.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use crate::formats::pointxyzrgba::PointXyzRgba;
use crate::formats::PointCloud;
use crate::render::wgpu::camera::{Camera, CameraState};
use crate::render::wgpu::renderer::{
parse_wgpu_color,
PointCloudRenderer};
use crate::render::wgpu::renderer::{parse_wgpu_color, PointCloudRenderer};
// use color_space::Rgb;
use std::ffi::OsString;
use std::num::NonZeroU32;
Expand Down
15 changes: 7 additions & 8 deletions src/render/wgpu/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ pub fn parse_wgpu_color(color_str: &str) -> Result<wgpu::Color, &str> {
.map(|s| s.parse::<u8>().unwrap())
.collect::<Vec<_>>();
Ok(wgpu::Color {
r: rgb[0] as f64,
r: rgb[0] as f64,
g: rgb[1] as f64,
b: rgb[2] as f64,
a: 1.0
b: rgb[2] as f64,
a: 1.0,
})
} else if color_str.starts_with("#") {
let hex_num = u32::from_str_radix(&color_str[1..], 16);
Expand All @@ -79,17 +79,16 @@ pub fn parse_wgpu_color(color_str: &str) -> Result<wgpu::Color, &str> {
}
let rgb = color_space::Rgb::from_hex(hex_num.unwrap());
Ok(wgpu::Color {
r: rgb.r as f64,
r: rgb.r as f64,
g: rgb.g as f64,
b: rgb.b as f64,
a: 1.0
b: rgb.b as f64,
a: 1.0,
})
} else {
return Err("Invalid background color format, expected rgb(r,g,b) or #rrggbb such as rgb(122,31,212) or #7a1fd4");
}
}


#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum PlaybackState {
Paused,
Expand Down Expand Up @@ -518,7 +517,7 @@ where
initial_render: &T,
initial_size: PhysicalSize<u32>,
camera_state: &CameraState,
bg_color: wgpu::Color
bg_color: wgpu::Color,
) -> Self {
let (camera_buffer, camera_bind_group_layout, camera_bind_group) =
camera_state.create_buffer(device);
Expand Down

0 comments on commit b61b320

Please sign in to comment.