2019-08-02 18:56:37 +00:00
|
|
|
use specs::{Component, FlaggedStorage, NullStorage};
|
2019-07-29 19:54:48 +00:00
|
|
|
use specs_idvs::IDVStorage;
|
2019-07-29 19:54:58 +00:00
|
|
|
use vek::*;
|
2019-01-02 19:22:01 +00:00
|
|
|
|
2019-05-17 09:22:32 +00:00
|
|
|
// Position
|
2019-07-29 16:19:08 +00:00
|
|
|
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
2019-01-02 19:22:01 +00:00
|
|
|
pub struct Pos(pub Vec3<f32>);
|
|
|
|
|
|
|
|
impl Component for Pos {
|
2019-07-29 19:54:48 +00:00
|
|
|
type Storage = IDVStorage<Self>;
|
2019-01-02 19:22:01 +00:00
|
|
|
}
|
|
|
|
|
2019-05-17 09:22:32 +00:00
|
|
|
// Velocity
|
2019-07-29 16:19:08 +00:00
|
|
|
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
2019-01-02 19:22:01 +00:00
|
|
|
pub struct Vel(pub Vec3<f32>);
|
|
|
|
|
|
|
|
impl Component for Vel {
|
2019-07-29 19:54:48 +00:00
|
|
|
type Storage = IDVStorage<Self>;
|
2019-01-02 19:22:01 +00:00
|
|
|
}
|
|
|
|
|
2019-05-31 18:45:16 +00:00
|
|
|
// Orientation
|
2019-07-29 16:19:08 +00:00
|
|
|
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
2019-05-31 18:45:16 +00:00
|
|
|
pub struct Ori(pub Vec3<f32>);
|
2019-01-02 19:22:01 +00:00
|
|
|
|
2019-05-31 18:45:16 +00:00
|
|
|
impl Component for Ori {
|
2019-07-29 19:54:48 +00:00
|
|
|
type Storage = IDVStorage<Self>;
|
2019-03-05 00:00:11 +00:00
|
|
|
}
|
2019-04-14 20:30:27 +00:00
|
|
|
|
2019-08-02 18:56:37 +00:00
|
|
|
// Scale
|
|
|
|
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct Scale(pub f32);
|
|
|
|
|
|
|
|
impl Component for Scale {
|
|
|
|
type Storage = FlaggedStorage<Self, IDVStorage<Self>>;
|
|
|
|
}
|
|
|
|
|
2019-09-25 20:22:39 +00:00
|
|
|
// Mass
|
|
|
|
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct Mass(pub f32);
|
|
|
|
|
|
|
|
impl Component for Mass {
|
|
|
|
type Storage = FlaggedStorage<Self, IDVStorage<Self>>;
|
|
|
|
}
|
|
|
|
|
2019-08-23 10:11:37 +00:00
|
|
|
// PhysicsState
|
|
|
|
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
|
|
|
pub struct PhysicsState {
|
|
|
|
pub on_ground: bool,
|
2019-09-09 19:11:40 +00:00
|
|
|
pub on_wall: Option<Vec3<f32>>,
|
|
|
|
pub in_fluid: bool,
|
2019-08-23 10:11:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Component for PhysicsState {
|
|
|
|
type Storage = FlaggedStorage<Self, IDVStorage<Self>>;
|
|
|
|
}
|
|
|
|
|
2019-05-17 20:47:58 +00:00
|
|
|
// ForceUpdate
|
2019-07-30 05:24:36 +00:00
|
|
|
#[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
2019-04-14 20:30:27 +00:00
|
|
|
pub struct ForceUpdate;
|
|
|
|
|
|
|
|
impl Component for ForceUpdate {
|
|
|
|
type Storage = NullStorage<Self>;
|
|
|
|
}
|