mutzing about with a fps renderer. I am satisfied with this imgui thing I have going on. But it's a bit bone headed to have these two components so tightly coupled

This commit is contained in:
2021-02-21 02:55:43 -08:00
parent e376241aae
commit 4a041cc833
5 changed files with 138 additions and 35 deletions

View File

@@ -8,11 +8,13 @@ use rapier3d::geometry::ColliderHandle;
use wgpu::{BindGroup, Buffer, TextureView};
use crate::runtime::state::{TomlPositionDescription, TomlRotationDescription};
use imgui::Ui;
// a component is any type that is 'static, sized, send and sync
pub struct ImguiWindow<'a> {
pub window: imgui::Window<'a>,
pub struct ImguiWindow<'a, T> {
pub window: fn() -> imgui::Window<'a>,
pub func: fn(&Ui, &T),
}
#[derive(Clone, Copy, Debug, PartialEq)]
@@ -30,6 +32,21 @@ pub struct Position {
pub rot: cgmath::Euler<Deg<f32>>,
}
impl Default for Position {
fn default() -> Self {
Position {
x: 0.0,
y: 0.0,
z: 0.0,
rot: Euler {
x: Deg(0.0),
y: Deg(0.0),
z: Deg(0.0),
},
}
}
}
impl From<TomlPositionDescription> for Position {
fn from(pos: TomlPositionDescription) -> Self {
let euler = match pos.rot {