adding texturing, getting sidetracked by config loading
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
use wgpu::{TextureView, Buffer, BindGroup};
|
||||
use std::sync::Arc;
|
||||
use rapier3d::dynamics::{RigidBody, RigidBodyHandle};
|
||||
use rapier3d::geometry::ColliderHandle;
|
||||
use rapier3d::geometry::Collider as r3dCollider;
|
||||
use std::time::{Duration, Instant};
|
||||
use cgmath::Deg;
|
||||
|
||||
use cgmath::{Deg, Euler};
|
||||
use rapier3d::dynamics::{RigidBody, RigidBodyHandle};
|
||||
use rapier3d::geometry::Collider as r3dCollider;
|
||||
use rapier3d::geometry::ColliderHandle;
|
||||
use wgpu::{BindGroup, Buffer, TextureView};
|
||||
|
||||
use crate::runtime::state::{TomlPositionDescription, TomlRotationDescription};
|
||||
|
||||
// a component is any type that is 'static, sized, send and sync
|
||||
|
||||
|
||||
pub struct ImguiWindow<'a> {
|
||||
pub window: imgui::Window<'a>,
|
||||
}
|
||||
@@ -28,6 +30,47 @@ pub struct Position {
|
||||
pub rot: cgmath::Euler<Deg<f32>>,
|
||||
}
|
||||
|
||||
impl From<TomlPositionDescription> for Position {
|
||||
fn from(pos: TomlPositionDescription) -> Self {
|
||||
let euler = match pos.rot {
|
||||
None => Euler {
|
||||
x: Deg(0.0),
|
||||
y: Deg(0.0),
|
||||
z: Deg(0.0),
|
||||
},
|
||||
Some(v) => Euler {
|
||||
x: Deg(v.x),
|
||||
y: Deg(v.y),
|
||||
z: Deg(v.z),
|
||||
},
|
||||
};
|
||||
Position {
|
||||
x: pos.x,
|
||||
y: pos.y,
|
||||
z: pos.z,
|
||||
rot: euler,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Option<TomlPositionDescription>> for Position {
|
||||
fn from(pos: Option<TomlPositionDescription>) -> Self {
|
||||
match pos {
|
||||
None => Position {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
rot: Euler {
|
||||
x: Deg(0.0),
|
||||
y: Deg(0.0),
|
||||
z: Deg(0.0),
|
||||
},
|
||||
},
|
||||
Some(v) => Position::from(v),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Eq, Hash, Copy, Debug)]
|
||||
pub struct RangeCopy<Idx> {
|
||||
pub start: Idx,
|
||||
@@ -55,4 +98,4 @@ pub struct Physics {
|
||||
pub struct Collider {
|
||||
pub collider: r3dCollider,
|
||||
pub collider_handle: Option<ColliderHandle>,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user