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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user