Apply cargo clippy
This commit is contained in:
+4
-5
@@ -235,12 +235,11 @@ fn main() {
|
||||
|
||||
// polling and handling the events received by the window
|
||||
for event in events {
|
||||
match event {
|
||||
glutin::event::Event::WindowEvent { event, .. } => match event {
|
||||
if let glutin::event::Event::WindowEvent { event, .. } = event {
|
||||
match event {
|
||||
glutin::event::WindowEvent::CloseRequested => action = support::Action::Stop,
|
||||
ev => camera.process_input(&ev),
|
||||
},
|
||||
_ => (),
|
||||
ev => camera.process_input(ev),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ impl CameraState {
|
||||
}
|
||||
|
||||
pub fn get_perspective(&self) -> [[f32; 4]; 4] {
|
||||
let fov: f32 = 3.141592 / 2.0;
|
||||
let fov: f32 = std::f32::consts::PI / 2.0;
|
||||
let zfar = 53_209.0;
|
||||
let znear = 1.0; //0.01;
|
||||
|
||||
|
||||
+14
-17
@@ -22,10 +22,10 @@ where
|
||||
let mut next_frame_time = Instant::now();
|
||||
event_loop.run(move |event, _, control_flow| {
|
||||
let run_callback = match event.to_static() {
|
||||
Some(Event::NewEvents(cause)) => match cause {
|
||||
StartCause::ResumeTimeReached { .. } | StartCause::Init => true,
|
||||
_ => false,
|
||||
},
|
||||
Some(Event::NewEvents(cause)) => matches!(
|
||||
cause,
|
||||
StartCause::ResumeTimeReached { .. } | StartCause::Init
|
||||
),
|
||||
Some(event) => {
|
||||
events_buffer.push(event);
|
||||
false
|
||||
@@ -58,20 +58,20 @@ where
|
||||
|
||||
fn get_biome(line: &str, index: usize) -> u32 {
|
||||
let biome_char = line.chars().nth(index).unwrap();
|
||||
return if '0' <= biome_char && biome_char <= '9' {
|
||||
if ('0'..='9').contains(&biome_char) {
|
||||
biome_char.to_digit(10).unwrap()
|
||||
} else {
|
||||
(10 + (biome_char as u8 - 'A' as u8)) as u32
|
||||
};
|
||||
(10 + (biome_char as u8 - b'A')) as u32
|
||||
}
|
||||
}
|
||||
|
||||
fn get_altitude(height_columns: &Vec<&str>, columns_index: usize) -> f32 {
|
||||
fn get_altitude(height_columns: &[&str], columns_index: usize) -> f32 {
|
||||
let height_str = height_columns[columns_index];
|
||||
return if height_str == "N" {
|
||||
if height_str == "N" {
|
||||
SEABED_ALTITUDE
|
||||
} else {
|
||||
height_str.parse::<f32>().unwrap()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const SEABED_ALTITUDE: f32 = -100.0;
|
||||
@@ -95,9 +95,7 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
let ground_folder = "Extensions/LemnosLife/Map/Altis/Ground/";
|
||||
let paths = fs::read_dir(ground_folder).unwrap();
|
||||
|
||||
let mut i: u32 = 0;
|
||||
|
||||
for path in paths {
|
||||
for (i, path) in (0_u32..).zip(paths) {
|
||||
let file_name = path
|
||||
.unwrap()
|
||||
.path()
|
||||
@@ -158,10 +156,10 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
let column_below = get_altitude(&height_next_columns, columns_index);
|
||||
|
||||
let biome_index = if lines_index % 2 == 0 {
|
||||
columns_index / 2
|
||||
columns_index
|
||||
} else {
|
||||
height_columns.len() / 2 - columns_index / 2
|
||||
};
|
||||
height_columns.len() - columns_index
|
||||
} / 2;
|
||||
let biome = get_biome(biomes_line, biome_index);
|
||||
|
||||
if lines_index == 0 && columns_index == 0 {
|
||||
@@ -205,7 +203,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
|
||||
biome: 0,
|
||||
chunk,
|
||||
});
|
||||
i += 1;
|
||||
// i == 250 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BufferCreationError(OutOfMemory)', src/support/mod.rs:203:10
|
||||
/*if i == 1 {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user