From 1fd3893e27d90d1cda8fec5af38194591e8756b7 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Sun, 23 Oct 2022 00:03:38 +0200 Subject: [PATCH] Add a frame timer --- src/main.rs | 4 ++++ src/support/mod.rs | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6fff253..188e1b4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ extern crate load_file; use glium::texture::SrgbTexture2d; use std::io::Cursor; +use std::time::Instant; #[allow(unused_imports)] use glium::{glutin, Surface}; @@ -237,6 +238,7 @@ fn main() { }; // drawing a frame + let start = Instant::now(); let mut target = display.draw(); target.clear_color_and_depth((0.0, 0.0, 0.0, 0.0), 1.0); target @@ -249,6 +251,8 @@ fn main() { ) .unwrap(); target.finish().unwrap(); + let duration = start.elapsed(); + println!("Time elapsed is: {:?}", duration); let mut action = support::Action::Continue; diff --git a/src/support/mod.rs b/src/support/mod.rs index c10bc2f..c3a3c0c 100644 --- a/src/support/mod.rs +++ b/src/support/mod.rs @@ -145,8 +145,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny { let biome = get_biome(biomes_line, columns_index / 2); - // TODO: compute normals if necessary. - // First triangle. vertex_data.push(Vertex {