Simplify struct field name

This commit is contained in:
Hanno Braun 2022-10-12 13:39:46 +02:00
parent 9d0b1ff551
commit afc981e15d
2 changed files with 27 additions and 27 deletions

View File

@ -37,7 +37,7 @@ pub struct Renderer {
pipelines: Pipelines, pipelines: Pipelines,
/// State required for integration with `egui`. /// State required for integration with `egui`.
pub egui: Gui, pub gui: Gui,
} }
impl Renderer { impl Renderer {
@ -151,7 +151,7 @@ impl Renderer {
let pipelines = let pipelines =
Pipelines::new(&device, &bind_group_layout, color_format); Pipelines::new(&device, &bind_group_layout, color_format);
let egui = Gui::new(&device, surface_config.format); let gui = Gui::new(&device, surface_config.format);
Ok(Self { Ok(Self {
surface, surface,
@ -168,7 +168,7 @@ impl Renderer {
geometries, geometries,
pipelines, pipelines,
egui, gui,
}) })
} }
@ -275,7 +275,7 @@ impl Renderer {
} }
} }
self.egui.context.begin_frame(egui_input); self.gui.context.begin_frame(egui_input);
fn get_bbox_size_text(aabb: &Aabb<3>) -> String { fn get_bbox_size_text(aabb: &Aabb<3>) -> String {
/* Render size of model bounding box */ /* Render size of model bounding box */
@ -291,7 +291,7 @@ impl Renderer {
let line_drawing_available = self.is_line_drawing_available(); let line_drawing_available = self.is_line_drawing_available();
egui::SidePanel::left("fj-left-panel").show(&self.egui.context, |ui| { egui::SidePanel::left("fj-left-panel").show(&self.gui.context, |ui| {
ui.add_space(16.0); ui.add_space(16.0);
ui.group(|ui| { ui.group(|ui| {
@ -316,11 +316,11 @@ impl Renderer {
{ {
ui.group(|ui| { ui.group(|ui| {
ui.checkbox( ui.checkbox(
&mut self.egui.options.show_settings_ui, &mut self.gui.options.show_settings_ui,
"Show egui settings UI", "Show egui settings UI",
); );
if self.egui.options.show_settings_ui { if self.gui.options.show_settings_ui {
self.egui.context.settings_ui(ui); self.gui.context.settings_ui(ui);
} }
}); });
@ -328,12 +328,12 @@ impl Renderer {
ui.group(|ui| { ui.group(|ui| {
ui.checkbox( ui.checkbox(
&mut self.egui.options.show_inspection_ui, &mut self.gui.options.show_inspection_ui,
"Show egui inspection UI", "Show egui inspection UI",
); );
if self.egui.options.show_inspection_ui { if self.gui.options.show_inspection_ui {
ui.indent("indent-inspection-ui", |ui| { ui.indent("indent-inspection-ui", |ui| {
self.egui.context.inspection_ui(ui); self.gui.context.inspection_ui(ui);
}); });
} }
}); });
@ -356,7 +356,7 @@ impl Renderer {
ui.group(|ui| { ui.group(|ui| {
let label_text = format!( let label_text = format!(
"Show debug text demo.{}", "Show debug text demo.{}",
if self.egui.options.show_debug_text_example { if self.gui.options.show_debug_text_example {
" (Hover me.)" " (Hover me.)"
} else { } else {
"" ""
@ -367,11 +367,11 @@ impl Renderer {
if ui if ui
.checkbox( .checkbox(
&mut self.egui.options.show_debug_text_example, &mut self.gui.options.show_debug_text_example,
label_text, label_text,
) )
.hovered() .hovered()
&& self.egui.options.show_debug_text_example && self.gui.options.show_debug_text_example
{ {
let hover_pos = let hover_pos =
ui.input().pointer.hover_pos().unwrap_or_default(); ui.input().pointer.hover_pos().unwrap_or_default();
@ -396,29 +396,29 @@ impl Renderer {
if ui if ui
.checkbox( .checkbox(
&mut self.egui.options.show_layout_debug_on_hover, &mut self.gui.options.show_layout_debug_on_hover,
"Show layout debug on hover.", "Show layout debug on hover.",
) )
.changed() .changed()
{ {
ui.ctx().set_debug_on_hover( ui.ctx().set_debug_on_hover(
self.egui.options.show_layout_debug_on_hover, self.gui.options.show_layout_debug_on_hover,
); );
} }
ui.scope(|ui| { ui.scope(|ui| {
if self.egui.options.show_trace { if self.gui.options.show_trace {
egui::trace!(ui, format!("{:?}", &config)); egui::trace!(ui, format!("{:?}", &config));
} }
}); });
ui.indent("indent-show-trace", |ui| { ui.indent("indent-show-trace", |ui| {
ui.set_enabled( ui.set_enabled(
self.egui.options.show_layout_debug_on_hover, self.gui.options.show_layout_debug_on_hover,
); );
ui.checkbox( ui.checkbox(
&mut self.egui.options.show_trace, &mut self.gui.options.show_trace,
"Also show egui trace.", "Also show egui trace.",
); );
@ -430,7 +430,7 @@ impl Renderer {
ui.add_space(16.0); ui.add_space(16.0);
}); });
egui::Area::new("fj-status-message").show(&self.egui.context, |ui| { egui::Area::new("fj-status-message").show(&self.gui.context, |ui| {
ui.group(|ui| { ui.group(|ui| {
ui.add(egui::Label::new( ui.add(egui::Label::new(
egui::RichText::new(format!("Status:{}", status.status())) egui::RichText::new(format!("Status:{}", status.status()))
@ -440,8 +440,8 @@ impl Renderer {
}); });
// End the UI frame. We could now handle the output and draw the UI with the backend. // End the UI frame. We could now handle the output and draw the UI with the backend.
let egui_output = self.egui.context.end_frame(); let egui_output = self.gui.context.end_frame();
let egui_paint_jobs = self.egui.context.tessellate(egui_output.shapes); let egui_paint_jobs = self.gui.context.tessellate(egui_output.shapes);
self.paint_and_update_textures( self.paint_and_update_textures(
// //
@ -603,7 +603,7 @@ impl Renderer {
}; };
for (id, image_delta) in &textures_delta.set { for (id, image_delta) in &textures_delta.set {
self.egui.render_pass.update_texture( self.gui.render_pass.update_texture(
&self.device, &self.device,
&self.queue, &self.queue,
*id, *id,
@ -611,10 +611,10 @@ impl Renderer {
); );
} }
for id in &textures_delta.free { for id in &textures_delta.free {
self.egui.render_pass.free_texture(id); self.gui.render_pass.free_texture(id);
} }
self.egui.render_pass.update_buffers( self.gui.render_pass.update_buffers(
&self.device, &self.device,
&self.queue, &self.queue,
clipped_primitives, clipped_primitives,
@ -645,7 +645,7 @@ impl Renderer {
}; };
// Record all render passes. // Record all render passes.
self.egui.render_pass.execute( self.gui.render_pass.execute(
encoder, encoder,
output_view, output_view,
clipped_primitives, clipped_primitives,

View File

@ -105,7 +105,7 @@ pub fn run(
// The primary visible impact of this currently is that if you drag // The primary visible impact of this currently is that if you drag
// a title bar that overlaps the model then both the model & window // a title bar that overlaps the model then both the model & window
// get moved. // get moved.
egui_winit_state.on_event(&renderer.egui.context, window_event); egui_winit_state.on_event(&renderer.gui.context, window_event);
} }
// fj-window events // fj-window events