adding texturing, getting sidetracked by config loading

This commit is contained in:
2021-02-20 20:56:20 -08:00
parent 2b77153f10
commit da2c6a436a
7 changed files with 214 additions and 144 deletions

View File

@@ -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>,
}
}