mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'slipped/skeletons' into 'master'
new skeletons See merge request veloren/veloren!620
This commit is contained in:
commit
a6d268e8ee
BIN
assets/voxygen/voxel/npc/cardinalfish/tail.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/cardinalfish/tail.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/cardinalfish/torso.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/cardinalfish/torso.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/crow/head.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/crow/head.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/crow/torso.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/crow/torso.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/crow/wing_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/crow/wing_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/crow/wing_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/crow/wing_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/chest_front.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/chest_front.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/chest_rear.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/chest_rear.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/foot_bl.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/foot_bl.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/foot_br.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/foot_br.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/foot_fl.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/foot_fl.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/foot_fr.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/foot_fr.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/head.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/head.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/tail_front.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/tail_front.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/tail_rear.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/tail_rear.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/wing_in_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/wing_in_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/wing_in_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/wing_in_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/wing_out_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/wing_out_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/dragon/wing_out_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/dragon/wing_out_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/duck_m/body.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/duck_m/body.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/duck_m/head.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/duck_m/head.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/duck_m/leg_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/duck_m/leg_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/duck_m/leg_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/duck_m/leg_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/duck_m/tail.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/duck_m/tail.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/duck_m/wing.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/duck_m/wing.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/foot_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/foot_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/foot_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/foot_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/hand_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/hand_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/hand_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/hand_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/head.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/head.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/leg_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/leg_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/leg_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/leg_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/lower_torso.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/lower_torso.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/shoulder_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/shoulder_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/shoulder_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/shoulder_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/knight/torso_upper.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/knight/torso_upper.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/fin_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/fin_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/fin_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/fin_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/head.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/head.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/rear.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/rear.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/tail.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/tail.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/torso.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/torso.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,7 +1,13 @@
|
||||
pub mod biped_large;
|
||||
pub mod bird_medium;
|
||||
pub mod bird_small;
|
||||
pub mod dragon;
|
||||
pub mod fish_medium;
|
||||
pub mod fish_small;
|
||||
pub mod humanoid;
|
||||
pub mod object;
|
||||
pub mod quadruped;
|
||||
pub mod quadruped_medium;
|
||||
pub mod quadruped_small;
|
||||
|
||||
use specs::{Component, FlaggedStorage};
|
||||
use specs_idvs::IDVStorage;
|
||||
@ -9,8 +15,14 @@ use specs_idvs::IDVStorage;
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Body {
|
||||
Humanoid(humanoid::Body),
|
||||
Quadruped(quadruped::Body),
|
||||
QuadrupedSmall(quadruped_small::Body),
|
||||
QuadrupedMedium(quadruped_medium::Body),
|
||||
BirdMedium(bird_medium::Body),
|
||||
FishMedium(fish_medium::Body),
|
||||
Dragon(dragon::Body),
|
||||
BirdSmall(bird_small::Body),
|
||||
FishSmall(fish_small::Body),
|
||||
BipedLarge(biped_large::Body),
|
||||
Object(object::Body),
|
||||
}
|
||||
|
||||
|
100
common/src/comp/body/biped_large.rs
Normal file
100
common/src/comp/body/biped_large.rs
Normal file
@ -0,0 +1,100 @@
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct Body {
|
||||
pub head: Head,
|
||||
pub upper_torso: UpperTorso,
|
||||
pub lower_torso: LowerTorso,
|
||||
pub shoulder_l: ShoulderL,
|
||||
pub shoulder_r: ShoulderR,
|
||||
pub hand_l: HandL,
|
||||
pub hand_r: HandR,
|
||||
pub leg_l: LegL,
|
||||
pub leg_r: LegR,
|
||||
pub foot_l: FootL,
|
||||
pub foot_r: FootR,
|
||||
}
|
||||
impl Body {
|
||||
pub fn random() -> Self {
|
||||
let mut rng = thread_rng();
|
||||
Self {
|
||||
head: *(&ALL_HEADS).choose(&mut rng).unwrap(),
|
||||
upper_torso: *(&ALL_UPPER_TORSOS).choose(&mut rng).unwrap(),
|
||||
lower_torso: *(&ALL_LOWER_TORSOS).choose(&mut rng).unwrap(),
|
||||
shoulder_l: *(&ALL_SHOULDER_LS).choose(&mut rng).unwrap(),
|
||||
shoulder_r: *(&ALL_SHOULDER_RS).choose(&mut rng).unwrap(),
|
||||
hand_l: *(&ALL_HAND_LS).choose(&mut rng).unwrap(),
|
||||
hand_r: *(&ALL_HAND_RS).choose(&mut rng).unwrap(),
|
||||
leg_l: *(&ALL_LEG_LS).choose(&mut rng).unwrap(),
|
||||
leg_r: *(&ALL_LEG_RS).choose(&mut rng).unwrap(),
|
||||
foot_l: *(&ALL_FOOT_LS).choose(&mut rng).unwrap(),
|
||||
foot_r: *(&ALL_FOOT_RS).choose(&mut rng).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Head {
|
||||
Default,
|
||||
}
|
||||
const ALL_HEADS: [Head; 1] = [Head::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum UpperTorso {
|
||||
Default,
|
||||
}
|
||||
const ALL_UPPER_TORSOS: [UpperTorso; 1] = [UpperTorso::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum LowerTorso {
|
||||
Default,
|
||||
}
|
||||
const ALL_LOWER_TORSOS: [LowerTorso; 1] = [LowerTorso::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum ShoulderL {
|
||||
Default,
|
||||
}
|
||||
const ALL_SHOULDER_LS: [ShoulderL; 1] = [ShoulderL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum ShoulderR {
|
||||
Default,
|
||||
}
|
||||
const ALL_SHOULDER_RS: [ShoulderR; 1] = [ShoulderR::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum HandL {
|
||||
Default,
|
||||
}
|
||||
const ALL_HAND_LS: [HandL; 1] = [HandL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum HandR {
|
||||
Default,
|
||||
}
|
||||
const ALL_HAND_RS: [HandR; 1] = [HandR::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum LegL {
|
||||
Default,
|
||||
}
|
||||
const ALL_LEG_LS: [LegL; 1] = [LegL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum LegR {
|
||||
Default,
|
||||
}
|
||||
const ALL_LEG_RS: [LegR; 1] = [LegR::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum FootL {
|
||||
Default,
|
||||
}
|
||||
const ALL_FOOT_LS: [FootL; 1] = [FootL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum FootR {
|
||||
Default,
|
||||
}
|
||||
const ALL_FOOT_RS: [FootR; 1] = [FootR::Default];
|
68
common/src/comp/body/bird_medium.rs
Normal file
68
common/src/comp/body/bird_medium.rs
Normal file
@ -0,0 +1,68 @@
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct Body {
|
||||
pub head: Head,
|
||||
pub torso: Torso,
|
||||
pub tail: Tail,
|
||||
pub wing_l: WingL,
|
||||
pub wing_r: WingR,
|
||||
pub leg_l: LegL,
|
||||
pub leg_r: LegR,
|
||||
}
|
||||
impl Body {
|
||||
pub fn random() -> Self {
|
||||
let mut rng = thread_rng();
|
||||
Self {
|
||||
head: *(&ALL_HEADS).choose(&mut rng).unwrap(),
|
||||
torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(),
|
||||
tail: *(&ALL_TAILS).choose(&mut rng).unwrap(),
|
||||
wing_l: *(&ALL_WING_LS).choose(&mut rng).unwrap(),
|
||||
wing_r: *(&ALL_WING_RS).choose(&mut rng).unwrap(),
|
||||
leg_l: *(&ALL_LEG_LS).choose(&mut rng).unwrap(),
|
||||
leg_r: *(&ALL_LEG_RS).choose(&mut rng).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Head {
|
||||
Default,
|
||||
}
|
||||
const ALL_HEADS: [Head; 1] = [Head::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Torso {
|
||||
Default,
|
||||
}
|
||||
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Tail {
|
||||
Default,
|
||||
}
|
||||
const ALL_TAILS: [Tail; 1] = [Tail::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WingL {
|
||||
Default,
|
||||
}
|
||||
const ALL_WING_LS: [WingL; 1] = [WingL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WingR {
|
||||
Default,
|
||||
}
|
||||
const ALL_WING_RS: [WingR; 1] = [WingR::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum LegL {
|
||||
Default,
|
||||
}
|
||||
const ALL_LEG_LS: [LegL; 1] = [LegL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum LegR {
|
||||
Default,
|
||||
}
|
||||
const ALL_LEG_RS: [LegR; 1] = [LegR::Default];
|
44
common/src/comp/body/bird_small.rs
Normal file
44
common/src/comp/body/bird_small.rs
Normal file
@ -0,0 +1,44 @@
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct Body {
|
||||
pub head: Head,
|
||||
pub torso: Torso,
|
||||
pub wing_l: WingL,
|
||||
pub wing_r: WingR,
|
||||
}
|
||||
impl Body {
|
||||
pub fn random() -> Self {
|
||||
let mut rng = thread_rng();
|
||||
Self {
|
||||
head: *(&ALL_HEADS).choose(&mut rng).unwrap(),
|
||||
torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(),
|
||||
wing_l: *(&ALL_WING_LS).choose(&mut rng).unwrap(),
|
||||
wing_r: *(&ALL_WING_RS).choose(&mut rng).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Head {
|
||||
Default,
|
||||
}
|
||||
const ALL_HEADS: [Head; 1] = [Head::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Torso {
|
||||
Default,
|
||||
}
|
||||
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WingL {
|
||||
Default,
|
||||
}
|
||||
const ALL_WING_LS: [WingL; 1] = [WingL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WingR {
|
||||
Default,
|
||||
}
|
||||
const ALL_WING_RS: [WingR; 1] = [WingR::Default];
|
116
common/src/comp/body/dragon.rs
Normal file
116
common/src/comp/body/dragon.rs
Normal file
@ -0,0 +1,116 @@
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct Body {
|
||||
pub head: Head,
|
||||
pub chest_front: ChestFront,
|
||||
pub chest_rear: ChestRear,
|
||||
pub tail_front: TailFront,
|
||||
pub tail_rear: TailRear,
|
||||
pub wing_in_l: WingInL,
|
||||
pub wing_in_r: WingInR,
|
||||
pub wing_out_l: WingOutL,
|
||||
pub wing_out_r: WingOutR,
|
||||
pub foot_fl: FootFL,
|
||||
pub foot_fr: FootFR,
|
||||
pub foot_bl: FootBL,
|
||||
pub foot_br: FootBR,
|
||||
}
|
||||
impl Body {
|
||||
pub fn random() -> Self {
|
||||
let mut rng = thread_rng();
|
||||
Self {
|
||||
head: *(&ALL_HEADS).choose(&mut rng).unwrap(),
|
||||
chest_front: *(&ALL_CHEST_FRONTS).choose(&mut rng).unwrap(),
|
||||
chest_rear: *(&ALL_CHEST_REARS).choose(&mut rng).unwrap(),
|
||||
tail_front: *(&ALL_TAIL_FRONTS).choose(&mut rng).unwrap(),
|
||||
tail_rear: *(&ALL_TAIL_REARS).choose(&mut rng).unwrap(),
|
||||
wing_in_l: *(&ALL_WING_IN_LS).choose(&mut rng).unwrap(),
|
||||
wing_in_r: *(&ALL_WING_IN_RS).choose(&mut rng).unwrap(),
|
||||
wing_out_l: *(&ALL_WING_OUT_LS).choose(&mut rng).unwrap(),
|
||||
wing_out_r: *(&ALL_WING_OUT_RS).choose(&mut rng).unwrap(),
|
||||
foot_fl: *(&ALL_FOOT_FLS).choose(&mut rng).unwrap(),
|
||||
foot_fr: *(&ALL_FOOT_FRS).choose(&mut rng).unwrap(),
|
||||
foot_bl: *(&ALL_FOOT_BLS).choose(&mut rng).unwrap(),
|
||||
foot_br: *(&ALL_FOOT_BRS).choose(&mut rng).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Head {
|
||||
Default,
|
||||
}
|
||||
const ALL_HEADS: [Head; 1] = [Head::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum ChestFront {
|
||||
Default,
|
||||
}
|
||||
const ALL_CHEST_FRONTS: [ChestFront; 1] = [ChestFront::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum ChestRear {
|
||||
Default,
|
||||
}
|
||||
const ALL_CHEST_REARS: [ChestRear; 1] = [ChestRear::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum TailFront {
|
||||
Default,
|
||||
}
|
||||
const ALL_TAIL_FRONTS: [TailFront; 1] = [TailFront::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum TailRear {
|
||||
Default,
|
||||
}
|
||||
const ALL_TAIL_REARS: [TailRear; 1] = [TailRear::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WingInL {
|
||||
Default,
|
||||
}
|
||||
const ALL_WING_IN_LS: [WingInL; 1] = [WingInL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WingInR {
|
||||
Default,
|
||||
}
|
||||
const ALL_WING_IN_RS: [WingInR; 1] = [WingInR::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WingOutL {
|
||||
Default,
|
||||
}
|
||||
const ALL_WING_OUT_LS: [WingOutL; 1] = [WingOutL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum WingOutR {
|
||||
Default,
|
||||
}
|
||||
const ALL_WING_OUT_RS: [WingOutR; 1] = [WingOutR::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum FootFL {
|
||||
Default,
|
||||
}
|
||||
const ALL_FOOT_FLS: [FootFL; 1] = [FootFL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum FootFR {
|
||||
Default,
|
||||
}
|
||||
const ALL_FOOT_FRS: [FootFR; 1] = [FootFR::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum FootBL {
|
||||
Default,
|
||||
}
|
||||
const ALL_FOOT_BLS: [FootBL; 1] = [FootBL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum FootBR {
|
||||
Default,
|
||||
}
|
||||
const ALL_FOOT_BRS: [FootBR; 1] = [FootBR::Default];
|
60
common/src/comp/body/fish_medium.rs
Normal file
60
common/src/comp/body/fish_medium.rs
Normal file
@ -0,0 +1,60 @@
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct Body {
|
||||
pub head: Head,
|
||||
pub torso: Torso,
|
||||
pub rear: Rear,
|
||||
pub tail: Tail,
|
||||
pub fin_l: FinL,
|
||||
pub fin_r: FinR,
|
||||
}
|
||||
impl Body {
|
||||
pub fn random() -> Self {
|
||||
let mut rng = thread_rng();
|
||||
Self {
|
||||
head: *(&ALL_HEADS).choose(&mut rng).unwrap(),
|
||||
torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(),
|
||||
rear: *(&ALL_REARS).choose(&mut rng).unwrap(),
|
||||
tail: *(&ALL_TAILS).choose(&mut rng).unwrap(),
|
||||
fin_l: *(&ALL_FIN_LS).choose(&mut rng).unwrap(),
|
||||
fin_r: *(&ALL_FIN_RS).choose(&mut rng).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Head {
|
||||
Default,
|
||||
}
|
||||
const ALL_HEADS: [Head; 1] = [Head::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Torso {
|
||||
Default,
|
||||
}
|
||||
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Rear {
|
||||
Default,
|
||||
}
|
||||
const ALL_REARS: [Rear; 1] = [Rear::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Tail {
|
||||
Default,
|
||||
}
|
||||
const ALL_TAILS: [Tail; 1] = [Tail::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum FinL {
|
||||
Default,
|
||||
}
|
||||
const ALL_FIN_LS: [FinL; 1] = [FinL::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum FinR {
|
||||
Default,
|
||||
}
|
||||
const ALL_FIN_RS: [FinR; 1] = [FinR::Default];
|
28
common/src/comp/body/fish_small.rs
Normal file
28
common/src/comp/body/fish_small.rs
Normal file
@ -0,0 +1,28 @@
|
||||
use rand::{seq::SliceRandom, thread_rng};
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct Body {
|
||||
pub torso: Torso,
|
||||
pub tail: Tail,
|
||||
}
|
||||
impl Body {
|
||||
pub fn random() -> Self {
|
||||
let mut rng = thread_rng();
|
||||
Self {
|
||||
torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(),
|
||||
tail: *(&ALL_TAILS).choose(&mut rng).unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Torso {
|
||||
Default,
|
||||
}
|
||||
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Tail {
|
||||
Default,
|
||||
}
|
||||
const ALL_TAILS: [Tail; 1] = [Tail::Default];
|
@ -16,7 +16,10 @@ mod visual;
|
||||
// Reexports
|
||||
pub use admin::Admin;
|
||||
pub use agent::Agent;
|
||||
pub use body::{humanoid, object, quadruped, quadruped_medium, Body};
|
||||
pub use body::{
|
||||
biped_large, bird_medium, bird_small, dragon, fish_medium, fish_small, humanoid, object,
|
||||
quadruped_medium, quadruped_small, Body,
|
||||
};
|
||||
pub use character_state::{ActionState, CharacterState, MovementState};
|
||||
pub use controller::{
|
||||
ControlEvent, Controller, ControllerInputs, InventoryManip, MountState, Mounting,
|
||||
|
@ -30,6 +30,7 @@ impl FromStr for NpcKind {
|
||||
"humanoid" => Ok(NpcKind::Humanoid),
|
||||
"wolf" => Ok(NpcKind::Wolf),
|
||||
"pig" => Ok(NpcKind::Pig),
|
||||
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ fn alignment_to_agent(alignment: &str, target: EcsEntity) -> Option<comp::Agent>
|
||||
fn kind_to_body(kind: NpcKind) -> comp::Body {
|
||||
match kind {
|
||||
NpcKind::Humanoid => comp::Body::Humanoid(comp::humanoid::Body::random()),
|
||||
NpcKind::Pig => comp::Body::Quadruped(comp::quadruped::Body::random()),
|
||||
NpcKind::Pig => comp::Body::QuadrupedSmall(comp::quadruped_small::Body::random()),
|
||||
NpcKind::Wolf => comp::Body::QuadrupedMedium(comp::quadruped_medium::Body::random()),
|
||||
}
|
||||
}
|
||||
|
68
voxygen/src/anim/biped_large/idle.rs
Normal file
68
voxygen/src/anim/biped_large/idle.rs
Normal file
@ -0,0 +1,68 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
BipedLargeSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Skeleton = BipedLargeSkeleton;
|
||||
type Dependency = (f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.upper_torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.lower_torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.shoulder_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.shoulder_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.hand_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.hand_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.leg_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.leg_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.foot_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.foot_r.scale = Vec3::one() / 10.88;
|
||||
next
|
||||
}
|
||||
}
|
68
voxygen/src/anim/biped_large/jump.rs
Normal file
68
voxygen/src/anim/biped_large/jump.rs
Normal file
@ -0,0 +1,68 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
BipedLargeSkeleton,
|
||||
};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
impl Animation for JumpAnimation {
|
||||
type Skeleton = BipedLargeSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.upper_torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.lower_torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.shoulder_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.shoulder_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.hand_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.hand_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.leg_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.leg_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.foot_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.foot_r.scale = Vec3::one() / 10.88;
|
||||
next
|
||||
}
|
||||
}
|
91
voxygen/src/anim/biped_large/mod.rs
Normal file
91
voxygen/src/anim/biped_large/mod.rs
Normal file
@ -0,0 +1,91 @@
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod run;
|
||||
|
||||
// Reexports
|
||||
pub use self::idle::IdleAnimation;
|
||||
pub use self::jump::JumpAnimation;
|
||||
pub use self::run::RunAnimation;
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
use crate::render::FigureBoneData;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BipedLargeSkeleton {
|
||||
head: Bone,
|
||||
upper_torso: Bone,
|
||||
lower_torso: Bone,
|
||||
shoulder_l: Bone,
|
||||
shoulder_r: Bone,
|
||||
hand_l: Bone,
|
||||
hand_r: Bone,
|
||||
leg_l: Bone,
|
||||
leg_r: Bone,
|
||||
foot_l: Bone,
|
||||
foot_r: Bone,
|
||||
}
|
||||
|
||||
impl BipedLargeSkeleton {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
head: Bone::default(),
|
||||
upper_torso: Bone::default(),
|
||||
lower_torso: Bone::default(),
|
||||
shoulder_l: Bone::default(),
|
||||
shoulder_r: Bone::default(),
|
||||
hand_l: Bone::default(),
|
||||
hand_r: Bone::default(),
|
||||
leg_l: Bone::default(),
|
||||
leg_r: Bone::default(),
|
||||
foot_l: Bone::default(),
|
||||
foot_r: Bone::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Skeleton for BipedLargeSkeleton {
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
let upper_torso_mat = self.upper_torso.compute_base_matrix();
|
||||
let shoulder_l_mat = self.shoulder_l.compute_base_matrix();
|
||||
let shoulder_r_mat = self.shoulder_r.compute_base_matrix();
|
||||
let leg_l_mat = self.leg_l.compute_base_matrix();
|
||||
let leg_r_mat = self.leg_r.compute_base_matrix();
|
||||
|
||||
[
|
||||
FigureBoneData::new(self.head.compute_base_matrix()),
|
||||
FigureBoneData::new(upper_torso_mat),
|
||||
FigureBoneData::new(self.lower_torso.compute_base_matrix() * upper_torso_mat),
|
||||
FigureBoneData::new(shoulder_l_mat * upper_torso_mat),
|
||||
FigureBoneData::new(shoulder_r_mat * upper_torso_mat),
|
||||
FigureBoneData::new(
|
||||
self.hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat,
|
||||
),
|
||||
FigureBoneData::new(
|
||||
self.hand_r.compute_base_matrix() * shoulder_r_mat * upper_torso_mat,
|
||||
),
|
||||
FigureBoneData::new(leg_l_mat),
|
||||
FigureBoneData::new(leg_r_mat),
|
||||
FigureBoneData::new(self.foot_l.compute_base_matrix() * leg_l_mat),
|
||||
FigureBoneData::new(self.foot_r.compute_base_matrix() * leg_r_mat),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
]
|
||||
}
|
||||
|
||||
fn interpolate(&mut self, target: &Self, dt: f32) {
|
||||
self.head.interpolate(&target.head, dt);
|
||||
self.upper_torso.interpolate(&target.upper_torso, dt);
|
||||
self.lower_torso.interpolate(&target.lower_torso, dt);
|
||||
self.shoulder_l.interpolate(&target.shoulder_l, dt);
|
||||
self.shoulder_r.interpolate(&target.shoulder_r, dt);
|
||||
self.hand_l.interpolate(&target.hand_l, dt);
|
||||
self.hand_r.interpolate(&target.hand_r, dt);
|
||||
self.leg_l.interpolate(&target.leg_l, dt);
|
||||
self.leg_r.interpolate(&target.leg_r, dt);
|
||||
self.foot_l.interpolate(&target.foot_l, dt);
|
||||
self.foot_r.interpolate(&target.foot_r, dt);
|
||||
}
|
||||
}
|
68
voxygen/src/anim/biped_large/run.rs
Normal file
68
voxygen/src/anim/biped_large/run.rs
Normal file
@ -0,0 +1,68 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
BipedLargeSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Skeleton = BipedLargeSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.upper_torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.lower_torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.shoulder_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.shoulder_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.hand_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.hand_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.leg_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.leg_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.foot_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.foot_r.scale = Vec3::one() / 10.88;
|
||||
next
|
||||
}
|
||||
}
|
52
voxygen/src/anim/bird_medium/idle.rs
Normal file
52
voxygen/src/anim/bird_medium/idle.rs
Normal file
@ -0,0 +1,52 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
BirdMediumSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Skeleton = BirdMediumSkeleton;
|
||||
type Dependency = (f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.tail.ori = Quaternion::rotation_z(0.0);
|
||||
next.tail.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
|
||||
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_l.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
|
||||
next.wing_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.wing_r.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
||||
next.leg_l.ori = Quaternion::rotation_y(0.0);
|
||||
next.leg_l.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.leg_r.offset = Vec3::new(0.0, 0.75, 5.25);
|
||||
next.leg_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.leg_r.scale = Vec3::one() * 1.00;
|
||||
next
|
||||
}
|
||||
}
|
52
voxygen/src/anim/bird_medium/jump.rs
Normal file
52
voxygen/src/anim/bird_medium/jump.rs
Normal file
@ -0,0 +1,52 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
BirdMediumSkeleton,
|
||||
};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
impl Animation for JumpAnimation {
|
||||
type Skeleton = BirdMediumSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.tail.ori = Quaternion::rotation_z(0.0);
|
||||
next.tail.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
|
||||
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_l.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
|
||||
next.wing_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.wing_r.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
||||
next.leg_l.ori = Quaternion::rotation_y(0.0);
|
||||
next.leg_l.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.leg_r.offset = Vec3::new(0.0, 0.75, 5.25);
|
||||
next.leg_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.leg_r.scale = Vec3::one() * 1.00;
|
||||
next
|
||||
}
|
||||
}
|
71
voxygen/src/anim/bird_medium/mod.rs
Normal file
71
voxygen/src/anim/bird_medium/mod.rs
Normal file
@ -0,0 +1,71 @@
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod run;
|
||||
|
||||
// Reexports
|
||||
pub use self::idle::IdleAnimation;
|
||||
pub use self::jump::JumpAnimation;
|
||||
pub use self::run::RunAnimation;
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
use crate::render::FigureBoneData;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BirdMediumSkeleton {
|
||||
head: Bone,
|
||||
torso: Bone,
|
||||
tail: Bone,
|
||||
wing_l: Bone,
|
||||
wing_r: Bone,
|
||||
leg_l: Bone,
|
||||
leg_r: Bone,
|
||||
}
|
||||
|
||||
impl BirdMediumSkeleton {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
head: Bone::default(),
|
||||
torso: Bone::default(),
|
||||
tail: Bone::default(),
|
||||
wing_l: Bone::default(),
|
||||
wing_r: Bone::default(),
|
||||
leg_l: Bone::default(),
|
||||
leg_r: Bone::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Skeleton for BirdMediumSkeleton {
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
|
||||
[
|
||||
FigureBoneData::new(self.head.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(torso_mat),
|
||||
FigureBoneData::new(self.tail.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(self.wing_l.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(self.wing_r.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(self.leg_l.compute_base_matrix()),
|
||||
FigureBoneData::new(self.leg_r.compute_base_matrix()),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
]
|
||||
}
|
||||
|
||||
fn interpolate(&mut self, target: &Self, dt: f32) {
|
||||
self.head.interpolate(&target.head, dt);
|
||||
self.torso.interpolate(&target.torso, dt);
|
||||
self.tail.interpolate(&target.tail, dt);
|
||||
self.wing_l.interpolate(&target.wing_l, dt);
|
||||
self.wing_r.interpolate(&target.wing_r, dt);
|
||||
self.leg_l.interpolate(&target.leg_l, dt);
|
||||
self.leg_r.interpolate(&target.leg_r, dt);
|
||||
}
|
||||
}
|
52
voxygen/src/anim/bird_medium/run.rs
Normal file
52
voxygen/src/anim/bird_medium/run.rs
Normal file
@ -0,0 +1,52 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
BirdMediumSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Skeleton = BirdMediumSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.tail.ori = Quaternion::rotation_z(0.0);
|
||||
next.tail.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
|
||||
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_l.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
|
||||
next.wing_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.wing_r.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
||||
next.leg_l.ori = Quaternion::rotation_y(0.0);
|
||||
next.leg_l.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.leg_r.offset = Vec3::new(0.0, 0.75, 5.25);
|
||||
next.leg_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.leg_r.scale = Vec3::one() * 1.00;
|
||||
next
|
||||
}
|
||||
}
|
41
voxygen/src/anim/bird_small/idle.rs
Normal file
41
voxygen/src/anim/bird_small/idle.rs
Normal file
@ -0,0 +1,41 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
BirdSmallSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Skeleton = BirdSmallSkeleton;
|
||||
type Dependency = (f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
41
voxygen/src/anim/bird_small/jump.rs
Normal file
41
voxygen/src/anim/bird_small/jump.rs
Normal file
@ -0,0 +1,41 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
BirdSmallSkeleton,
|
||||
};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
impl Animation for JumpAnimation {
|
||||
type Skeleton = BirdSmallSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
62
voxygen/src/anim/bird_small/mod.rs
Normal file
62
voxygen/src/anim/bird_small/mod.rs
Normal file
@ -0,0 +1,62 @@
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod run;
|
||||
|
||||
// Reexports
|
||||
pub use self::idle::IdleAnimation;
|
||||
pub use self::jump::JumpAnimation;
|
||||
pub use self::run::RunAnimation;
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
use crate::render::FigureBoneData;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BirdSmallSkeleton {
|
||||
head: Bone,
|
||||
torso: Bone,
|
||||
wing_l: Bone,
|
||||
wing_r: Bone,
|
||||
}
|
||||
|
||||
impl BirdSmallSkeleton {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
head: Bone::default(),
|
||||
torso: Bone::default(),
|
||||
wing_l: Bone::default(),
|
||||
wing_r: Bone::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Skeleton for BirdSmallSkeleton {
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
|
||||
[
|
||||
FigureBoneData::new(self.head.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(torso_mat),
|
||||
FigureBoneData::new(self.wing_l.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(self.wing_r.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
]
|
||||
}
|
||||
|
||||
fn interpolate(&mut self, target: &Self, dt: f32) {
|
||||
self.head.interpolate(&target.head, dt);
|
||||
self.torso.interpolate(&target.torso, dt);
|
||||
self.wing_l.interpolate(&target.wing_l, dt);
|
||||
self.wing_r.interpolate(&target.wing_r, dt);
|
||||
}
|
||||
}
|
41
voxygen/src/anim/bird_small/run.rs
Normal file
41
voxygen/src/anim/bird_small/run.rs
Normal file
@ -0,0 +1,41 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
BirdSmallSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Skeleton = BirdSmallSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_l.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
147
voxygen/src/anim/character/run - Copy.rs
Normal file
147
voxygen/src/anim/character/run - Copy.rs
Normal file
@ -0,0 +1,147 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
CharacterSkeleton,
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
use std::ops::Mul;
|
||||
use vek::*;
|
||||
|
||||
pub struct SneakAnimation;
|
||||
|
||||
impl Animation for SneakAnimation {
|
||||
type Skeleton = CharacterSkeleton;
|
||||
type Dependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(velocity, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
*rate = speed;
|
||||
|
||||
let constant = 1.0;
|
||||
let wave = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 1.2).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.2).sin());
|
||||
let wave_cos = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.5).sin());
|
||||
let wave_cos_dub = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 4.8).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.5).sin());
|
||||
|
||||
let wave_diff = (anim_time as f32 * 0.6).sin();
|
||||
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin();
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 4.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.2,
|
||||
((global_time + anim_time) as f32 / 4.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.1,
|
||||
);
|
||||
|
||||
let ori = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| Vec2::<f32>::from(o).magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.5)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-3.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 20.0 + wave_cos * 1.3,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1)
|
||||
* Quaternion::rotation_x(head_look.y + 0.35);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 1.1);
|
||||
next.chest.ori = Quaternion::rotation_z(wave * 0.2);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_cos * 1.1);
|
||||
next.belt.ori = Quaternion::rotation_z(wave * 0.35);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_cos * 1.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_stop * -1.0,
|
||||
-0.25 + wave_cos * 2.0,
|
||||
5.0 - wave * 1.5,
|
||||
);
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(0.8 + wave_cos * 1.2) * Quaternion::rotation_y(wave_stop * 0.1);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
6.0 + wave_stop * 1.0,
|
||||
-0.25 - wave_cos * 2.0,
|
||||
5.0 + wave * 1.5,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.8 + wave_cos * -1.2)
|
||||
* Quaternion::rotation_y(wave_stop * -0.1);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0 - wave_cos_dub * 0.7);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.2);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0 - wave_cos_dub * 0.7);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.2);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(
|
||||
-7.0 + skeleton_attr.weapon_x,
|
||||
-5.0 + skeleton_attr.weapon_y,
|
||||
15.0,
|
||||
);
|
||||
next.weapon.ori =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(wave * 0.15);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.draw.offset = Vec3::new(0.0, 5.0, 0.0);
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.3 + wave * -0.08, 0.4) * skeleton_attr.scaler;
|
||||
next.torso.ori =
|
||||
Quaternion::rotation_x(wave_stop * speed * -0.06 + wave_diff * speed * -0.005)
|
||||
* Quaternion::rotation_y(tilt);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
151
voxygen/src/anim/character/sneak.rs
Normal file
151
voxygen/src/anim/character/sneak.rs
Normal file
@ -0,0 +1,151 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
CharacterSkeleton,
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
use std::ops::Mul;
|
||||
use vek::*;
|
||||
|
||||
pub struct SneakAnimation;
|
||||
|
||||
impl Animation for SneakAnimation {
|
||||
type Skeleton = CharacterSkeleton;
|
||||
type Dependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(velocity, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
*rate = speed;
|
||||
|
||||
let constant = 1.0;
|
||||
let wave = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 1.2).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.2).sin());
|
||||
let wavecos = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 1.2).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.2).cos());
|
||||
let wave_cos = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.5).sin());
|
||||
let wave_cos_dub = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 4.8).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.5).sin());
|
||||
let wave_slow = (anim_time as f32 * 0.1).sin();
|
||||
let wave_diff = (anim_time as f32 * 0.6).sin();
|
||||
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin();
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 *0.25)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.4,
|
||||
((global_time + anim_time) as f32 *0.25)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.2,
|
||||
);
|
||||
|
||||
let ori = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| Vec2::<f32>::from(o).magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.5)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
0.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 16.0,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1)
|
||||
* Quaternion::rotation_x(head_look.y + 0.05);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, -1.5, 3.0 +wave_slow * 2.0);
|
||||
next.chest.ori = Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(wave * 0.15);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 1.5 + wave_cos * 0.3);
|
||||
next.belt.ori = Quaternion::rotation_x(-0.1) * Quaternion::rotation_z(wave * 0.25);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, 1.0, -1.0 + wave_cos * 0.3);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.2) *Quaternion::rotation_z(wave * 0.4);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-5.0 + wave_stop * -0.5,
|
||||
2.25,
|
||||
4.0 - wave * 1.0,
|
||||
);
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(1.5 + wave_cos * 0.1) * Quaternion::rotation_y(wave_stop * 0.1);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
5.0 + wave_stop * 0.5,
|
||||
2.25,
|
||||
4.0 + wave * 1.0,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.5 + wave_cos * -0.1)
|
||||
* Quaternion::rotation_y(wave_stop * -0.1);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.4, 5.0+ wave * -3.0, 4.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.8 + wavecos * 0.15);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 5.0+ wave * 3.0, 4.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.8 - wavecos * 0.15);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(
|
||||
-7.0 + skeleton_attr.weapon_x,
|
||||
-5.0 + skeleton_attr.weapon_y,
|
||||
15.0,
|
||||
);
|
||||
next.weapon.ori =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(wavecos * 0.05);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(wave * 0.05);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.draw.offset = Vec3::new(0.0, 5.0, 0.0);
|
||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||
next.draw.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.3 + wave * -0.08, 0.4) * skeleton_attr.scaler;
|
||||
next.torso.ori =
|
||||
Quaternion::rotation_x(wave_stop * speed * -0.03 + wave_diff * speed * -0.005)
|
||||
* Quaternion::rotation_y(tilt);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
76
voxygen/src/anim/dragon/idle.rs
Normal file
76
voxygen/src/anim/dragon/idle.rs
Normal file
@ -0,0 +1,76 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
DragonSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Skeleton = DragonSkeleton;
|
||||
type Dependency = (f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.chest_front.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest_front.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.chest_rear.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest_rear.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.tail_front.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail_front.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.tail_rear.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail_rear.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_in_l.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_in_l.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_in_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_in_r.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_out_l.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_out_l.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_out_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_out_r.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_fl.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_fl.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_fr.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_fr.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_bl.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_bl.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_br.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_br.scale = Vec3::one() * 1.01;
|
||||
next
|
||||
}
|
||||
}
|
76
voxygen/src/anim/dragon/jump.rs
Normal file
76
voxygen/src/anim/dragon/jump.rs
Normal file
@ -0,0 +1,76 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
DragonSkeleton,
|
||||
};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
impl Animation for JumpAnimation {
|
||||
type Skeleton = DragonSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.chest_front.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest_front.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.chest_rear.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest_rear.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.tail_front.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail_front.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.tail_rear.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail_rear.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_in_l.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_in_l.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_in_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_in_r.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_out_l.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_out_l.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_out_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_out_r.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_fl.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_fl.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_fr.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_fr.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_bl.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_bl.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_br.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_br.scale = Vec3::one() * 1.01;
|
||||
next
|
||||
}
|
||||
}
|
92
voxygen/src/anim/dragon/mod.rs
Normal file
92
voxygen/src/anim/dragon/mod.rs
Normal file
@ -0,0 +1,92 @@
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod run;
|
||||
|
||||
// Reexports
|
||||
pub use self::idle::IdleAnimation;
|
||||
pub use self::jump::JumpAnimation;
|
||||
pub use self::run::RunAnimation;
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
use crate::render::FigureBoneData;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DragonSkeleton {
|
||||
head: Bone,
|
||||
chest_front: Bone,
|
||||
chest_rear: Bone,
|
||||
tail_front: Bone,
|
||||
tail_rear: Bone,
|
||||
wing_in_l: Bone,
|
||||
wing_in_r: Bone,
|
||||
wing_out_l: Bone,
|
||||
wing_out_r: Bone,
|
||||
foot_fl: Bone,
|
||||
foot_fr: Bone,
|
||||
foot_bl: Bone,
|
||||
foot_br: Bone,
|
||||
}
|
||||
|
||||
impl DragonSkeleton {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
head: Bone::default(),
|
||||
chest_front: Bone::default(),
|
||||
chest_rear: Bone::default(),
|
||||
tail_front: Bone::default(),
|
||||
tail_rear: Bone::default(),
|
||||
wing_in_l: Bone::default(),
|
||||
wing_in_r: Bone::default(),
|
||||
wing_out_l: Bone::default(),
|
||||
wing_out_r: Bone::default(),
|
||||
foot_fl: Bone::default(),
|
||||
foot_fr: Bone::default(),
|
||||
foot_bl: Bone::default(),
|
||||
foot_br: Bone::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Skeleton for DragonSkeleton {
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
let chest_front_mat = self.chest_front.compute_base_matrix();
|
||||
let wing_in_l_mat = self.wing_in_l.compute_base_matrix();
|
||||
let wing_in_r_mat = self.wing_in_r.compute_base_matrix();
|
||||
let tail_front_mat = self.tail_front.compute_base_matrix();
|
||||
|
||||
[
|
||||
FigureBoneData::new(self.head.compute_base_matrix() * chest_front_mat),
|
||||
FigureBoneData::new(chest_front_mat),
|
||||
FigureBoneData::new(self.chest_rear.compute_base_matrix() * chest_front_mat),
|
||||
FigureBoneData::new(tail_front_mat),
|
||||
FigureBoneData::new(self.tail_rear.compute_base_matrix() * tail_front_mat),
|
||||
FigureBoneData::new(wing_in_l_mat),
|
||||
FigureBoneData::new(wing_in_r_mat),
|
||||
FigureBoneData::new(self.wing_out_l.compute_base_matrix() * wing_in_l_mat),
|
||||
FigureBoneData::new(self.wing_out_r.compute_base_matrix() * wing_in_r_mat),
|
||||
FigureBoneData::new(self.foot_fl.compute_base_matrix()),
|
||||
FigureBoneData::new(self.foot_fr.compute_base_matrix()),
|
||||
FigureBoneData::new(self.foot_bl.compute_base_matrix()),
|
||||
FigureBoneData::new(self.foot_br.compute_base_matrix()),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
]
|
||||
}
|
||||
|
||||
fn interpolate(&mut self, target: &Self, dt: f32) {
|
||||
self.head.interpolate(&target.head, dt);
|
||||
self.chest_front.interpolate(&target.chest_front, dt);
|
||||
self.chest_rear.interpolate(&target.chest_rear, dt);
|
||||
self.tail_front.interpolate(&target.tail_front, dt);
|
||||
self.tail_rear.interpolate(&target.tail_rear, dt);
|
||||
self.wing_in_l.interpolate(&target.wing_in_l, dt);
|
||||
self.wing_in_r.interpolate(&target.wing_in_r, dt);
|
||||
self.wing_out_l.interpolate(&target.wing_out_l, dt);
|
||||
self.wing_out_r.interpolate(&target.wing_out_r, dt);
|
||||
self.foot_fl.interpolate(&target.foot_fl, dt);
|
||||
self.foot_fr.interpolate(&target.foot_fr, dt);
|
||||
self.foot_bl.interpolate(&target.foot_bl, dt);
|
||||
self.foot_br.interpolate(&target.foot_br, dt);
|
||||
}
|
||||
}
|
76
voxygen/src/anim/dragon/run.rs
Normal file
76
voxygen/src/anim/dragon/run.rs
Normal file
@ -0,0 +1,76 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
DragonSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Skeleton = DragonSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.chest_front.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest_front.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.chest_rear.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest_rear.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.tail_front.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail_front.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.tail_rear.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail_rear.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_in_l.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_in_l.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_in_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_in_r.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_out_l.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_out_l.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.wing_out_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.wing_out_r.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_fl.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_fl.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_fr.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_fr.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_bl.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_bl.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.foot_br.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_br.scale = Vec3::one() * 1.01;
|
||||
next
|
||||
}
|
||||
}
|
48
voxygen/src/anim/fish_medium/idle.rs
Normal file
48
voxygen/src/anim/fish_medium/idle.rs
Normal file
@ -0,0 +1,48 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
FishMediumSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Skeleton = FishMediumSkeleton;
|
||||
type Dependency = (f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.rear.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.rear.ori = Quaternion::rotation_z(0.0);
|
||||
next.rear.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
|
||||
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
|
||||
next.fin_l.ori = Quaternion::rotation_y(0.0);
|
||||
next.fin_l.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
||||
next.fin_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.fin_r.scale = Vec3::one() / 10.5;
|
||||
next
|
||||
}
|
||||
}
|
48
voxygen/src/anim/fish_medium/jump.rs
Normal file
48
voxygen/src/anim/fish_medium/jump.rs
Normal file
@ -0,0 +1,48 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
FishMediumSkeleton,
|
||||
};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
impl Animation for JumpAnimation {
|
||||
type Skeleton = FishMediumSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.rear.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.rear.ori = Quaternion::rotation_z(0.0);
|
||||
next.rear.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
|
||||
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
|
||||
next.fin_l.ori = Quaternion::rotation_y(0.0);
|
||||
next.fin_l.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
||||
next.fin_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.fin_r.scale = Vec3::one() / 10.5;
|
||||
next
|
||||
}
|
||||
}
|
69
voxygen/src/anim/fish_medium/mod.rs
Normal file
69
voxygen/src/anim/fish_medium/mod.rs
Normal file
@ -0,0 +1,69 @@
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod run;
|
||||
|
||||
// Reexports
|
||||
pub use self::idle::IdleAnimation;
|
||||
pub use self::jump::JumpAnimation;
|
||||
pub use self::run::RunAnimation;
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
use crate::render::FigureBoneData;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FishMediumSkeleton {
|
||||
head: Bone,
|
||||
torso: Bone,
|
||||
rear: Bone,
|
||||
tail: Bone,
|
||||
fin_l: Bone,
|
||||
fin_r: Bone,
|
||||
}
|
||||
|
||||
impl FishMediumSkeleton {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
head: Bone::default(),
|
||||
torso: Bone::default(),
|
||||
rear: Bone::default(),
|
||||
tail: Bone::default(),
|
||||
fin_l: Bone::default(),
|
||||
fin_r: Bone::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Skeleton for FishMediumSkeleton {
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
let rear_mat = self.rear.compute_base_matrix();
|
||||
|
||||
[
|
||||
FigureBoneData::new(self.head.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(torso_mat),
|
||||
FigureBoneData::new(rear_mat * torso_mat),
|
||||
FigureBoneData::new(self.tail.compute_base_matrix() * rear_mat),
|
||||
FigureBoneData::new(self.fin_l.compute_base_matrix() * rear_mat),
|
||||
FigureBoneData::new(self.fin_r.compute_base_matrix() * rear_mat),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
]
|
||||
}
|
||||
|
||||
fn interpolate(&mut self, target: &Self, dt: f32) {
|
||||
self.head.interpolate(&target.head, dt);
|
||||
self.torso.interpolate(&target.torso, dt);
|
||||
self.rear.interpolate(&target.rear, dt);
|
||||
self.tail.interpolate(&target.tail, dt);
|
||||
self.fin_l.interpolate(&target.fin_l, dt);
|
||||
self.fin_r.interpolate(&target.fin_r, dt);
|
||||
}
|
||||
}
|
48
voxygen/src/anim/fish_medium/run.rs
Normal file
48
voxygen/src/anim/fish_medium/run.rs
Normal file
@ -0,0 +1,48 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
FishMediumSkeleton,
|
||||
};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Skeleton = FishMediumSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.head.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.rear.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.rear.ori = Quaternion::rotation_z(0.0);
|
||||
next.rear.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
|
||||
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
|
||||
next.fin_l.ori = Quaternion::rotation_y(0.0);
|
||||
next.fin_l.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
||||
next.fin_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.fin_r.scale = Vec3::one() / 10.5;
|
||||
next
|
||||
}
|
||||
}
|
33
voxygen/src/anim/fish_small/idle.rs
Normal file
33
voxygen/src/anim/fish_small/idle.rs
Normal file
@ -0,0 +1,33 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
FishSmallSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Skeleton = FishSmallSkeleton;
|
||||
type Dependency = (f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.tail.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one() * 1.01;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
33
voxygen/src/anim/fish_small/jump.rs
Normal file
33
voxygen/src/anim/fish_small/jump.rs
Normal file
@ -0,0 +1,33 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
FishSmallSkeleton,
|
||||
};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
impl Animation for JumpAnimation {
|
||||
type Skeleton = FishSmallSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.tail.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one() * 1.01;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
56
voxygen/src/anim/fish_small/mod.rs
Normal file
56
voxygen/src/anim/fish_small/mod.rs
Normal file
@ -0,0 +1,56 @@
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod run;
|
||||
|
||||
// Reexports
|
||||
pub use self::idle::IdleAnimation;
|
||||
pub use self::jump::JumpAnimation;
|
||||
pub use self::run::RunAnimation;
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
use crate::render::FigureBoneData;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FishSmallSkeleton {
|
||||
torso: Bone,
|
||||
tail: Bone,
|
||||
}
|
||||
|
||||
impl FishSmallSkeleton {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
torso: Bone::default(),
|
||||
tail: Bone::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Skeleton for FishSmallSkeleton {
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
|
||||
[
|
||||
FigureBoneData::new(torso_mat),
|
||||
FigureBoneData::new(self.tail.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
]
|
||||
}
|
||||
|
||||
fn interpolate(&mut self, target: &Self, dt: f32) {
|
||||
self.torso.interpolate(&target.torso, dt);
|
||||
self.tail.interpolate(&target.tail, dt);
|
||||
}
|
||||
}
|
33
voxygen/src/anim/fish_small/run.rs
Normal file
33
voxygen/src/anim/fish_small/run.rs
Normal file
@ -0,0 +1,33 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
FishSmallSkeleton,
|
||||
};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Skeleton = FishSmallSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.tail.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one() * 1.01;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,8 +1,14 @@
|
||||
pub mod biped_large;
|
||||
pub mod bird_medium;
|
||||
pub mod bird_small;
|
||||
pub mod character;
|
||||
pub mod dragon;
|
||||
pub mod fish_medium;
|
||||
pub mod fish_small;
|
||||
pub mod fixture;
|
||||
pub mod object;
|
||||
pub mod quadruped;
|
||||
pub mod quadrupedmedium;
|
||||
pub mod quadruped_medium;
|
||||
pub mod quadruped_small;
|
||||
|
||||
use crate::render::FigureBoneData;
|
||||
use common::comp::{self, item::Tool};
|
||||
|
@ -1,67 +0,0 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
QuadrupedSkeleton,
|
||||
};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Skeleton = QuadrupedSkeleton;
|
||||
type Dependency = (f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave = (anim_time as f32 * 14.0).sin();
|
||||
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
|
||||
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
|
||||
|
||||
let pig_head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 8.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.5,
|
||||
((global_time + anim_time) as f32 / 8.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.25,
|
||||
);
|
||||
|
||||
next.pig_head.offset = Vec3::new(0.0, -2.0, -1.5 + wave * 0.2) / 11.0;
|
||||
next.pig_head.ori = Quaternion::rotation_z(pig_head_look.x)
|
||||
* Quaternion::rotation_x(pig_head_look.y + wave_slow_cos * 0.03);
|
||||
next.pig_head.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.pig_chest.offset = Vec3::new(wave_slow * 0.05, -9.0, 1.5 + wave_slow_cos * 0.4) / 11.0;
|
||||
next.pig_chest.ori = Quaternion::rotation_y(wave_slow * 0.05);
|
||||
next.pig_chest.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.pig_leg_lf.offset = Vec3::new(-4.5, 2.0, 1.5) / 11.0;
|
||||
next.pig_leg_lf.ori = Quaternion::rotation_x(wave_slow * 0.08);
|
||||
next.pig_leg_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.pig_leg_rf.offset = Vec3::new(2.5, 2.0, 1.5) / 11.0;
|
||||
next.pig_leg_rf.ori = Quaternion::rotation_x(wave_slow_cos * 0.08);
|
||||
next.pig_leg_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.pig_leg_lb.offset = Vec3::new(-4.5, -3.0, 1.5) / 11.0;
|
||||
next.pig_leg_lb.ori = Quaternion::rotation_x(wave_slow_cos * 0.08);
|
||||
next.pig_leg_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.pig_leg_rb.offset = Vec3::new(2.5, -3.0, 1.5) / 11.0;
|
||||
next.pig_leg_rb.ori = Quaternion::rotation_x(wave_slow * 0.08);
|
||||
next.pig_leg_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
QuadrupedSkeleton,
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
impl Animation for JumpAnimation {
|
||||
type Skeleton = QuadrupedSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave_slow = (anim_time as f32 * 7.0 + PI).sin();
|
||||
let wave_stop = (anim_time as f32 * 4.5).min(PI / 2.0).sin();
|
||||
|
||||
next.pig_head.offset = Vec3::new(0.0, 0.0, -1.5) / 11.0;
|
||||
next.pig_head.ori = Quaternion::rotation_x(wave_stop * 0.4);
|
||||
next.pig_head.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.pig_chest.offset = Vec3::new(0.0, -9.0, 1.5) / 11.0;
|
||||
next.pig_chest.ori = Quaternion::rotation_x(0.0);
|
||||
next.pig_chest.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.pig_leg_lf.offset = Vec3::new(-4.5, 3.0, 1.5) / 11.0;
|
||||
next.pig_leg_lf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3);
|
||||
next.pig_leg_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.pig_leg_rf.offset = Vec3::new(2.5, 3.0, 1.5) / 11.0;
|
||||
next.pig_leg_rf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3);
|
||||
next.pig_leg_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.pig_leg_lb.offset = Vec3::new(-4.5, -4.0, 2.0) / 11.0;
|
||||
next.pig_leg_lb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3);
|
||||
next.pig_leg_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.pig_leg_rb.offset = Vec3::new(2.5, -4.0, 2.0) / 11.0;
|
||||
next.pig_leg_rb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3);
|
||||
next.pig_leg_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod run;
|
||||
|
||||
// Reexports
|
||||
pub use self::idle::IdleAnimation;
|
||||
pub use self::jump::JumpAnimation;
|
||||
pub use self::run::RunAnimation;
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
use crate::render::FigureBoneData;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct QuadrupedSkeleton {
|
||||
pig_head: Bone,
|
||||
pig_chest: Bone,
|
||||
pig_leg_lf: Bone,
|
||||
pig_leg_rf: Bone,
|
||||
pig_leg_lb: Bone,
|
||||
pig_leg_rb: Bone,
|
||||
}
|
||||
|
||||
impl QuadrupedSkeleton {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
pig_head: Bone::default(),
|
||||
pig_chest: Bone::default(),
|
||||
pig_leg_lf: Bone::default(),
|
||||
pig_leg_rf: Bone::default(),
|
||||
pig_leg_lb: Bone::default(),
|
||||
pig_leg_rb: Bone::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Skeleton for QuadrupedSkeleton {
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
[
|
||||
FigureBoneData::new(self.pig_head.compute_base_matrix()),
|
||||
FigureBoneData::new(self.pig_chest.compute_base_matrix()),
|
||||
FigureBoneData::new(self.pig_leg_lf.compute_base_matrix()),
|
||||
FigureBoneData::new(self.pig_leg_rf.compute_base_matrix()),
|
||||
FigureBoneData::new(self.pig_leg_lb.compute_base_matrix()),
|
||||
FigureBoneData::new(self.pig_leg_rb.compute_base_matrix()),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
]
|
||||
}
|
||||
|
||||
fn interpolate(&mut self, target: &Self, dt: f32) {
|
||||
self.pig_head.interpolate(&target.pig_head, dt);
|
||||
self.pig_chest.interpolate(&target.pig_chest, dt);
|
||||
self.pig_leg_lf.interpolate(&target.pig_leg_lf, dt);
|
||||
self.pig_leg_rf.interpolate(&target.pig_leg_rf, dt);
|
||||
self.pig_leg_lb.interpolate(&target.pig_leg_lb, dt);
|
||||
self.pig_leg_rb.interpolate(&target.pig_leg_rb, dt);
|
||||
}
|
||||
}
|
100
voxygen/src/anim/quadruped_medium/idle.rs
Normal file
100
voxygen/src/anim/quadruped_medium/idle.rs
Normal file
@ -0,0 +1,100 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
QuadrupedMediumSkeleton,
|
||||
};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
impl Animation for IdleAnimation {
|
||||
type Skeleton = QuadrupedMediumSkeleton;
|
||||
type Dependency = (f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
|
||||
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
|
||||
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
|
||||
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
|
||||
|
||||
let look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 8.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.5,
|
||||
((global_time + anim_time) as f32 / 8.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.25,
|
||||
);
|
||||
let tailmove = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 2.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.25,
|
||||
((global_time + anim_time) as f32 / 2.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.125,
|
||||
);
|
||||
|
||||
next.head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_ultra_slow * 0.4) / 11.0;
|
||||
next.head_upper.ori = Quaternion::rotation_z(look.x) * Quaternion::rotation_x(look.y);
|
||||
next.head_upper.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.jaw.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0 + wave_slow * 0.2);
|
||||
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
|
||||
next.jaw.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_ultra_slow * 0.20);
|
||||
next.head_lower.ori = Quaternion::rotation_z(0.0);
|
||||
next.head_lower.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, -13.0, 8.0 + wave_ultra_slow * 1.2) / 11.0;
|
||||
next.tail.ori = Quaternion::rotation_z(0.0 + wave_slow * 0.2 + tailmove.x)
|
||||
* Quaternion::rotation_x(tailmove.y);
|
||||
next.tail.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.torso_back.offset = Vec3::new(0.0, -11.7, 11.0 + wave_ultra_slow * 1.2) / 11.0;
|
||||
next.torso_back.ori = Quaternion::rotation_y(wave_slow_cos * 0.015);
|
||||
next.torso_back.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_ultra_slow * 0.7) / 11.0;
|
||||
next.torso_mid.ori = Quaternion::rotation_y(wave_slow * 0.015);
|
||||
next.torso_mid.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.ears.offset = Vec3::new(0.0, 0.75, 5.25);
|
||||
next.ears.ori = Quaternion::rotation_x(0.0 + wave_slow * 0.1);
|
||||
next.ears.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.foot_lf.offset = Vec3::new(-5.0, 5.0, 2.5) / 11.0;
|
||||
next.foot_lf.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.foot_rf.offset = Vec3::new(5.0, 5.0, 2.5) / 11.0;
|
||||
next.foot_rf.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.foot_lb.offset = Vec3::new(-5.0, -10.0, 2.5) / 11.0;
|
||||
next.foot_lb.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.foot_rb.offset = Vec3::new(5.0, -10.0, 2.5) / 11.0;
|
||||
next.foot_rb.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
76
voxygen/src/anim/quadruped_medium/jump.rs
Normal file
76
voxygen/src/anim/quadruped_medium/jump.rs
Normal file
@ -0,0 +1,76 @@
|
||||
use super::{
|
||||
super::{Animation, SkeletonAttr},
|
||||
QuadrupedMediumSkeleton,
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
impl Animation for JumpAnimation {
|
||||
type Skeleton = QuadrupedMediumSkeleton;
|
||||
type Dependency = (f32, f64);
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave = (anim_time as f32 * 14.0).sin();
|
||||
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
|
||||
let wave_stop = (anim_time as f32 * 5.0).min(PI / 2.0).sin();
|
||||
|
||||
next.head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) / 11.0;
|
||||
next.head_upper.ori =
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.head_upper.scale = Vec3::one() / 10.88;
|
||||
|
||||
next.jaw.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.jaw.ori = Quaternion::rotation_x(0.0);
|
||||
next.jaw.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.head_lower.ori = Quaternion::rotation_x(wave_stop * -0.1);
|
||||
next.head_lower.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, -12.0, 8.0) / 11.0;
|
||||
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.tail.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.torso_back.offset =
|
||||
Vec3::new(0.0, -9.5 + wave_stop * 1.0, 11.0 + wave_stop * 2.2) / 11.0;
|
||||
next.torso_back.ori = Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.torso_back.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_stop * 3.6) / 11.0;
|
||||
next.torso_mid.ori = Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.torso_mid.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.ears.offset = Vec3::new(0.0, 0.75, 6.25);
|
||||
next.ears.ori = Quaternion::rotation_x(0.0);
|
||||
next.ears.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.foot_lf.offset = Vec3::new(-5.0, 5.0 + wave_stop * 3.0, 5.0 + wave_stop * 7.0) / 11.0;
|
||||
next.foot_lf.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
|
||||
next.foot_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.foot_rf.offset = Vec3::new(5.0, 5.0 - wave_stop * 3.0, 5.0 + wave_stop * 5.0) / 11.0;
|
||||
next.foot_rf.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
|
||||
next.foot_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.foot_lb.offset =
|
||||
Vec3::new(-5.0, -10.0 - wave_stop * 2.0, 5.0 + wave_stop * 0.0) / 11.0;
|
||||
next.foot_lb.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
|
||||
next.foot_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.foot_rb.offset = Vec3::new(5.0, -10.0 + wave_stop * 2.0, 5.0 + wave_stop * 2.0) / 11.0;
|
||||
next.foot_rb.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
|
||||
next.foot_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user