diff --git a/doppler/Cargo.toml b/doppler/Cargo.toml index f5d5078..541c2fc 100644 --- a/doppler/Cargo.toml +++ b/doppler/Cargo.toml @@ -6,18 +6,18 @@ edition = "2018" [dependencies] gl = "0.14.0" -imgui={version="0.4.0", optional=true} -imgui-winit-support = {version="0.4.0", optional=true} -imgui-opengl-renderer = {version="0.8", optional = true} +imgui={version="0.6.1", optional=true} +imgui-winit-support = {version="0.6.1", optional=true} +imgui-opengl-renderer = {version="0.10.0", optional = true} cgmath = {version="0.17.0", features=["serde"]} -imgui-inspect = {version="0.5.0", optional = true} -imgui-inspect-derive = {version="0.5.0", optional= true} +imgui-inspect = {version="0.7.0", optional = true} +imgui-inspect-derive = {version="0.7.0", optional= true} tobj = "2.0.2" inline_tweak = "1.0.8" log = "0.4.11" simple-logging = "2.0.2" image2 = { git = "https://github.com/Leinnan/image2-rs", branch="legacy", default-features = false, features=["io"] } -glutin = "0.24.1" +glutin = "0.26.0" serde = { version = "1.0.117", features = ["derive"] } serde_json = "1.0.59" diff --git a/doppler/src/engine.rs b/doppler/src/engine.rs index db8d778..f2c041d 100644 --- a/doppler/src/engine.rs +++ b/doppler/src/engine.rs @@ -102,6 +102,7 @@ impl Engine { .with_resizable(true); let gl_window = glutin::ContextBuilder::new() + .with_gl_profile(glutin::GlProfile::Core) .build_windowed(window, &event_loop) .unwrap(); @@ -227,7 +228,9 @@ impl Engine { // other application-specific logic #[cfg(feature = "imgui_inspect")] { - last_frame = imgui.io_mut().update_delta_time(last_frame); + let now = Instant::now(); + imgui.io_mut().update_delta_time(now - last_frame); + last_frame = now; } } Event::MainEventsCleared => { diff --git a/doppler/src/imgui_helper.rs b/doppler/src/imgui_helper.rs index 82dea8d..52e2d01 100644 --- a/doppler/src/imgui_helper.rs +++ b/doppler/src/imgui_helper.rs @@ -31,7 +31,7 @@ impl InspectRenderDefault> for CgmathVec3f32 { let mut change = false; for el in data.iter_mut() { let mut array: [f32; 3] = [el.x, el.y, el.z]; - change |= ui.drag_float3(&label_im, &mut array).build(); + change |= ui.input_float3(&label_im, &mut array).build(); el.x = array[0]; el.y = array[1]; el.z = array[2]; @@ -66,7 +66,7 @@ impl InspectRenderDefault> for CgmathPoint3f32 { let mut change = false; for el in data.iter_mut() { let mut array: [f32; 3] = [el.x, el.y, el.z]; - change |= ui.drag_float3(&label_im, &mut array).build(); + change |= ui.input_float3(&label_im, &mut array).build(); el.x = array[0]; el.y = array[1]; el.z = array[2]; diff --git a/doppler/src/mesh.rs b/doppler/src/mesh.rs index 65493b0..da3e62e 100644 --- a/doppler/src/mesh.rs +++ b/doppler/src/mesh.rs @@ -16,7 +16,7 @@ use crate::shader::Shader; // Depending on how you pass the data to OpenGL, this may be bad. In this case it's not strictly // necessary though because of the `offset!` macro used below in setupMesh() #[repr(C)] -#[derive(Clone)] +#[derive(Clone,Debug)] pub struct Vertex { // position pub position: Vector3, @@ -42,7 +42,7 @@ impl Default for Vertex { } } -#[derive(Clone)] +#[derive(Clone,Debug)] pub struct Texture { pub id: u32, pub type_: String, @@ -57,7 +57,7 @@ impl Drop for Texture { } } -#[derive(Clone)] +#[derive(Clone,Debug)] pub struct Mesh { /* Mesh Data */ pub vertices: Vec, diff --git a/doppler/src/model.rs b/doppler/src/model.rs index 558ad3e..d026540 100644 --- a/doppler/src/model.rs +++ b/doppler/src/model.rs @@ -9,7 +9,7 @@ use log::{info, warn}; use std::path::Path; use tobj; -#[derive(Clone)] +#[derive(Clone,Debug)] pub struct Model { /* Model Data */ pub meshes: Vec, diff --git a/src/example_client.rs b/src/example_client.rs index 49f1d1e..cc38cd8 100644 --- a/src/example_client.rs +++ b/src/example_client.rs @@ -210,7 +210,8 @@ impl Client for ExampleClient { .size([250.0, 250.0], Condition::FirstUseEver) .opened(&mut show_window) .build(&ui, || { - ui.drag_int(im_str!("id"), &mut id).min(0).max(max).build(); + ui.input_int(im_str!("id"), &mut id).build(); + id = if id < 0 { 0 } else if id > max { max } else { id }; let mut selected_mut = vec![&mut self.models[id as usize].transform]; >::render_mut( @@ -244,10 +245,9 @@ impl Client for ExampleClient { ); } ui.separator(); - ui.drag_int(im_str!("Light ID"), &mut id) - .min(0) - .max(max) + ui.input_int(im_str!("Light ID"), &mut id) .build(); + id = if id < 0 { 0 } else if id > max { max } else { id }; { let mut selected_mut = vec![&mut self.lighting_system.point_lights[id as usize]];