From 3f677e6bd916aa8f3015927d85a4193ec6f00d64 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 26 Sep 2024 22:33:21 +0200 Subject: [PATCH] update to egui `0.29.0` --- Cargo.toml | 12 ++++++------ src/main.rs | 1 - src/ui/preview/gpu.rs | 9 +++++---- src/ui/properties.rs | 17 +++++++++++------ 4 files changed, 22 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 397f2ad..aaa3195 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,24 +67,24 @@ rayon = "1.10.0" bytemuck = { version = "1.18", features = ["derive"] } # total order for floats -ordered-float = "4.2.2" +ordered-float = "4.3.0" # generic serialization / deserialization serde = { version = "1.0.210", features = ["derive"] } serde_yml = "0.0.12" # GUI -eframe = { version = "0.28.1", features = [ +eframe = { version = "0.29.0", features = [ "wgpu", "accesskit", "default_fonts", "wayland", "x11", ], default-features = false } -egui = { version = "0.28.1", features = ["log", "color-hex"] } -egui-wgpu = { version = "0.28.1" } -egui_file = "0.18.0" -egui_extras = { version = "0.28.1", features = ["svg", "image"] } +egui = { version = "0.29.0", features = ["log", "color-hex"] } +egui-wgpu = { version = "0.29.0" } +egui_file = { git = "https://github.com/bircni/egui_file", branch = "egui_0.29.0" } +egui_extras = { version = "0.29.0", features = ["svg", "image"] } # BVH bvh = "0.10.0" diff --git a/src/main.rs b/src/main.rs index d6dfe2b..7e2a302 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,7 +52,6 @@ fn main() -> anyhow::Result<()> { viewport, renderer: Renderer::Wgpu, depth_buffer: 32, - follow_system_theme: true, centered: true, ..Default::default() }, diff --git a/src/ui/preview/gpu.rs b/src/ui/preview/gpu.rs index d2e456a..6292bc5 100644 --- a/src/ui/preview/gpu.rs +++ b/src/ui/preview/gpu.rs @@ -202,11 +202,11 @@ impl CallbackTrait for WgpuPainter { vec![] } - fn paint<'a>( - &'a self, + fn paint( + &self, _info: egui::PaintCallbackInfo, - render_pass: &mut wgpu::RenderPass<'a>, - callback_resources: &'a egui_wgpu::CallbackResources, + render_pass: &mut wgpu::RenderPass, + callback_resources: &egui_wgpu::CallbackResources, ) { let resources = callback_resources .get::() @@ -343,6 +343,7 @@ pub fn init_wgpu(render_state: &egui_wgpu::RenderState) { }), multisample: MultisampleState::default(), multiview: None, + cache: None, }); let uniform_buffer = device.create_buffer(&BufferDescriptor { diff --git a/src/ui/properties.rs b/src/ui/properties.rs index 9f6e0ab..b482dad 100644 --- a/src/ui/properties.rs +++ b/src/ui/properties.rs @@ -6,7 +6,7 @@ use crate::{ use anyhow::Context; use egui::{ color_picker, hex_color, include_image, Align, Button, CollapsingHeader, DragValue, FontFamily, - ImageButton, Layout, RichText, Slider, Ui, + ImageButton, Layout, RichText, Slider, SliderClamping, Ui, }; use egui_file::FileDialog; use log::warn; @@ -80,7 +80,7 @@ impl Properties { Slider::new(&mut scene.camera.fov, 0.0..=consts::PI) .step_by(0.01) .custom_formatter(|x, _| format!("{:.2}°", x.to_degrees())) - .clamp_to_range(true), + .clamping(SliderClamping::Always), ); }); }); @@ -109,7 +109,10 @@ impl Properties { color_picker::color_edit_button_rgb(ui, scene.settings.ambient_color.as_mut()); ui.label(format!("{}:", t!("ambient_intensity"))); - ui.add(Slider::new(&mut scene.settings.ambient_intensity, 0.0..=1.0).clamp_to_range(true)); + ui.add( + Slider::new(&mut scene.settings.ambient_intensity, 0.0..=1.0) + .clamping(SliderClamping::Always), + ); } fn render_options(ui: &mut Ui, render: &Render, scene: &mut Scene) { @@ -118,7 +121,7 @@ impl Properties { ui.add_enabled_ui(render.thread.is_none(), |ui| { ui.vertical(|ui| { let text = Self::format_render_size(scene.camera.resolution); - egui::ComboBox::from_id_source(0) + egui::ComboBox::from_id_salt(0) .selected_text(text) .show_ui(ui, |ui| { ui.selectable_value(&mut scene.camera.resolution, (1280, 720), "HD"); @@ -140,7 +143,8 @@ impl Properties { if scene.settings.anti_aliasing { ui.label("Samples per pixel:"); ui.add( - Slider::new(&mut scene.settings.samples, 1..=128).clamp_to_range(true), + Slider::new(&mut scene.settings.samples, 1..=128) + .clamping(SliderClamping::Always), ); } }); @@ -268,7 +272,8 @@ impl Properties { ui.label(format!("{}:", t!("intensity"))); ui.add( - Slider::new(&mut light.intensity, 0.0..=100.0).clamp_to_range(true), + Slider::new(&mut light.intensity, 0.0..=100.0) + .clamping(SliderClamping::Always), ); ui.label(format!("{}:", t!("color")));