diff --git a/src/main.rs b/src/main.rs index ef1430b..9faabbc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,17 +4,17 @@ extern crate glium; #[macro_use] extern crate load_file; -use std::f32::consts::PI; use glium::texture::SrgbTexture2d; use phf::phf_map; +use std::f32::consts::PI; use std::fs; use std::io::Cursor; use std::time::Instant; +use crate::support::CHUNK_SIZE; use glium::vertex::VertexBufferAny; #[allow(unused_imports)] use glium::{glutin, Surface}; -use crate::support::CHUNK_SIZE; mod support; @@ -433,10 +433,7 @@ fn main() { let file = file_path.replace(structures_folder, ""); println!("{}", file); structures_vertex_buffer.push(( - file - .replace(".obj", "") - .parse() - .unwrap(), + file.replace(".obj", "").parse().unwrap(), support::load_wavefront(&display, load_bytes!(&format!("../{}", file_path))), )) } @@ -494,7 +491,8 @@ fn main() { let file_name = file.replace(".objects", ""); let file_name_parts: Vec<&str> = file_name.split(' ').collect(); - let objects_contents = fs::read_to_string(file_path).unwrap_or_else(|_| panic!("Unable to load {} file!", file_path)); + let objects_contents = fs::read_to_string(file_path) + .unwrap_or_else(|_| panic!("Unable to load {} file!", file_path)); let chunk = [0, 1].map(|file_name_parts_index| { file_name_parts[file_name_parts_index] @@ -517,7 +515,8 @@ fn main() { let y: f32 = object_line_parts[2].parse().unwrap(); let z = object_line_parts[3].parse().unwrap(); let rotation: f32 = object_line_parts[4].parse().unwrap(); - let structure_per_instance: &mut Vec = structures_per_instance.get_mut(structure_id).unwrap(); + let structure_per_instance: &mut Vec = + structures_per_instance.get_mut(structure_id).unwrap(); structure_per_instance.push(PerInstance { w_position: (offset_x + x, z, offset_y + y), w_rotation: 2.0 * PI * rotation / 360.0, @@ -654,7 +653,7 @@ fn main() { let mut structures_params = ground_params.clone(); structures_params.blend = glium::draw_parameters::Blend::alpha_blending(); // Could disable per opaque structure to optimize. - // Doesn't seem to apply transparency from a structure instance to the other. + // Doesn't seem to apply transparency from a structure instance to the other. // drawing a frame let start = Instant::now();