mirror of
https://codeberg.org/icewind/vbspview.git
synced 2026-06-03 18:24:09 +02:00
debug toggle
This commit is contained in:
parent
66a5e302b5
commit
0bc20c0d65
2 changed files with 13 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ pub struct FirstPerson {
|
|||
control: CameraControl,
|
||||
speed: f32,
|
||||
keys: [bool; 4],
|
||||
pub debug: bool,
|
||||
}
|
||||
|
||||
impl FirstPerson {
|
||||
|
|
@ -20,6 +21,7 @@ impl FirstPerson {
|
|||
},
|
||||
speed,
|
||||
keys: [false; 4],
|
||||
debug: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -31,6 +33,11 @@ impl FirstPerson {
|
|||
let change = self.control.handle_events(camera, events)?;
|
||||
for event in events.iter_mut() {
|
||||
match event {
|
||||
Event::Text(text) => {
|
||||
if text == "`" {
|
||||
self.debug = !self.debug;
|
||||
}
|
||||
}
|
||||
Event::KeyPress { kind, .. } => {
|
||||
self.key_press(kind);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ impl Renderer {
|
|||
}
|
||||
|
||||
pub fn render(&mut self, mut frame_input: FrameInput) -> ThreeDResult<FrameOutput> {
|
||||
let (ui_change, panel_width) = self.gui.update(&mut frame_input, &self.camera)?;
|
||||
let (ui_change, _panel_width) = self.gui.update(&mut frame_input, &self.camera)?;
|
||||
let change = frame_input.first_frame || ui_change;
|
||||
if change {
|
||||
if self.gui.shadows_enabled {
|
||||
|
|
@ -79,9 +79,9 @@ impl Renderer {
|
|||
}
|
||||
|
||||
let viewport = Viewport {
|
||||
x: panel_width as i32,
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: frame_input.viewport.width - panel_width,
|
||||
width: frame_input.viewport.width,
|
||||
height: frame_input.viewport.height,
|
||||
};
|
||||
self.camera.set_viewport(viewport).unwrap();
|
||||
|
|
@ -149,7 +149,9 @@ impl Renderer {
|
|||
.render_pass(&self.camera, &self.models, &self.lights)?
|
||||
}
|
||||
};
|
||||
self.gui.render()?;
|
||||
if self.control.debug {
|
||||
self.gui.render()?;
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
Ok(FrameOutput::default())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue