diff --git a/Cargo.toml b/Cargo.toml index c4748f073..ac8631404 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,7 +43,7 @@ c11-orbit = ["trackball/cc"] [dependencies] bevy = { version = "0.14.0-rc.2", default-features = false, features = ["bevy_render"] } -bevy_egui = { version = "0.27.1", default-features = false, features = ["render"], optional = true } +bevy_egui = { git = "https://github.com/mvlabat/bevy_egui", rev = "refs/pull/284/head", default-features = false, features = ["render"], optional = true } trackball = { version = "0.13.0", features = ["glam"] } [dev-dependencies.bevy] diff --git a/examples/egui.rs b/examples/egui.rs index 59b53b4dd..37905c3ad 100644 --- a/examples/egui.rs +++ b/examples/egui.rs @@ -92,7 +92,7 @@ fn setup( let cube_handle = meshes.add(Cuboid::new(4.0, 4.0, 4.0)); let default_material = StandardMaterial { - base_color: Color::rgb(0.8, 0.7, 0.6), + base_color: Color::srgb(0.8, 0.7, 0.6), reflectance: 0.02, unlit: false, ..default() @@ -112,7 +112,7 @@ fn setup( ..default() }) .insert(PreviewPassCube) - .insert(preview_pass_layer); + .insert(preview_pass_layer.clone()); // Cube parameters. let cube_size = 4.0; @@ -169,7 +169,7 @@ fn setup( // render before the "main pass" camera order: -1, target: RenderTarget::Image(image_handle), - clear_color: ClearColorConfig::Custom(Color::rgba(1.0, 1.0, 1.0, 0.0)), + clear_color: ClearColorConfig::Custom(Color::srgba(1.0, 1.0, 1.0, 0.0)), ..default() }, ..default() @@ -203,7 +203,9 @@ fn render_to_image_example_system( ui.end_row(); ui.label("Emissive:"); - color_picker_widget(ui, &mut preview_material.emissive); + let mut emissive_color = Color::from(preview_material.emissive); + color_picker_widget(ui, &mut emissive_color); + preview_material.emissive = emissive_color.into(); ui.end_row(); ui.label("Perceptual roughness:"); @@ -231,7 +233,7 @@ fn render_to_image_example_system( } fn color_picker_widget(ui: &mut egui::Ui, color: &mut Color) -> egui::Response { - let [r, g, b, a] = color.as_rgba_f32(); + let [r, g, b, a] = Srgba::from(*color).to_f32_array(); let mut egui_color: egui::Rgba = egui::Rgba::from_srgba_unmultiplied( (r * 255.0) as u8, (g * 255.0) as u8, @@ -244,7 +246,7 @@ fn color_picker_widget(ui: &mut egui::Ui, color: &mut Color) -> egui::Response { egui::color_picker::Alpha::Opaque, ); let [r, g, b, a] = egui_color.to_srgba_unmultiplied(); - *color = Color::rgba( + *color = Color::srgba( r as f32 / 255.0, g as f32 / 255.0, b as f32 / 255.0,