Allow demo UI to show just stats
This commit is contained in:
parent
3fafaff04f
commit
0166ff96de
|
@ -407,7 +407,7 @@ impl<W> DemoApp<W> where W: Window {
|
||||||
self.take_screenshot();
|
self.take_screenshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.options.ui {
|
if self.options.ui != UIVisibility::None {
|
||||||
if let Some(render_stats) = frame.render_stats.take() {
|
if let Some(render_stats) = frame.render_stats.take() {
|
||||||
self.renderer.debug_ui.add_sample(render_stats.stats,
|
self.renderer.debug_ui.add_sample(render_stats.stats,
|
||||||
frame.render_msg.tile_time,
|
frame.render_msg.tile_time,
|
||||||
|
@ -425,11 +425,12 @@ impl<W> DemoApp<W> where W: Window {
|
||||||
self.ui.show_text_effects = self.monochrome_scene_color.is_some();
|
self.ui.show_text_effects = self.monochrome_scene_color.is_some();
|
||||||
|
|
||||||
let mut ui_action = UIAction::None;
|
let mut ui_action = UIAction::None;
|
||||||
self.ui.update(&self.renderer.device,
|
if self.options.ui == UIVisibility::All {
|
||||||
&mut self.window,
|
self.ui.update(&self.renderer.device,
|
||||||
&mut self.renderer.debug_ui,
|
&mut self.window,
|
||||||
&mut ui_action);
|
&mut self.renderer.debug_ui,
|
||||||
|
&mut ui_action);
|
||||||
|
}
|
||||||
frame.ui_events = self.renderer.debug_ui.ui.event_queue.drain();
|
frame.ui_events = self.renderer.debug_ui.ui.event_queue.drain();
|
||||||
self.handle_ui_action(&mut ui_action);
|
self.handle_ui_action(&mut ui_action);
|
||||||
}
|
}
|
||||||
|
@ -725,7 +726,7 @@ pub struct Options {
|
||||||
pub jobs: Option<usize>,
|
pub jobs: Option<usize>,
|
||||||
pub mode: Mode,
|
pub mode: Mode,
|
||||||
pub input_path: SVGPath,
|
pub input_path: SVGPath,
|
||||||
pub ui: bool,
|
pub ui: UIVisibility,
|
||||||
hidden_field_for_future_proofing: (),
|
hidden_field_for_future_proofing: (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,7 +736,7 @@ impl Default for Options {
|
||||||
jobs: None,
|
jobs: None,
|
||||||
mode: Mode::TwoD,
|
mode: Mode::TwoD,
|
||||||
input_path: SVGPath::Default,
|
input_path: SVGPath::Default,
|
||||||
ui: true,
|
ui: UIVisibility::All,
|
||||||
hidden_field_for_future_proofing: (),
|
hidden_field_for_future_proofing: (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -754,8 +755,14 @@ impl Options {
|
||||||
)
|
)
|
||||||
.arg(Arg::with_name("3d").short("3").long("3d").help("Run in 3D").conflicts_with("vr"))
|
.arg(Arg::with_name("3d").short("3").long("3d").help("Run in 3D").conflicts_with("vr"))
|
||||||
.arg(Arg::with_name("vr").short("V").long("vr").help("Run in VR").conflicts_with("3d"))
|
.arg(Arg::with_name("vr").short("V").long("vr").help("Run in VR").conflicts_with("3d"))
|
||||||
.arg(Arg::with_name("ui").short("U").long("ui").help("Show UI").conflicts_with("no-ui"))
|
.arg(
|
||||||
.arg(Arg::with_name("no-ui").short("u").long("no-ui").help("Hide UI").conflicts_with("ui"))
|
Arg::with_name("ui")
|
||||||
|
.short("u")
|
||||||
|
.long("ui")
|
||||||
|
.takes_value(true)
|
||||||
|
.possible_values(&["none", "stats", "all"])
|
||||||
|
.help("How much UI to show"),
|
||||||
|
)
|
||||||
.arg(Arg::with_name("INPUT").help("Path to the SVG file to render").index(1))
|
.arg(Arg::with_name("INPUT").help("Path to the SVG file to render").index(1))
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
|
@ -769,10 +776,12 @@ impl Options {
|
||||||
self.mode = Mode::VR;
|
self.mode = Mode::VR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches.is_present("ui") {
|
if let Some(ui) = matches.value_of("ui") {
|
||||||
self.ui = true;
|
self.ui = match ui {
|
||||||
} else if matches.is_present("no-ui") {
|
"none" => UIVisibility::None,
|
||||||
self.ui = false;
|
"stats" => UIVisibility::Stats,
|
||||||
|
_ => UIVisibility::All,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(path) = matches.value_of("INPUT") {
|
if let Some(path) = matches.value_of("INPUT") {
|
||||||
|
@ -801,6 +810,13 @@ impl Mode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, PartialEq)]
|
||||||
|
pub enum UIVisibility {
|
||||||
|
None,
|
||||||
|
Stats,
|
||||||
|
All,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
struct RenderStats {
|
struct RenderStats {
|
||||||
rendering_time: Option<Duration>,
|
rendering_time: Option<Duration>,
|
||||||
|
|
Loading…
Reference in New Issue