Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to egui 0.25 and winit 0.29 #4732

Merged
merged 15 commits into from
Jan 10, 2024
858 changes: 447 additions & 411 deletions Cargo.lock

Large diffs are not rendered by default.

23 changes: 13 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,26 @@ re_ws_comms = { path = "crates/re_ws_comms", version = "=0.12.0-alpha.5", defaul
rerun = { path = "crates/rerun", version = "=0.12.0-alpha.5", default-features = false }

# egui-crates:
ecolor = "0.24.1"
eframe = { version = "0.24.1", default-features = false, features = [
ecolor = "0.25.0"
eframe = { version = "0.25.0", default-features = false, features = [
"accesskit",
"default_fonts",
"puffin",
"wayland",
"x11",
] }
egui = { version = "0.24.1", features = [
egui = { version = "0.25.0", features = [
"callstack",
"extra_debug_asserts",
"log",
"puffin",
] }
egui_commonmark = { version = "0.10", default-features = false }
egui_extras = { version = "0.24.1", features = ["http", "image", "puffin"] }
egui_plot = "0.24.2"
egui_tiles = "0.5"
egui-wgpu = "0.24.1"
emath = "0.24.1"
egui_commonmark = { version = "0.11", default-features = false }
egui_extras = { version = "0.25.0", features = ["http", "image", "puffin"] }
egui_plot = "0.25.0"
egui_tiles = "0.6"
egui-wgpu = "0.25.0"
emath = "0.25.0"

# All of our direct external dependencies should be found here:
ahash = "0.8"
Expand Down Expand Up @@ -230,7 +230,7 @@ wasm-bindgen-futures = "0.4.33"
web-sys = "0.3.61"
web-time = "0.2.0"
webbrowser = "0.8"
winit = "0.28.7"
winit = { version = "0.29.9", default-features = false }
# TODO(andreas): Try to get rid of `fragile-send-sync-non-atomic-wasm`. This requires re_renderer being aware of single-thread restriction on resources.
# See also https://gpuweb.github.io/gpuweb/explainer/#multithreading-transfer (unsolved part of the Spec as of writing!)
wgpu = { version = "0.18.0", features = ["fragile-send-sync-non-atomic-wasm"] }
Expand Down Expand Up @@ -278,7 +278,10 @@ debug = true
# eframe = { path = "../../egui/crates/eframe" }
# egui = { path = "../../egui/crates/egui" }
# egui_extras = { path = "../../egui/crates/egui_extras" }
# egui_plot = { path = "../../egui/crates/egui_plot" }
# egui-wgpu = { path = "../../egui/crates/egui-wgpu" }
# emath = { path = "../../egui/crates/emath" }

# egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", rev = "b6e4fd457b2eee2c671747ead12f4a20feb380e8" } # Merge of: https://github.com/rerun-io/egui_tiles/pull/41

# egui_commonmark = { git = "https://github.com/rerun-io/egui_commonmark", rev = "3d83a92f995a1d18ab1172d0b129d496e0eedaae" } # Update to egui 0.25 https://github.com/lampsitter/egui_commonmark/pull/27
48 changes: 22 additions & 26 deletions crates/re_data_ui/src/annotation_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,31 +214,27 @@ fn class_description_ui(
.collect()
};

body.rows(
row_height,
class.keypoint_connections.len(),
|row_idx, mut row| {
let pair = &class.keypoint_connections[row_idx];
let KeypointPair {
keypoint0,
keypoint1,
} = pair;
body.rows(row_height, class.keypoint_connections.len(), |mut row| {
let pair = &class.keypoint_connections[row.index()];
let KeypointPair {
keypoint0,
keypoint1,
} = pair;

for id in [keypoint0, keypoint1] {
row.col(|ui| {
ui.label(
keypoint_map
.get(id)
.and_then(|info| info.label.as_ref())
.map_or_else(
|| format!("id {}", id.0),
|label| label.to_string(),
),
);
});
}
},
);
for id in [keypoint0, keypoint1] {
row.col(|ui| {
ui.label(
keypoint_map
.get(id)
.and_then(|info| info.label.as_ref())
.map_or_else(
|| format!("id {}", id.0),
|label| label.to_string(),
),
);
});
}
});
});
});
},
Expand Down Expand Up @@ -281,8 +277,8 @@ fn annotation_info_table_ui(
.body(|mut body| {
re_ui::ReUi::setup_table_body(&mut body);

body.rows(row_height, annotation_infos.len(), |row_idx, mut row| {
let info = &annotation_infos[row_idx];
body.rows(row_height, annotation_infos.len(), |mut row| {
let info = &annotation_infos[row.index()];
row.col(|ui| {
ui.label(info.id.to_string());
});
Expand Down
4 changes: 2 additions & 2 deletions crates/re_data_ui/src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ impl DataUi for EntityComponentWithInstances {
.body(|mut body| {
re_ui::ReUi::setup_table_body(&mut body);
let row_height = re_ui::ReUi::table_line_height();
body.rows(row_height, displayed_row, |index, mut row| {
if let Some(instance_key) = instance_keys.get(index) {
body.rows(row_height, displayed_row, |mut row| {
if let Some(instance_key) = instance_keys.get(row.index()) {
row.col(|ui| {
let instance_path =
InstancePath::instance(self.entity_path.clone(), *instance_key);
Expand Down
8 changes: 4 additions & 4 deletions crates/re_data_ui/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ impl DataUi for LineStrip2D {
.body(|mut body| {
re_ui::ReUi::setup_table_body(&mut body);
let row_height = re_ui::ReUi::table_line_height();
body.rows(row_height, self.0.len(), |index, mut row| {
if let Some(pos) = self.0.get(index) {
body.rows(row_height, self.0.len(), |mut row| {
if let Some(pos) = self.0.get(row.index()) {
row.col(|ui| {
ui.label(format_f32(pos.x()));
});
Expand Down Expand Up @@ -200,8 +200,8 @@ impl DataUi for LineStrip3D {
.body(|mut body| {
re_ui::ReUi::setup_table_body(&mut body);
let row_height = re_ui::ReUi::table_line_height();
body.rows(row_height, self.0.len(), |index, mut row| {
if let Some(pos) = self.0.get(index) {
body.rows(row_height, self.0.len(), |mut row| {
if let Some(pos) = self.0.get(row.index()) {
row.col(|ui| {
ui.label(format_f32(pos.x()));
});
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/src/error_handling/error_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::wgpu_core_error::WrappedContextError;

#[cfg(webgpu)]
#[derive(Hash, PartialEq, Eq, Debug)]
struct WrappedContextError(pub String);
pub struct WrappedContextError(pub String);

pub struct ErrorEntry {
/// Frame index for frame on which this error was last logged.
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer_examples/2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ impl framework::Example for Render2D {
]
}

fn on_keyboard_input(&mut self, _input: winit::event::KeyboardInput) {}
fn on_key_event(&mut self, _input: winit::event::KeyEvent) {}
}

fn main() {
Expand Down
7 changes: 4 additions & 3 deletions crates/re_renderer_examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,18 @@ pollster.workspace = true
rand = { workspace = true, features = ["std", "std_rng"] }
web-time.workspace = true
wgpu.workspace = true
winit.workspace = true
winit = { workspace = true, features = ["rwh_05"] }
zip = { workspace = true, default-features = false, features = ["deflate"] }

[target.'cfg(target_arch = "wasm32")'.dependencies]
console_error_panic_hook.workspace = true
wasm-bindgen-futures.workspace = true
web-sys = { workspace = true, features = [
"Location",
"Blob",
"Element",
"Location",
"Request",
"RequestInit",
"RequestMode",
"Request",
"Response",
] }
11 changes: 7 additions & 4 deletions crates/re_renderer_examples/depth_cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ use re_renderer::{
view_builder::{self, Projection, ViewBuilder},
Color32, LineStripSeriesBuilder, PointCloudBuilder, Rgba, Size,
};
use winit::event::{ElementState, VirtualKeyCode};
use winit::{
event::ElementState,
keyboard::{self},
};

mod framework;

Expand Down Expand Up @@ -344,10 +347,10 @@ impl framework::Example for RenderDepthClouds {
]
}

fn on_keyboard_input(&mut self, input: winit::event::KeyboardInput) {
fn on_key_event(&mut self, input: winit::event::KeyEvent) {
#![allow(clippy::single_match)]
match (input.state, input.virtual_keycode) {
(ElementState::Released, Some(VirtualKeyCode::Space)) => {
match (input.state, input.logical_key) {
(ElementState::Released, keyboard::Key::Named(keyboard::NamedKey::Space)) => {
self.camera_control = match self.camera_control {
CameraControl::RotateAroundCenter => CameraControl::Manual,
CameraControl::Manual => CameraControl::RotateAroundCenter,
Expand Down
13 changes: 7 additions & 6 deletions crates/re_renderer_examples/depth_offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use re_renderer::{
renderer::{ColormappedTexture, RectangleDrawData, RectangleOptions, TexturedRect},
view_builder::{self, Projection, ViewBuilder},
};
use winit::keyboard;

mod framework;

Expand Down Expand Up @@ -127,22 +128,22 @@ impl framework::Example for Render2D {
}]
}

fn on_keyboard_input(&mut self, input: winit::event::KeyboardInput) {
fn on_key_event(&mut self, input: winit::event::KeyEvent) {
if input.state == winit::event::ElementState::Pressed {
match input.virtual_keycode {
Some(winit::event::VirtualKeyCode::Up) => {
match input.logical_key {
keyboard::Key::Named(keyboard::NamedKey::ArrowUp) => {
self.distance_scale *= 1.1;
re_log::info!(self.distance_scale);
}
Some(winit::event::VirtualKeyCode::Down) => {
keyboard::Key::Named(keyboard::NamedKey::ArrowDown) => {
self.distance_scale /= 1.1;
re_log::info!(self.distance_scale);
}
Some(winit::event::VirtualKeyCode::Right) => {
keyboard::Key::Named(keyboard::NamedKey::ArrowRight) => {
self.near_plane *= 1.1;
re_log::info!(self.near_plane);
}
Some(winit::event::VirtualKeyCode::Left) => {
keyboard::Key::Named(keyboard::NamedKey::ArrowLeft) => {
self.near_plane /= 1.1;
re_log::info!(self.near_plane);
}
Expand Down
Loading
Loading