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