Skip to content

Commit

Permalink
update to egui 0.29.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bircni committed Sep 26, 2024
1 parent 9f05bba commit 3f677e6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ fn main() -> anyhow::Result<()> {
viewport,
renderer: Renderer::Wgpu,
depth_buffer: 32,
follow_system_theme: true,
centered: true,
..Default::default()
},
Expand Down
9 changes: 5 additions & 4 deletions src/ui/preview/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Resources>()
Expand Down Expand Up @@ -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 {
Expand Down
17 changes: 11 additions & 6 deletions src/ui/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
);
});
});
Expand Down Expand Up @@ -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) {
Expand All @@ -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");
Expand All @@ -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),
);
}
});
Expand Down Expand Up @@ -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")));
Expand Down

0 comments on commit 3f677e6

Please sign in to comment.