mirror of
https://github.com/IllusionMan1212/3dobs.git
synced 2026-10-24 10:12:35 +00:00
ui: better objects table. better font. keybinds window. update fps every 100ms instead of every frame
This commit is contained in:
+10
-1
@@ -156,6 +156,8 @@ fn main() -> anyhow::Result<(), Box<dyn std::error::Error>> {
|
||||
utils::import_models_from_paths(&args_paths, &mut state);
|
||||
}
|
||||
|
||||
let mut time_since_last_frame_acc = 0.0;
|
||||
|
||||
// main loop
|
||||
while !window.should_close() {
|
||||
let current_frame = glfw.get_time() as f32;
|
||||
@@ -166,6 +168,13 @@ fn main() -> anyhow::Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
state.camera.update_speed(delta_time);
|
||||
|
||||
time_since_last_frame_acc += delta_time;
|
||||
|
||||
if time_since_last_frame_acc >= 0.1 {
|
||||
state.fps = 1.0 / delta_time;
|
||||
time_since_last_frame_acc = 0.0;
|
||||
}
|
||||
|
||||
// camera matrices
|
||||
let view_mat = glm::ext::look_at(state.camera.position, state.camera.position + state.camera.front, state.camera.up);
|
||||
let projection_mat = glm::ext::perspective(glm::radians(state.camera.fov), state.viewport_size[0] / state.viewport_size[1], 0.01, 200.0);
|
||||
@@ -270,7 +279,7 @@ fn main() -> anyhow::Result<(), Box<dyn std::error::Error>> {
|
||||
gl::Clear(gl::COLOR_BUFFER_BIT);
|
||||
gl::Disable(gl::DEPTH_TEST);
|
||||
gl::Disable(gl::BLEND);
|
||||
ui::draw_ui(&mut imgui, &renderer, &glfw_platform, &mut window, &mut state, delta_time, &mut last_cursor, scene_texture);
|
||||
ui::draw_ui(&mut imgui, &renderer, &glfw_platform, &mut window, &mut state, &mut last_cursor, scene_texture);
|
||||
|
||||
glfw.poll_events();
|
||||
window.swap_buffers();
|
||||
|
||||
Reference in New Issue
Block a user