From 54fc71207633076204748c9232192d4c6c83bf13 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Tue, 22 Oct 2019 22:56:45 -0400 Subject: [PATCH 01/10] fish_medium and bird_medium skelingtons --- .../voxygen/voxel/npc/duck_m/duck_m_body.vox | 3 + .../voxygen/voxel/npc/duck_m/duck_m_head.vox | 3 + .../voxygen/voxel/npc/duck_m/duck_m_leg_l.vox | 3 + .../voxygen/voxel/npc/duck_m/duck_m_leg_r.vox | 3 + .../voxygen/voxel/npc/duck_m/duck_m_tail.vox | 3 + .../voxygen/voxel/npc/duck_m/duck_m_wing.vox | 3 + .../voxygen/voxel/npc/marlin/marlin_fin_l.vox | 3 + .../voxygen/voxel/npc/marlin/marlin_fin_r.vox | 3 + .../voxygen/voxel/npc/marlin/marlin_head.vox | 3 + .../voxygen/voxel/npc/marlin/marlin_rear.vox | 3 + .../voxygen/voxel/npc/marlin/marlin_tail.vox | 3 + .../voxygen/voxel/npc/marlin/marlin_torso.vox | 3 + common/src/comp/body.rs | 4 + common/src/comp/body/bird_medium.rs | 68 ++++++++ common/src/comp/body/fish_medium.rs | 61 +++++++ common/src/comp/mod.rs | 2 +- common/src/npc.rs | 1 + voxygen/src/anim/birdmedium/idle.rs | 74 +++++++++ voxygen/src/anim/birdmedium/jump.rs | 62 +++++++ voxygen/src/anim/birdmedium/mod.rs | 80 ++++++++++ voxygen/src/anim/birdmedium/run.rs | 74 +++++++++ voxygen/src/anim/character/run - Copy.rs | 147 +++++++++++++++++ voxygen/src/anim/character/sneak.rs | 151 ++++++++++++++++++ voxygen/src/anim/fishmedium/idle.rs | 70 ++++++++ voxygen/src/anim/fishmedium/jump.rs | 58 +++++++ voxygen/src/anim/fishmedium/mod.rs | 77 +++++++++ voxygen/src/anim/fishmedium/run.rs | 58 +++++++ voxygen/src/anim/mod.rs | 2 + voxygen/src/scene/figure/cache.rs | 36 +++++ voxygen/src/scene/figure/load.rs | 119 +++++++++++++- voxygen/src/scene/figure/mod.rs | 138 +++++++++++++++- 31 files changed, 1315 insertions(+), 3 deletions(-) create mode 100644 assets/voxygen/voxel/npc/duck_m/duck_m_body.vox create mode 100644 assets/voxygen/voxel/npc/duck_m/duck_m_head.vox create mode 100644 assets/voxygen/voxel/npc/duck_m/duck_m_leg_l.vox create mode 100644 assets/voxygen/voxel/npc/duck_m/duck_m_leg_r.vox create mode 100644 assets/voxygen/voxel/npc/duck_m/duck_m_tail.vox create mode 100644 assets/voxygen/voxel/npc/duck_m/duck_m_wing.vox create mode 100644 assets/voxygen/voxel/npc/marlin/marlin_fin_l.vox create mode 100644 assets/voxygen/voxel/npc/marlin/marlin_fin_r.vox create mode 100644 assets/voxygen/voxel/npc/marlin/marlin_head.vox create mode 100644 assets/voxygen/voxel/npc/marlin/marlin_rear.vox create mode 100644 assets/voxygen/voxel/npc/marlin/marlin_tail.vox create mode 100644 assets/voxygen/voxel/npc/marlin/marlin_torso.vox create mode 100644 common/src/comp/body/bird_medium.rs create mode 100644 common/src/comp/body/fish_medium.rs create mode 100644 voxygen/src/anim/birdmedium/idle.rs create mode 100644 voxygen/src/anim/birdmedium/jump.rs create mode 100644 voxygen/src/anim/birdmedium/mod.rs create mode 100644 voxygen/src/anim/birdmedium/run.rs create mode 100644 voxygen/src/anim/character/run - Copy.rs create mode 100644 voxygen/src/anim/character/sneak.rs create mode 100644 voxygen/src/anim/fishmedium/idle.rs create mode 100644 voxygen/src/anim/fishmedium/jump.rs create mode 100644 voxygen/src/anim/fishmedium/mod.rs create mode 100644 voxygen/src/anim/fishmedium/run.rs diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_body.vox b/assets/voxygen/voxel/npc/duck_m/duck_m_body.vox new file mode 100644 index 0000000000..19a3ba1a3b --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/duck_m_body.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:695d8f719c5bb550643cf3e276cc984ee0953e35cba3da7a0d17bce9b3b8f2dd +size 56063 diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_head.vox b/assets/voxygen/voxel/npc/duck_m/duck_m_head.vox new file mode 100644 index 0000000000..466c83223b --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/duck_m_head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b8c1abcecd2c0cc979d2babe83d3797949a986dab1580f50097b08ebe919a190 +size 55703 diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_leg_l.vox b/assets/voxygen/voxel/npc/duck_m/duck_m_leg_l.vox new file mode 100644 index 0000000000..515df8f571 --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/duck_m_leg_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:804f7a03dae44eaf54e36c424b7ec00b2c345f8d9f5326f7769ee01aca65a6cb +size 55615 diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_leg_r.vox b/assets/voxygen/voxel/npc/duck_m/duck_m_leg_r.vox new file mode 100644 index 0000000000..0257a695e9 --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/duck_m_leg_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60ff0228f74dae0a6c0b7624b031e38032f473fe40c8bf28a3e71144e64ae4cf +size 55615 diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_tail.vox b/assets/voxygen/voxel/npc/duck_m/duck_m_tail.vox new file mode 100644 index 0000000000..62d1a47a18 --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/duck_m_tail.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29b27c5210140ece6e914c356b7c92e2cdf118c46a520ee06ec21be6490c988e +size 55643 diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_wing.vox b/assets/voxygen/voxel/npc/duck_m/duck_m_wing.vox new file mode 100644 index 0000000000..afea120592 --- /dev/null +++ b/assets/voxygen/voxel/npc/duck_m/duck_m_wing.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ed2820afb08af1175ddad78a2a429d57cb9c951abdc0f1215498fd89ba59784 +size 55631 diff --git a/assets/voxygen/voxel/npc/marlin/marlin_fin_l.vox b/assets/voxygen/voxel/npc/marlin/marlin_fin_l.vox new file mode 100644 index 0000000000..4b6f517af8 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/marlin_fin_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80b0d57ec40c04bad6207cbd2443126cf731898df1f2586b26806c426c46ff5e +size 1152 diff --git a/assets/voxygen/voxel/npc/marlin/marlin_fin_r.vox b/assets/voxygen/voxel/npc/marlin/marlin_fin_r.vox new file mode 100644 index 0000000000..d208e485aa --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/marlin_fin_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aef2d194365db70e6a30551071f361863fad2f6c6a768f8c3368982363cdcdd6 +size 1152 diff --git a/assets/voxygen/voxel/npc/marlin/marlin_head.vox b/assets/voxygen/voxel/npc/marlin/marlin_head.vox new file mode 100644 index 0000000000..45a31f5b69 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/marlin_head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcbe6707a2278ebd4828998b58d9fa69c2eba15b3b31f11de2e9104a9b59c1eb +size 1352 diff --git a/assets/voxygen/voxel/npc/marlin/marlin_rear.vox b/assets/voxygen/voxel/npc/marlin/marlin_rear.vox new file mode 100644 index 0000000000..ab15e4fc13 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/marlin_rear.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dea03905c68b83f25f5196393ca8d06196b5a35eed0b12be61aa6bcfc8d5e081 +size 1360 diff --git a/assets/voxygen/voxel/npc/marlin/marlin_tail.vox b/assets/voxygen/voxel/npc/marlin/marlin_tail.vox new file mode 100644 index 0000000000..30a1696564 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/marlin_tail.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e55b9da2a45123b3109b763d741b550a11f274fc2563c4e54df17da389426c8 +size 1308 diff --git a/assets/voxygen/voxel/npc/marlin/marlin_torso.vox b/assets/voxygen/voxel/npc/marlin/marlin_torso.vox new file mode 100644 index 0000000000..1c0219ac08 --- /dev/null +++ b/assets/voxygen/voxel/npc/marlin/marlin_torso.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0398753b0ff2719940aa1e2f20430892ebee6b7da26b61d8b16dad5d826655a +size 1476 diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 2ac56c58b1..a7ca75bba1 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -2,6 +2,8 @@ pub mod humanoid; pub mod object; pub mod quadruped; pub mod quadruped_medium; +pub mod bird_medium; +pub mod fish_medium; use specs::{Component, FlaggedStorage}; use specs_idvs::IDVStorage; @@ -11,6 +13,8 @@ pub enum Body { Humanoid(humanoid::Body), Quadruped(quadruped::Body), QuadrupedMedium(quadruped_medium::Body), + BirdMedium(bird_medium::Body), + FishMedium(fish_medium::Body), Object(object::Body), } diff --git a/common/src/comp/body/bird_medium.rs b/common/src/comp/body/bird_medium.rs new file mode 100644 index 0000000000..38a0cc438f --- /dev/null +++ b/common/src/comp/body/bird_medium.rs @@ -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]; \ No newline at end of file diff --git a/common/src/comp/body/fish_medium.rs b/common/src/comp/body/fish_medium.rs new file mode 100644 index 0000000000..7da9bce91f --- /dev/null +++ b/common/src/comp/body/fish_medium.rs @@ -0,0 +1,61 @@ +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]; diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index d79fb41ae7..2a0c67e3cd 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -16,7 +16,7 @@ mod visual; // Reexports pub use admin::Admin; pub use agent::Agent; -pub use body::{humanoid, object, quadruped, quadruped_medium, Body}; +pub use body::{humanoid, object, quadruped, quadruped_medium, bird_medium, fish_medium, Body}; pub use character_state::{ActionState, CharacterState, MovementState}; pub use controller::{ ControlEvent, Controller, ControllerInputs, InventoryManip, MountState, Mounting, diff --git a/common/src/npc.rs b/common/src/npc.rs index 3f95c17cca..0c0ebe25d5 100644 --- a/common/src/npc.rs +++ b/common/src/npc.rs @@ -30,6 +30,7 @@ impl FromStr for NpcKind { "humanoid" => Ok(NpcKind::Humanoid), "wolf" => Ok(NpcKind::Wolf), "pig" => Ok(NpcKind::Pig), + _ => Err(()), } } diff --git a/voxygen/src/anim/birdmedium/idle.rs b/voxygen/src/anim/birdmedium/idle.rs new file mode 100644 index 0000000000..b3770c6142 --- /dev/null +++ b/voxygen/src/anim/birdmedium/idle.rs @@ -0,0 +1,74 @@ +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(); + + 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 duck_m_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.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.duck_m_head.ori = + Quaternion::rotation_z(duck_m_look.x) * Quaternion::rotation_x(duck_m_look.y); + next.duck_m_head.scale = Vec3::one() / 10.88; + + next.duck_m_torso.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.duck_m_torso.ori = Quaternion::rotation_x(0.0); + next.duck_m_torso.scale = Vec3::one() * 1.01; + + next.duck_m_tail.offset = Vec3::new(0.0, 3.1, -4.5); + next.duck_m_tail.ori = Quaternion::rotation_z(0.0); + next.duck_m_tail.scale = Vec3::one() * 0.98; + + next.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0); + next.duck_m_wing_l.scale = Vec3::one() / 11.0; + + next.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.duck_m_wing_r.ori = Quaternion::rotation_y(0.0); + next.duck_m_wing_r.scale = Vec3::one() / 11.0; + + next.duck_m_leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.duck_m_leg_l.ori = Quaternion::rotation_y(0.0); + next.duck_m_leg_l.scale = Vec3::one() / 10.5; + + next.duck_m_leg_r.offset = Vec3::new(0.0, 0.75, 5.25); + next.duck_m_leg_r.ori = Quaternion::rotation_x(0.0); + next.duck_m_leg_r.scale = Vec3::one() * 1.00; + next + } +} diff --git a/voxygen/src/anim/birdmedium/jump.rs b/voxygen/src/anim/birdmedium/jump.rs new file mode 100644 index 0000000000..191412c2d5 --- /dev/null +++ b/voxygen/src/anim/birdmedium/jump.rs @@ -0,0 +1,62 @@ +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(); + + 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(); + + + + next.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.duck_m_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.duck_m_head.scale = Vec3::one() / 10.88; + + next.duck_m_torso.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.duck_m_torso.ori = Quaternion::rotation_x(0.0); + next.duck_m_torso.scale = Vec3::one() * 1.01; + + next.duck_m_tail.offset = Vec3::new(0.0, 3.1, -4.5); + next.duck_m_tail.ori = Quaternion::rotation_z(0.0); + next.duck_m_tail.scale = Vec3::one() * 0.98; + + next.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0); + next.duck_m_wing_l.scale = Vec3::one() / 11.0; + + next.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.duck_m_wing_r.ori = Quaternion::rotation_y(0.0); + next.duck_m_wing_r.scale = Vec3::one() / 11.0; + + next.duck_m_leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.duck_m_leg_l.ori = Quaternion::rotation_y(0.0); + next.duck_m_leg_l.scale = Vec3::one() / 10.5; + + next.duck_m_leg_r.offset = Vec3::new(0.0, 0.75, 5.25); + next.duck_m_leg_r.ori = Quaternion::rotation_x(0.0); + next.duck_m_leg_r.scale = Vec3::one() * 1.00; + next + } +} \ No newline at end of file diff --git a/voxygen/src/anim/birdmedium/mod.rs b/voxygen/src/anim/birdmedium/mod.rs new file mode 100644 index 0000000000..53292603ba --- /dev/null +++ b/voxygen/src/anim/birdmedium/mod.rs @@ -0,0 +1,80 @@ +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 { + duck_m_head: Bone, + duck_m_torso: Bone, + duck_m_tail: Bone, + duck_m_wing_l: Bone, + duck_m_wing_r: Bone, + duck_m_leg_l: Bone, + duck_m_leg_r: Bone, + +} + +impl BirdMediumSkeleton { + pub fn new() -> Self { + Self { + duck_m_head: Bone::default(), + duck_m_torso: Bone::default(), + duck_m_tail: Bone::default(), + duck_m_wing_l: Bone::default(), + duck_m_wing_r: Bone::default(), + duck_m_leg_l: Bone::default(), + duck_m_leg_r: Bone::default(), + + + } + } +} + +impl Skeleton for BirdMediumSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let torso_mat = self.duck_m_torso.compute_base_matrix(); + + + [ + FigureBoneData::new(self.duck_m_head.compute_base_matrix() * torso_mat), + FigureBoneData::new( + torso_mat, + ), + FigureBoneData::new(self.duck_m_tail.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.duck_m_wing_l.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.duck_m_wing_r.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.duck_m_leg_l.compute_base_matrix()), + FigureBoneData::new(self.duck_m_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.duck_m_head + .interpolate(&target.duck_m_head, dt); + self.duck_m_torso.interpolate(&target.duck_m_torso, dt); + self.duck_m_tail + .interpolate(&target.duck_m_tail, dt); + self.duck_m_wing_l.interpolate(&target.duck_m_wing_l, dt); + self.duck_m_wing_r + .interpolate(&target.duck_m_wing_r, dt); + self.duck_m_leg_l.interpolate(&target.duck_m_leg_l, dt); + self.duck_m_leg_r.interpolate(&target.duck_m_leg_r, dt); + } +} diff --git a/voxygen/src/anim/birdmedium/run.rs b/voxygen/src/anim/birdmedium/run.rs new file mode 100644 index 0000000000..ac940f6ae7 --- /dev/null +++ b/voxygen/src/anim/birdmedium/run.rs @@ -0,0 +1,74 @@ +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(); + + 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 duck_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.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.duck_m_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.duck_m_head.scale = Vec3::one() / 10.88; + + next.duck_m_torso.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.duck_m_torso.ori = Quaternion::rotation_x(0.0); + next.duck_m_torso.scale = Vec3::one() * 1.01; + + next.duck_m_tail.offset = Vec3::new(0.0, 3.1, -4.5); + next.duck_m_tail.ori = Quaternion::rotation_z(0.0); + next.duck_m_tail.scale = Vec3::one() * 0.98; + + next.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0); + next.duck_m_wing_l.scale = Vec3::one() / 11.0; + + next.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.duck_m_wing_r.ori = Quaternion::rotation_y(0.0); + next.duck_m_wing_r.scale = Vec3::one() / 11.0; + + next.duck_m_leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.duck_m_leg_l.ori = Quaternion::rotation_y(0.0); + next.duck_m_leg_l.scale = Vec3::one() / 10.5; + + next.duck_m_leg_r.offset = Vec3::new(0.0, 0.75, 5.25); + next.duck_m_leg_r.ori = Quaternion::rotation_x(0.0); + next.duck_m_leg_r.scale = Vec3::one() * 1.00; + next + } +} \ No newline at end of file diff --git a/voxygen/src/anim/character/run - Copy.rs b/voxygen/src/anim/character/run - Copy.rs new file mode 100644 index 0000000000..6e0a6aff0b --- /dev/null +++ b/voxygen/src/anim/character/run - Copy.rs @@ -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, Vec3, Vec3, 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::::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::::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 + } +} diff --git a/voxygen/src/anim/character/sneak.rs b/voxygen/src/anim/character/sneak.rs new file mode 100644 index 0000000000..389c370bb4 --- /dev/null +++ b/voxygen/src/anim/character/sneak.rs @@ -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, Vec3, Vec3, 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::::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::::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 + } +} diff --git a/voxygen/src/anim/fishmedium/idle.rs b/voxygen/src/anim/fishmedium/idle.rs new file mode 100644 index 0000000000..2b04526f34 --- /dev/null +++ b/voxygen/src/anim/fishmedium/idle.rs @@ -0,0 +1,70 @@ +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(); + + 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 duck_m_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.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.marlin_head.ori = + Quaternion::rotation_z(duck_m_look.x) * Quaternion::rotation_x(duck_m_look.y); + next.marlin_head.scale = Vec3::one() / 10.88; + + next.marlin_torso.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.marlin_torso.ori = Quaternion::rotation_x(0.0); + next.marlin_torso.scale = Vec3::one() * 1.01; + + next.marlin_rear.offset = Vec3::new(0.0, 3.1, -4.5); + next.marlin_rear.ori = Quaternion::rotation_z(0.0); + next.marlin_rear.scale = Vec3::one() * 0.98; + + next.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.marlin_tail.ori = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0); + next.marlin_tail.scale = Vec3::one() / 11.0; + + next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.marlin_fin_l.ori = Quaternion::rotation_y(0.0); + next.marlin_fin_l.scale = Vec3::one() / 11.0; + + next.marlin_fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.marlin_fin_r.ori = Quaternion::rotation_y(0.0); + next.marlin_fin_r.scale = Vec3::one() / 10.5; + next + } +} diff --git a/voxygen/src/anim/fishmedium/jump.rs b/voxygen/src/anim/fishmedium/jump.rs new file mode 100644 index 0000000000..cb817e502b --- /dev/null +++ b/voxygen/src/anim/fishmedium/jump.rs @@ -0,0 +1,58 @@ +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(); + + 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(); + + + + next.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.marlin_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.marlin_head.scale = Vec3::one() / 10.88; + + next.marlin_torso.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.marlin_torso.ori = Quaternion::rotation_x(0.0); + next.marlin_torso.scale = Vec3::one() * 1.01; + + next.marlin_rear.offset = Vec3::new(0.0, 3.1, -4.5); + next.marlin_rear.ori = Quaternion::rotation_z(0.0); + next.marlin_rear.scale = Vec3::one() * 0.98; + + next.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.marlin_tail.ori = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0); + next.marlin_tail.scale = Vec3::one() / 11.0; + + next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.marlin_fin_l.ori = Quaternion::rotation_y(0.0); + next.marlin_fin_l.scale = Vec3::one() / 11.0; + + next.marlin_fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.marlin_fin_r.ori = Quaternion::rotation_y(0.0); + next.marlin_fin_r.scale = Vec3::one() / 10.5; + next + } +} diff --git a/voxygen/src/anim/fishmedium/mod.rs b/voxygen/src/anim/fishmedium/mod.rs new file mode 100644 index 0000000000..6689dbea3a --- /dev/null +++ b/voxygen/src/anim/fishmedium/mod.rs @@ -0,0 +1,77 @@ +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 { + marlin_head: Bone, + marlin_torso: Bone, + marlin_rear: Bone, + marlin_tail: Bone, + marlin_fin_l: Bone, + marlin_fin_r: Bone, + +} + +impl FishMediumSkeleton { + pub fn new() -> Self { + Self { + marlin_head: Bone::default(), + marlin_torso: Bone::default(), + marlin_rear: Bone::default(), + marlin_tail: Bone::default(), + marlin_fin_l: Bone::default(), + marlin_fin_r: Bone::default(), + + } + } +} + +impl Skeleton for FishMediumSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let torso_mat = self.marlin_torso.compute_base_matrix(); + let rear_mat = self.marlin_rear.compute_base_matrix(); + + + [ + FigureBoneData::new(self.marlin_head.compute_base_matrix() * torso_mat), + FigureBoneData::new( + torso_mat, + ), + FigureBoneData::new(rear_mat * torso_mat), + FigureBoneData::new(self.marlin_tail.compute_base_matrix() * rear_mat), + FigureBoneData::new(self.marlin_fin_l.compute_base_matrix() * rear_mat), + FigureBoneData::new(self.marlin_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.marlin_head + .interpolate(&target.marlin_head, dt); + self.marlin_torso.interpolate(&target.marlin_torso, dt); + self.marlin_rear + .interpolate(&target.marlin_rear, dt); + self.marlin_tail.interpolate(&target.marlin_tail, dt); + self.marlin_fin_l + .interpolate(&target.marlin_fin_l, dt); + self.marlin_fin_r.interpolate(&target.marlin_fin_r, dt); + } +} diff --git a/voxygen/src/anim/fishmedium/run.rs b/voxygen/src/anim/fishmedium/run.rs new file mode 100644 index 0000000000..0f1e92743f --- /dev/null +++ b/voxygen/src/anim/fishmedium/run.rs @@ -0,0 +1,58 @@ +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(); + + 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(); + + + + next.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.marlin_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.marlin_head.scale = Vec3::one() / 10.88; + + next.marlin_torso.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.marlin_torso.ori = Quaternion::rotation_x(0.0); + next.marlin_torso.scale = Vec3::one() * 1.01; + + next.marlin_rear.offset = Vec3::new(0.0, 3.1, -4.5); + next.marlin_rear.ori = Quaternion::rotation_z(0.0); + next.marlin_rear.scale = Vec3::one() * 0.98; + + next.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; + next.marlin_tail.ori = Quaternion::rotation_z(0.0) + * Quaternion::rotation_x(0.0); + next.marlin_tail.scale = Vec3::one() / 11.0; + + next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; + next.marlin_fin_l.ori = Quaternion::rotation_y(0.0); + next.marlin_fin_l.scale = Vec3::one() / 11.0; + + next.marlin_fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; + next.marlin_fin_r.ori = Quaternion::rotation_y(0.0); + next.marlin_fin_r.scale = Vec3::one() / 10.5; + next + } +} diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index a527d759ce..b9600a531a 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -3,6 +3,8 @@ pub mod fixture; pub mod object; pub mod quadruped; pub mod quadrupedmedium; +pub mod birdmedium; +pub mod fishmedium; use crate::render::FigureBoneData; use common::comp::{self, item::Tool}; diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index 5063b50a14..9c89226f2a 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -226,6 +226,42 @@ impl FigureModelCache { None, None, ], + Body::BirdMedium(body) => [ + Some(mesh_duck_m_head(body.head)), + Some(mesh_duck_m_torso(body.torso)), + Some(mesh_duck_m_tail(body.tail)), + Some(mesh_duck_m_wing_l(body.wing_l)), + Some(mesh_duck_m_wing_r(body.wing_r)), + Some(mesh_duck_m_leg_l(body.leg_l)), + Some(mesh_duck_m_leg_r(body.leg_r)), + None, + None, + None, + None, + None, + None, + None, + None, + None, + ], + Body::FishMedium(body) => [ + Some(mesh_marlin_head(body.head)), + Some(mesh_marlin_torso(body.torso)), + Some(mesh_marlin_rear(body.rear)), + Some(mesh_marlin_tail(body.tail)), + Some(mesh_marlin_fin_l(body.fin_l)), + Some(mesh_marlin_fin_r(body.fin_r)), + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ], Body::Object(object) => [ Some(mesh_object(object)), None, diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index b5783de10c..20ed90280c 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -10,7 +10,7 @@ use common::{ Belt, BodyType, Chest, EyeColor, Eyebrows, Foot, Hand, Pants, Race, Shoulder, Skin, }, item::Tool, - object, quadruped, quadruped_medium, Item, ItemKind, + object, quadruped, quadruped_medium, bird_medium, fish_medium, Item, Itemkind }, figure::{DynaUnionizer, MatSegment, Material, Segment}, }; @@ -697,7 +697,124 @@ pub fn mesh_wolf_foot_rb(foot_rb: quadruped_medium::FootRB) -> Mesh Mesh { + load_mesh( + match head { + bird_medium::Head::Default => "npc.duck_m.duck_m_head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} +pub fn mesh_duck_m_torso(torso: bird_medium::Torso) -> Mesh { + load_mesh( + match torso { + bird_medium::Torso::Default => "npc.duck_m.duck_m_body", + }, + Vec3::new(-8.0, -5.5, -6.0), + ) +} + +pub fn mesh_duck_m_tail(tail: bird_medium::Tail) -> Mesh { + load_mesh( + match tail { + bird_medium::Tail::Default => "npc.duck_m.duck_m_tail", + }, + Vec3::new(-4.0, -1.0, -1.0), + ) +} + +pub fn mesh_duck_m_wing_l(wing_l: bird_medium::WingL) -> Mesh { + load_mesh( + match wing_l { + bird_medium::WingL::Default => "npc.duck_m.duck_m_wing", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} + +pub fn mesh_duck_m_wing_r(wing_r: bird_medium::WingR) -> Mesh { + load_mesh( + match wing_r { + bird_medium::WingR::Default => "npc.duck_m.duck_m_wing", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} + +pub fn mesh_duck_m_leg_l(leg_l: bird_medium::LegL) -> Mesh { + load_mesh( + match leg_l { + bird_medium::LegL::Default => "npc.duck_m.duck_m_leg_l", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} + +pub fn mesh_duck_m_leg_r(leg_r: bird_medium::LegR) -> Mesh { + load_mesh( + match leg_r { + bird_medium::LegR::Default => "npc.duck_m.duck_m_leg_r", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} +//// +pub fn mesh_marlin_head(head: fish_medium::Head) -> Mesh { + load_mesh( + match head { + fish_medium::Head::Default => "npc.marlin.marlin_head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_torso(torso: fish_medium::Torso) -> Mesh { + load_mesh( + match torso { + fish_medium::Torso::Default => "npc.marlin.marlin_torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_rear(rear: fish_medium::Rear) -> Mesh { + load_mesh( + match rear { + fish_medium::Rear::Default => "npc.marlin.marlin_rear", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_tail(tail: fish_medium::Tail) -> Mesh { + load_mesh( + match tail { + fish_medium::Tail::Default => "npc.marlin.marlin_tail", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_fin_l(fin_l: fish_medium::FinL) -> Mesh { + load_mesh( + match fin_l { + fish_medium::FinL::Default => "npc.marlin.marlin_fin_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_fin_r(fin_r: fish_medium::FinR) -> Mesh { + load_mesh( + match fin_r { + fish_medium::FinR::Default => "npc.marlin.marlin_fin_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} +//// pub fn mesh_object(obj: object::Body) -> Mesh { use object::Body; diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index ef0b35f046..3c87e24ffd 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -7,7 +7,7 @@ pub use load::load_mesh; // TODO: Don't make this public. use crate::{ anim::{ self, character::CharacterSkeleton, object::ObjectSkeleton, quadruped::QuadrupedSkeleton, - quadrupedmedium::QuadrupedMediumSkeleton, Animation, Skeleton, + quadrupedmedium::QuadrupedMediumSkeleton, birdmedium::BirdMediumSkeleton, fishmedium::FishMediumSkeleton,Animation, Skeleton, }, render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow}, scene::camera::{Camera, CameraMode}, @@ -32,6 +32,8 @@ pub struct FigureMgr { character_states: HashMap>, quadruped_states: HashMap>, quadruped_medium_states: HashMap>, + bird_medium_states: HashMap>, + fish_medium_states: HashMap>, object_states: HashMap>, } @@ -42,6 +44,8 @@ impl FigureMgr { character_states: HashMap::new(), quadruped_states: HashMap::new(), quadruped_medium_states: HashMap::new(), + bird_medium_states: HashMap::new(), + fish_medium_states: HashMap::new(), object_states: HashMap::new(), } } @@ -93,6 +97,12 @@ impl FigureMgr { Body::QuadrupedMedium(_) => { self.quadruped_medium_states.remove(&entity); } + Body::BirdMedium(_) => { + self.bird_medium_states.remove(&entity); + } + Body::FishMedium(_) => { + self.fish_medium_states.remove(&entity); + } Body::Object(_) => { self.object_states.remove(&entity); } @@ -378,6 +388,120 @@ impl FigureMgr { action_animation_rate, ); } + Body::BirdMedium(_) => { + let state = self + .bird_medium_states + .entry(entity) + .or_insert_with(|| { + FigureState::new(renderer, BirdMediumSkeleton::new()) + }); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::birdmedium::IdleAnimation::update_skeleton( + &BirdMediumSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::birdmedium::RunAnimation::update_skeleton( + &BirdMediumSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::birdmedium::JumpAnimation::update_skeleton( + &BirdMediumSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } + Body::FishMedium(_) => { + let state = self + .fish_medium_states + .entry(entity) + .or_insert_with(|| { + FigureState::new(renderer, FishMediumSkeleton::new()) + }); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::fishmedium::IdleAnimation::update_skeleton( + &FishMediumSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::fishmedium::RunAnimation::update_skeleton( + &FishMediumSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::fishmedium::JumpAnimation::update_skeleton( + &FishMediumSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } Body::Object(_) => { let state = self .object_states @@ -407,6 +531,10 @@ impl FigureMgr { .retain(|entity, _| ecs.entities().is_alive(*entity)); self.quadruped_medium_states .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.bird_medium_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.fish_medium_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); self.object_states .retain(|entity, _| ecs.entities().is_alive(*entity)); } @@ -464,6 +592,14 @@ impl FigureMgr { .quadruped_medium_states .get(&entity) .map(|state| (state.locals(), state.bone_consts())), + Body::BirdMedium(_) => self + .bird_medium_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), + Body::FishMedium(_) => self + .fish_medium_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), Body::Object(_) => self .object_states .get(&entity) From 644939810fab05d298e3bc353ec3afb2c3cad201 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 23 Oct 2019 00:59:05 -0400 Subject: [PATCH 02/10] added dragon skeleton --- .../voxel/npc/dragon/dragon_chest_front.vox | 3 + .../voxel/npc/dragon/dragon_chest_rear.vox | 3 + .../voxel/npc/dragon/dragon_foot_bl.vox | 3 + .../voxel/npc/dragon/dragon_foot_br.vox | 3 + .../voxel/npc/dragon/dragon_foot_fl.vox | 3 + .../voxel/npc/dragon/dragon_foot_fr.vox | 3 + .../voxygen/voxel/npc/dragon/dragon_head.vox | 3 + .../voxel/npc/dragon/dragon_tail_front.vox | 3 + .../voxel/npc/dragon/dragon_tail_rear.vox | 3 + .../voxel/npc/dragon/dragon_wing_in_l.vox | 3 + .../voxel/npc/dragon/dragon_wing_in_r.vox | 3 + .../voxel/npc/dragon/dragon_wing_out_l.vox | 3 + .../voxel/npc/dragon/dragon_wing_out_r.vox | 3 + common/src/comp/body.rs | 2 + common/src/comp/body/dragon.rs | 121 ++++++++++++++++++ common/src/comp/mod.rs | 2 +- voxygen/src/anim/dragon/idle.rs | 108 ++++++++++++++++ voxygen/src/anim/dragon/jump.rs | 96 ++++++++++++++ voxygen/src/anim/dragon/mod.rs | 100 +++++++++++++++ voxygen/src/anim/dragon/run.rs | 108 ++++++++++++++++ voxygen/src/anim/mod.rs | 1 + voxygen/src/scene/figure/cache.rs | 18 +++ voxygen/src/scene/figure/load.rs | 121 +++++++++++++++++- voxygen/src/scene/figure/mod.rs | 70 +++++++++- 24 files changed, 783 insertions(+), 3 deletions(-) create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_chest_front.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_chest_rear.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_foot_bl.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_foot_br.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_foot_fl.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_foot_fr.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_head.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_tail_front.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_tail_rear.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_wing_in_l.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_wing_in_r.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_wing_out_l.vox create mode 100644 assets/voxygen/voxel/npc/dragon/dragon_wing_out_r.vox create mode 100644 common/src/comp/body/dragon.rs create mode 100644 voxygen/src/anim/dragon/idle.rs create mode 100644 voxygen/src/anim/dragon/jump.rs create mode 100644 voxygen/src/anim/dragon/mod.rs create mode 100644 voxygen/src/anim/dragon/run.rs diff --git a/assets/voxygen/voxel/npc/dragon/dragon_chest_front.vox b/assets/voxygen/voxel/npc/dragon/dragon_chest_front.vox new file mode 100644 index 0000000000..5385ca652f --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_chest_front.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ccb3946a7b70bbe3bbca76b0930651b1fafb6f10cf466d730dc838a8dd900102 +size 4556 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_chest_rear.vox b/assets/voxygen/voxel/npc/dragon/dragon_chest_rear.vox new file mode 100644 index 0000000000..03c2c36ca0 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_chest_rear.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5d9f4fa579f6456f4a642f94d6388074422858d7c4053e339e253bb0b86f888 +size 6080 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_foot_bl.vox b/assets/voxygen/voxel/npc/dragon/dragon_foot_bl.vox new file mode 100644 index 0000000000..d9ad85b152 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_foot_bl.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3392c489527b685662705bdba578d8f2f12788c00a881885edd45505f741124 +size 1408 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_foot_br.vox b/assets/voxygen/voxel/npc/dragon/dragon_foot_br.vox new file mode 100644 index 0000000000..5f3d81ec51 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_foot_br.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff5cc1eac6b2939d3658e21228f87366327665ae70dd83d5af92ac3b3dae0fb4 +size 1408 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_foot_fl.vox b/assets/voxygen/voxel/npc/dragon/dragon_foot_fl.vox new file mode 100644 index 0000000000..f1e67b65c8 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_foot_fl.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed4cb29ddba38424eb238ce2c3df7ea9b67d2e3b4f902194588f67a41f759b89 +size 1408 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_foot_fr.vox b/assets/voxygen/voxel/npc/dragon/dragon_foot_fr.vox new file mode 100644 index 0000000000..03497e9382 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_foot_fr.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a5b309ae1146a4a5dab72e7bd534201b9ccbddcdc512d0a5619e4ef6880eefa +size 1408 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_head.vox b/assets/voxygen/voxel/npc/dragon/dragon_head.vox new file mode 100644 index 0000000000..d27c554eac --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3c6dcc28719e148e572786722426103d4e4e7af05b815e8328ee71515db813a +size 3040 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_tail_front.vox b/assets/voxygen/voxel/npc/dragon/dragon_tail_front.vox new file mode 100644 index 0000000000..27a01ab209 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_tail_front.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da84212d78276b933a4b374c7b038d0ca5026c5be0d14a0dc93cb3fe15771d0c +size 1784 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_tail_rear.vox b/assets/voxygen/voxel/npc/dragon/dragon_tail_rear.vox new file mode 100644 index 0000000000..41d539f783 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_tail_rear.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26867c50e937a64890489706c33fe8b06d43138ff134c7fdaf165128ef24c470 +size 1392 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_wing_in_l.vox b/assets/voxygen/voxel/npc/dragon/dragon_wing_in_l.vox new file mode 100644 index 0000000000..217aa90fa2 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_wing_in_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71a8f3a854354946d80fd9c90839ac67549508c490ae342c8d5a9dc4b1f5ff6b +size 2884 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_wing_in_r.vox b/assets/voxygen/voxel/npc/dragon/dragon_wing_in_r.vox new file mode 100644 index 0000000000..9ca1b76e22 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_wing_in_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ddbdc71bb337dc45b4d32e2f3d9a11845e198ac17215e09ace38638a2c567b44 +size 2884 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_wing_out_l.vox b/assets/voxygen/voxel/npc/dragon/dragon_wing_out_l.vox new file mode 100644 index 0000000000..2f54e5758a --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_wing_out_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6bcab7b445899e1f24d7f61b468782612a79b36636786975b00a33e1ad266ab6 +size 3544 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_wing_out_r.vox b/assets/voxygen/voxel/npc/dragon/dragon_wing_out_r.vox new file mode 100644 index 0000000000..960761f385 --- /dev/null +++ b/assets/voxygen/voxel/npc/dragon/dragon_wing_out_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c076249b9a357865e20f146b54fbfa4f2a7e82c3542fec09c99467d691ea5de +size 3544 diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index a7ca75bba1..1f6c2101e3 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -4,6 +4,7 @@ pub mod quadruped; pub mod quadruped_medium; pub mod bird_medium; pub mod fish_medium; +pub mod dragon; use specs::{Component, FlaggedStorage}; use specs_idvs::IDVStorage; @@ -15,6 +16,7 @@ pub enum Body { QuadrupedMedium(quadruped_medium::Body), BirdMedium(bird_medium::Body), FishMedium(fish_medium::Body), + Dragon(dragon::Body), Object(object::Body), } diff --git a/common/src/comp/body/dragon.rs b/common/src/comp/body/dragon.rs new file mode 100644 index 0000000000..d0b748d6fd --- /dev/null +++ b/common/src/comp/body/dragon.rs @@ -0,0 +1,121 @@ +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]; \ No newline at end of file diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index 2a0c67e3cd..eae3a2aa9b 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -16,7 +16,7 @@ mod visual; // Reexports pub use admin::Admin; pub use agent::Agent; -pub use body::{humanoid, object, quadruped, quadruped_medium, bird_medium, fish_medium, Body}; +pub use body::{humanoid, object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, Body}; pub use character_state::{ActionState, CharacterState, MovementState}; pub use controller::{ ControlEvent, Controller, ControllerInputs, InventoryManip, MountState, Mounting, diff --git a/voxygen/src/anim/dragon/idle.rs b/voxygen/src/anim/dragon/idle.rs new file mode 100644 index 0000000000..1d4df279a3 --- /dev/null +++ b/voxygen/src/anim/dragon/idle.rs @@ -0,0 +1,108 @@ +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(); + + 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 duck_m_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.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.dragon_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.dragon_head.scale = Vec3::one() / 10.88; + + next.dragon_chest_front.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_front.ori = Quaternion::rotation_x(0.0); + next.dragon_chest_front.scale = Vec3::one() * 1.01; + + next.dragon_chest_rear.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0); + next.dragon_chest_rear.scale = Vec3::one() * 1.01; + + next.dragon_tail_front.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_front.ori = Quaternion::rotation_x(0.0); + next.dragon_tail_front.scale = Vec3::one() * 1.01; + + next.dragon_tail_rear.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0); + next.dragon_tail_rear.scale = Vec3::one() * 1.01; + + next.dragon_wing_in_l.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_in_l.scale = Vec3::one() * 1.01; + + next.dragon_wing_in_r.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_in_r.scale = Vec3::one() * 1.01; + + next.dragon_wing_out_l.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_out_l.scale = Vec3::one() * 1.01; + + next.dragon_wing_out_r.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_out_r.scale = Vec3::one() * 1.01; + + next.dragon_foot_fl.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_fl.scale = Vec3::one() * 1.01; + + next.dragon_foot_fr.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_fr.scale = Vec3::one() * 1.01; + + next.dragon_foot_bl.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_bl.scale = Vec3::one() * 1.01; + + next.dragon_foot_br.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_br.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_br.scale = Vec3::one() * 1.01; + next + } +} diff --git a/voxygen/src/anim/dragon/jump.rs b/voxygen/src/anim/dragon/jump.rs new file mode 100644 index 0000000000..6b94bd54cd --- /dev/null +++ b/voxygen/src/anim/dragon/jump.rs @@ -0,0 +1,96 @@ +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(); + + 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(); + + + + next.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.dragon_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.dragon_head.scale = Vec3::one() / 10.88; + + next.dragon_chest_front.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_front.ori = Quaternion::rotation_x(0.0); + next.dragon_chest_front.scale = Vec3::one() * 1.01; + + next.dragon_chest_rear.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0); + next.dragon_chest_rear.scale = Vec3::one() * 1.01; + + next.dragon_tail_front.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_front.ori = Quaternion::rotation_x(0.0); + next.dragon_tail_front.scale = Vec3::one() * 1.01; + + next.dragon_tail_rear.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0); + next.dragon_tail_rear.scale = Vec3::one() * 1.01; + + next.dragon_wing_in_l.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_in_l.scale = Vec3::one() * 1.01; + + next.dragon_wing_in_r.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_in_r.scale = Vec3::one() * 1.01; + + next.dragon_wing_out_l.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_out_l.scale = Vec3::one() * 1.01; + + next.dragon_wing_out_r.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_out_r.scale = Vec3::one() * 1.01; + + next.dragon_foot_fl.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_fl.scale = Vec3::one() * 1.01; + + next.dragon_foot_fr.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_fr.scale = Vec3::one() * 1.01; + + next.dragon_foot_bl.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_bl.scale = Vec3::one() * 1.01; + + next.dragon_foot_br.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_br.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_br.scale = Vec3::one() * 1.01; + next + } +} diff --git a/voxygen/src/anim/dragon/mod.rs b/voxygen/src/anim/dragon/mod.rs new file mode 100644 index 0000000000..139cfd6bec --- /dev/null +++ b/voxygen/src/anim/dragon/mod.rs @@ -0,0 +1,100 @@ +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 { + dragon_head: Bone, + dragon_chest_front: Bone, + dragon_chest_rear: Bone, + dragon_tail_front: Bone, + dragon_tail_rear: Bone, + dragon_wing_in_l: Bone, + dragon_wing_in_r: Bone, + dragon_wing_out_l: Bone, + dragon_wing_out_r: Bone, + dragon_foot_fl: Bone, + dragon_foot_fr: Bone, + dragon_foot_bl: Bone, + dragon_foot_br: Bone, + +} + +impl DragonSkeleton { + pub fn new() -> Self { + Self { + dragon_head: Bone::default(), + dragon_chest_front: Bone::default(), + dragon_chest_rear: Bone::default(), + dragon_tail_front: Bone::default(), + dragon_tail_rear: Bone::default(), + dragon_wing_in_l: Bone::default(), + dragon_wing_in_r: Bone::default(), + dragon_wing_out_l: Bone::default(), + dragon_wing_out_r: Bone::default(), + dragon_foot_fl: Bone::default(), + dragon_foot_fr: Bone::default(), + dragon_foot_bl: Bone::default(), + dragon_foot_br: Bone::default(), + + + } + } +} + +impl Skeleton for DragonSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let chest_front_mat = self.dragon_chest_front.compute_base_matrix(); + let wing_in_l_mat = self.dragon_wing_in_l.compute_base_matrix(); + let wing_in_r_mat = self.dragon_wing_in_r.compute_base_matrix(); + let tail_front_mat = self.dragon_tail_front.compute_base_matrix(); + + + [ + FigureBoneData::new(self.dragon_head.compute_base_matrix() * chest_front_mat), + FigureBoneData::new( + chest_front_mat, + ), + FigureBoneData::new(self.dragon_chest_rear.compute_base_matrix() * chest_front_mat), + FigureBoneData::new(tail_front_mat), + FigureBoneData::new(self.dragon_tail_rear.compute_base_matrix() * tail_front_mat), + FigureBoneData::new(wing_in_l_mat), + FigureBoneData::new(wing_in_r_mat), + FigureBoneData::new(self.dragon_wing_out_l.compute_base_matrix() * wing_in_l_mat), + FigureBoneData::new(self.dragon_wing_out_r.compute_base_matrix() * wing_in_r_mat), + FigureBoneData::new(self.dragon_foot_fl.compute_base_matrix()), + FigureBoneData::new(self.dragon_foot_fr.compute_base_matrix()), + FigureBoneData::new(self.dragon_foot_bl.compute_base_matrix()), + FigureBoneData::new(self.dragon_foot_br.compute_base_matrix()), + FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), + ] + } + + fn interpolate(&mut self, target: &Self, dt: f32) { + self.dragon_head.interpolate(&target.dragon_head, dt); + self.dragon_chest_front.interpolate(&target.dragon_chest_front, dt); + self.dragon_chest_rear.interpolate(&target.dragon_chest_rear, dt); + self.dragon_tail_front.interpolate(&target.dragon_tail_front, dt); + self.dragon_tail_rear.interpolate(&target.dragon_tail_rear, dt); + self.dragon_wing_in_l.interpolate(&target.dragon_wing_in_l, dt); + self.dragon_wing_in_r.interpolate(&target.dragon_wing_in_r, dt); + self.dragon_wing_out_l.interpolate(&target.dragon_wing_out_l, dt); + self.dragon_wing_out_r.interpolate(&target.dragon_wing_out_r, dt); + self.dragon_foot_fl.interpolate(&target.dragon_foot_fl, dt); + self.dragon_foot_fr.interpolate(&target.dragon_foot_fr, dt); + self.dragon_foot_bl.interpolate(&target.dragon_foot_bl, dt); + self.dragon_foot_br.interpolate(&target.dragon_foot_br, dt); + + + } +} diff --git a/voxygen/src/anim/dragon/run.rs b/voxygen/src/anim/dragon/run.rs new file mode 100644 index 0000000000..9c053fb3a7 --- /dev/null +++ b/voxygen/src/anim/dragon/run.rs @@ -0,0 +1,108 @@ +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(); + + 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 duck_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.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.dragon_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.dragon_head.scale = Vec3::one() / 10.88; + + next.dragon_chest_front.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_front.ori = Quaternion::rotation_x(0.0); + next.dragon_chest_front.scale = Vec3::one() * 1.01; + + next.dragon_chest_rear.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0); + next.dragon_chest_rear.scale = Vec3::one() * 1.01; + + next.dragon_tail_front.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_front.ori = Quaternion::rotation_x(0.0); + next.dragon_tail_front.scale = Vec3::one() * 1.01; + + next.dragon_tail_rear.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0); + next.dragon_tail_rear.scale = Vec3::one() * 1.01; + + next.dragon_wing_in_l.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_in_l.scale = Vec3::one() * 1.01; + + next.dragon_wing_in_r.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_in_r.scale = Vec3::one() * 1.01; + + next.dragon_wing_out_l.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_out_l.scale = Vec3::one() * 1.01; + + next.dragon_wing_out_r.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0); + next.dragon_wing_out_r.scale = Vec3::one() * 1.01; + + next.dragon_foot_fl.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_fl.scale = Vec3::one() * 1.01; + + next.dragon_foot_fr.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_fr.scale = Vec3::one() * 1.01; + + next.dragon_foot_bl.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_bl.scale = Vec3::one() * 1.01; + + next.dragon_foot_br.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_br.ori = Quaternion::rotation_x(0.0); + next.dragon_foot_br.scale = Vec3::one() * 1.01; + next + } +} diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index b9600a531a..afb3611057 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -5,6 +5,7 @@ pub mod quadruped; pub mod quadrupedmedium; pub mod birdmedium; pub mod fishmedium; +pub mod dragon; use crate::render::FigureBoneData; use common::comp::{self, item::Tool}; diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index 9c89226f2a..b381c487cb 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -262,6 +262,24 @@ impl FigureModelCache { None, None, ], + Body::Dragon(body) => [ + Some(mesh_dragon_head(body.head)), + Some(mesh_dragon_chest_front(body.chest_front)), + Some(mesh_dragon_chest_rear(body.chest_rear)), + Some(mesh_dragon_tail_front(body.tail_front)), + Some(mesh_dragon_tail_rear(body.tail_rear)), + Some(mesh_dragon_wing_in_l(body.wing_in_l)), + Some(mesh_dragon_wing_in_r(body.wing_in_r)), + Some(mesh_dragon_wing_out_l(body.wing_out_l)), + Some(mesh_dragon_wing_out_r(body.wing_out_r)), + Some(mesh_dragon_foot_fl(body.foot_fl)), + Some(mesh_dragon_foot_fr(body.foot_fr)), + Some(mesh_dragon_foot_bl(body.foot_bl)), + Some(mesh_dragon_foot_br(body.foot_br)), + None, + None, + None, + ], Body::Object(object) => [ Some(mesh_object(object)), None, diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 20ed90280c..14f2b412d7 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -10,7 +10,7 @@ use common::{ Belt, BodyType, Chest, EyeColor, Eyebrows, Foot, Hand, Pants, Race, Shoulder, Skin, }, item::Tool, - object, quadruped, quadruped_medium, bird_medium, fish_medium, Item, Itemkind + object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, Item, Itemkind }, figure::{DynaUnionizer, MatSegment, Material, Segment}, }; @@ -814,6 +814,125 @@ pub fn mesh_marlin_fin_r(fin_r: fish_medium::FinR) -> Mesh { Vec3::new(-7.0, -6.0, -6.0), ) } +//// +pub fn mesh_dragon_head(head: dragon::Head) -> Mesh { + load_mesh( + match head { + dragon::Head::Default => "npc.dragon.dragon_head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_chest_front(chest_front: dragon::ChestFront) -> Mesh { + load_mesh( + match chest_front { + dragon::ChestFront::Default => "npc.dragon.dragon_chest_front", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_chest_rear(chest_rear: dragon::ChestRear) -> Mesh { + load_mesh( + match chest_rear { + dragon::ChestRear::Default => "npc.dragon.dragon_chest_rear", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_tail_front(tail_front: dragon::TailFront) -> Mesh { + load_mesh( + match tail_front { + dragon::TailFront::Default => "npc.dragon.dragon_tail_front", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_tail_rear(tail_rear: dragon::TailRear) -> Mesh { + load_mesh( + match tail_rear { + dragon::TailRear::Default => "npc.dragon.dragon_tail_rear", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_wing_in_l(wing_in_l: dragon::WingInL) -> Mesh { + load_mesh( + match wing_in_l { + dragon::WingInL::Default => "npc.dragon.dragon_wing_in_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_wing_in_r(wing_in_r: dragon::WingInR) -> Mesh { + load_mesh( + match wing_in_r { + dragon::WingInR::Default => "npc.dragon.dragon_wing_in_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_wing_out_l(wing_out_l: dragon::WingOutL) -> Mesh { + load_mesh( + match wing_out_l { + dragon::WingOutL::Default => "npc.dragon.dragon_wing_out_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_wing_out_r(wing_out_r: dragon::WingOutR) -> Mesh { + load_mesh( + match wing_out_r { + dragon::WingOutR::Default => "npc.dragon.dragon_wing_out_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_foot_fl(foot_fl: dragon::FootFL) -> Mesh { + load_mesh( + match foot_fl { + dragon::FootFL::Default => "npc.dragon.dragon_foot_fl", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_foot_fr(foot_fr: dragon::FootFR) -> Mesh { + load_mesh( + match foot_fr { + dragon::FootFR::Default => "npc.dragon.dragon_foot_fr", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_foot_bl(foot_bl: dragon::FootBL) -> Mesh { + load_mesh( + match foot_bl { + dragon::FootBL::Default => "npc.dragon.dragon_foot_bl", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_dragon_foot_br(foot_br: dragon::FootBR) -> Mesh { + load_mesh( + match foot_br { + dragon::FootBR::Default => "npc.dragon.dragon_foot_br", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + + //// pub fn mesh_object(obj: object::Body) -> Mesh { use object::Body; diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 3c87e24ffd..f892380776 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -7,7 +7,7 @@ pub use load::load_mesh; // TODO: Don't make this public. use crate::{ anim::{ self, character::CharacterSkeleton, object::ObjectSkeleton, quadruped::QuadrupedSkeleton, - quadrupedmedium::QuadrupedMediumSkeleton, birdmedium::BirdMediumSkeleton, fishmedium::FishMediumSkeleton,Animation, Skeleton, + quadrupedmedium::QuadrupedMediumSkeleton, birdmedium::BirdMediumSkeleton, fishmedium::FishMediumSkeleton, dragon::DragonSkeleton, Animation, Skeleton, }, render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow}, scene::camera::{Camera, CameraMode}, @@ -34,6 +34,7 @@ pub struct FigureMgr { quadruped_medium_states: HashMap>, bird_medium_states: HashMap>, fish_medium_states: HashMap>, + dragon_states: HashMap>, object_states: HashMap>, } @@ -46,6 +47,7 @@ impl FigureMgr { quadruped_medium_states: HashMap::new(), bird_medium_states: HashMap::new(), fish_medium_states: HashMap::new(), + dragon_states: HashMap::new(), object_states: HashMap::new(), } } @@ -103,6 +105,9 @@ impl FigureMgr { Body::FishMedium(_) => { self.fish_medium_states.remove(&entity); } + Body::Dragon(_) => { + self.dragon_states.remove(&entity); + } Body::Object(_) => { self.object_states.remove(&entity); } @@ -502,6 +507,63 @@ impl FigureMgr { action_animation_rate, ); } + Body::Dragon(_) => { + let state = self + .dragon_states + .entry(entity) + .or_insert_with(|| { + FigureState::new(renderer, DragonSkeleton::new()) + }); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::dragon::IdleAnimation::update_skeleton( + &DragonSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::dragon::RunAnimation::update_skeleton( + &DragonSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::dragon::JumpAnimation::update_skeleton( + &DragonSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } Body::Object(_) => { let state = self .object_states @@ -535,6 +597,8 @@ impl FigureMgr { .retain(|entity, _| ecs.entities().is_alive(*entity)); self.fish_medium_states .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.dragon_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); self.object_states .retain(|entity, _| ecs.entities().is_alive(*entity)); } @@ -600,6 +664,10 @@ impl FigureMgr { .fish_medium_states .get(&entity) .map(|state| (state.locals(), state.bone_consts())), + Body::Dragon(_) => self + .dragon_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), Body::Object(_) => self .object_states .get(&entity) From 574f0707586d3b8a9666a8492806a55835ca7957 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 23 Oct 2019 21:10:26 -0400 Subject: [PATCH 03/10] added large bipeds, small birbs, small fish skeletons --- voxygen/src/anim/biped_large/idle.rs | 98 +++++++++++++ voxygen/src/anim/biped_large/jump.rs | 86 +++++++++++ voxygen/src/anim/biped_large/mod.rs | 99 +++++++++++++ voxygen/src/anim/biped_large/run.rs | 98 +++++++++++++ voxygen/src/anim/bird_small/idle.rs | 64 +++++++++ voxygen/src/anim/bird_small/jump.rs | 52 +++++++ voxygen/src/anim/bird_small/mod.rs | 68 +++++++++ voxygen/src/anim/bird_small/run.rs | 64 +++++++++ voxygen/src/anim/fish_small/idle.rs | 54 +++++++ voxygen/src/anim/fish_small/jump.rs | 42 ++++++ voxygen/src/anim/fish_small/mod.rs | 59 ++++++++ voxygen/src/anim/fish_small/run.rs | 54 +++++++ voxygen/src/anim/mod.rs | 3 + voxygen/src/scene/figure/cache.rs | 54 +++++++ voxygen/src/scene/figure/load.rs | 157 +++++++++++++++++++- voxygen/src/scene/figure/mod.rs | 206 ++++++++++++++++++++++++++- 16 files changed, 1256 insertions(+), 2 deletions(-) create mode 100644 voxygen/src/anim/biped_large/idle.rs create mode 100644 voxygen/src/anim/biped_large/jump.rs create mode 100644 voxygen/src/anim/biped_large/mod.rs create mode 100644 voxygen/src/anim/biped_large/run.rs create mode 100644 voxygen/src/anim/bird_small/idle.rs create mode 100644 voxygen/src/anim/bird_small/jump.rs create mode 100644 voxygen/src/anim/bird_small/mod.rs create mode 100644 voxygen/src/anim/bird_small/run.rs create mode 100644 voxygen/src/anim/fish_small/idle.rs create mode 100644 voxygen/src/anim/fish_small/jump.rs create mode 100644 voxygen/src/anim/fish_small/mod.rs create mode 100644 voxygen/src/anim/fish_small/run.rs diff --git a/voxygen/src/anim/biped_large/idle.rs b/voxygen/src/anim/biped_large/idle.rs new file mode 100644 index 0000000000..09be0204ac --- /dev/null +++ b/voxygen/src/anim/biped_large/idle.rs @@ -0,0 +1,98 @@ +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(); + + 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 duck_m_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.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_head.scale = Vec3::one() / 10.88; + + next.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_upper_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_upper_torso.scale = Vec3::one() / 10.88; + + next.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_lower_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_lower_torso.scale = Vec3::one() / 10.88; + + next.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_shoulder_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_l.scale = Vec3::one() / 10.88; + + next.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_shoulder_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_r.scale = Vec3::one() / 10.88; + + next.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_hand_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_l.scale = Vec3::one() / 10.88; + + next.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_hand_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_r.scale = Vec3::one() / 10.88; + + next.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_leg_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_l.scale = Vec3::one() / 10.88; + + next.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_leg_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_r.scale = Vec3::one() / 10.88; + + next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_foot_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_l.scale = Vec3::one() / 10.88; + + next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_foot_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_r.scale = Vec3::one() / 10.88; + next + } +} diff --git a/voxygen/src/anim/biped_large/jump.rs b/voxygen/src/anim/biped_large/jump.rs new file mode 100644 index 0000000000..1745bad157 --- /dev/null +++ b/voxygen/src/anim/biped_large/jump.rs @@ -0,0 +1,86 @@ +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(); + + 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(); + + + + next.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_head.scale = Vec3::one() / 10.88; + + next.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_upper_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_upper_torso.scale = Vec3::one() / 10.88; + + next.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_lower_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_lower_torso.scale = Vec3::one() / 10.88; + + next.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_shoulder_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_l.scale = Vec3::one() / 10.88; + + next.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_shoulder_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_r.scale = Vec3::one() / 10.88; + + next.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_hand_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_l.scale = Vec3::one() / 10.88; + + next.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_hand_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_r.scale = Vec3::one() / 10.88; + + next.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_leg_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_l.scale = Vec3::one() / 10.88; + + next.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_leg_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_r.scale = Vec3::one() / 10.88; + + next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_foot_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_l.scale = Vec3::one() / 10.88; + + next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_foot_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_r.scale = Vec3::one() / 10.88; + next + } +} diff --git a/voxygen/src/anim/biped_large/mod.rs b/voxygen/src/anim/biped_large/mod.rs new file mode 100644 index 0000000000..fc2c7c65f9 --- /dev/null +++ b/voxygen/src/anim/biped_large/mod.rs @@ -0,0 +1,99 @@ +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 { + knight_head: Bone, + knight_upper_torso: Bone, + knight_lower_torso: Bone, + knight_shoulder_l: Bone, + knight_shoulder_r: Bone, + knight_hand_l: Bone, + knight_hand_r: Bone, + knight_leg_l: Bone, + knight_leg_r: Bone, + knight_foot_l: Bone, + knight_foot_r: Bone, + + + +} + +impl BipedLargeSkeleton { + pub fn new() -> Self { + Self { + knight_head: Bone::default(), + knight_upper_torso: Bone::default(), + knight_lower_torso: Bone::default(), + knight_shoulder_l: Bone::default(), + knight_shoulder_r: Bone::default(), + knight_hand_l: Bone::default(), + knight_hand_r: Bone::default(), + knight_leg_l: Bone::default(), + knight_leg_r: Bone::default(), + knight_foot_l: Bone::default(), + knight_foot_r: Bone::default(), + + } + } +} + +impl Skeleton for BipedLargeSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let upper_torso_mat = self.knight_upper_torso.compute_base_matrix(); + let shoulder_l_mat = self.knight_shoulder_l.compute_base_matrix(); + let shoulder_r_mat = self.knight_shoulder_r.compute_base_matrix(); + let leg_l_mat = self.knight_leg_l.compute_base_matrix(); + let leg_r_mat = self.knight_leg_r.compute_base_matrix(); + + + [ + FigureBoneData::new(self.knight_head.compute_base_matrix()), + FigureBoneData::new( + upper_torso_mat, + ), + FigureBoneData::new(self.knight_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.knight_hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat), + FigureBoneData::new(self.knight_hand_r.compute_base_matrix() * shoulder_r_mat * upper_torso_mat), + FigureBoneData::new(leg_l_mat), + FigureBoneData::new(leg_r_mat), + FigureBoneData::new(self.knight_foot_l.compute_base_matrix() * leg_l_mat), + FigureBoneData::new(self.knight_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.knight_head + .interpolate(&target.knight_head, dt); + self.knight_upper_torso.interpolate(&target.knight_upper_torso, dt); + self.knight_lower_torso + .interpolate(&target.knight_lower_torso, dt); + self.knight_shoulder_l.interpolate(&target.knight_shoulder_l, dt); + self.knight_shoulder_r + .interpolate(&target.knight_shoulder_r, dt); + self.knight_hand_l.interpolate(&target.knight_hand_l, dt); + self.knight_hand_r.interpolate(&target.knight_hand_r, dt); + self.knight_leg_l.interpolate(&target.knight_leg_l, dt); + self.knight_leg_r.interpolate(&target.knight_leg_r, dt); + self.knight_foot_l.interpolate(&target.knight_foot_l, dt); + self.knight_foot_r.interpolate(&target.knight_foot_r, dt); + + + } +} diff --git a/voxygen/src/anim/biped_large/run.rs b/voxygen/src/anim/biped_large/run.rs new file mode 100644 index 0000000000..3e92091d9a --- /dev/null +++ b/voxygen/src/anim/biped_large/run.rs @@ -0,0 +1,98 @@ +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(); + + 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 duck_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.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_head.scale = Vec3::one() / 10.88; + + next.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_upper_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_upper_torso.scale = Vec3::one() / 10.88; + + next.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_lower_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_lower_torso.scale = Vec3::one() / 10.88; + + next.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_shoulder_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_l.scale = Vec3::one() / 10.88; + + next.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_shoulder_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_r.scale = Vec3::one() / 10.88; + + next.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_hand_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_l.scale = Vec3::one() / 10.88; + + next.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_hand_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_r.scale = Vec3::one() / 10.88; + + next.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_leg_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_l.scale = Vec3::one() / 10.88; + + next.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_leg_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_r.scale = Vec3::one() / 10.88; + + next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_foot_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_l.scale = Vec3::one() / 10.88; + + next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.knight_foot_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_r.scale = Vec3::one() / 10.88; + next + } +} diff --git a/voxygen/src/anim/bird_small/idle.rs b/voxygen/src/anim/bird_small/idle.rs new file mode 100644 index 0000000000..8b2fdd9e27 --- /dev/null +++ b/voxygen/src/anim/bird_small/idle.rs @@ -0,0 +1,64 @@ +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(); + + 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 duck_m_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.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_head.scale = Vec3::one() / 10.88; + + next.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_torso.scale = Vec3::one() / 10.88; + + next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_wing_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_l.scale = Vec3::one() / 10.88; + + next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_wing_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_r.scale = Vec3::one() / 10.88; + + next + } +} diff --git a/voxygen/src/anim/bird_small/jump.rs b/voxygen/src/anim/bird_small/jump.rs new file mode 100644 index 0000000000..f2d9eb928f --- /dev/null +++ b/voxygen/src/anim/bird_small/jump.rs @@ -0,0 +1,52 @@ +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(); + + 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(); + + + + next.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_head.scale = Vec3::one() / 10.88; + + next.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_torso.scale = Vec3::one() / 10.88; + + next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_wing_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_l.scale = Vec3::one() / 10.88; + + next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_wing_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_r.scale = Vec3::one() / 10.88; + + next + } +} diff --git a/voxygen/src/anim/bird_small/mod.rs b/voxygen/src/anim/bird_small/mod.rs new file mode 100644 index 0000000000..472c861eea --- /dev/null +++ b/voxygen/src/anim/bird_small/mod.rs @@ -0,0 +1,68 @@ +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 { + crow_head: Bone, + crow_torso: Bone, + crow_wing_l: Bone, + crow_wing_r: Bone, +} + +impl BirdSmallSkeleton { + pub fn new() -> Self { + Self { + crow_head: Bone::default(), + crow_torso: Bone::default(), + crow_wing_l: Bone::default(), + crow_wing_r: Bone::default(), + + } + } +} + +impl Skeleton for BirdSmallSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let torso_mat = self.crow_torso.compute_base_matrix(); + + + [ + FigureBoneData::new(self.crow_head.compute_base_matrix() * torso_mat), + FigureBoneData::new( + torso_mat, + ), + FigureBoneData::new(self.crow_wing_l.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.crow_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.crow_head + .interpolate(&target.crow_head, dt); + self.crow_torso.interpolate(&target.crow_torso, dt); + self.crow_wing_l.interpolate(&target.crow_wing_l, dt); + self.crow_wing_r + .interpolate(&target.crow_wing_r, dt); + } +} diff --git a/voxygen/src/anim/bird_small/run.rs b/voxygen/src/anim/bird_small/run.rs new file mode 100644 index 0000000000..3a4fb0fc98 --- /dev/null +++ b/voxygen/src/anim/bird_small/run.rs @@ -0,0 +1,64 @@ +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(); + + 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 duck_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.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_head.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_head.scale = Vec3::one() / 10.88; + + next.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_torso.scale = Vec3::one() / 10.88; + + next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_wing_l.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_l.scale = Vec3::one() / 10.88; + + next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.crow_wing_r.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_r.scale = Vec3::one() / 10.88; + + next + } +} diff --git a/voxygen/src/anim/fish_small/idle.rs b/voxygen/src/anim/fish_small/idle.rs new file mode 100644 index 0000000000..1ca41f58ae --- /dev/null +++ b/voxygen/src/anim/fish_small/idle.rs @@ -0,0 +1,54 @@ +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(); + + 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 duck_m_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.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.cardinalfish_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.cardinalfish_torso.scale = Vec3::one() / 10.88; + + next.cardinalfish_tail.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0); + next.cardinalfish_tail.scale = Vec3::one() * 1.01; + + next + } +} diff --git a/voxygen/src/anim/fish_small/jump.rs b/voxygen/src/anim/fish_small/jump.rs new file mode 100644 index 0000000000..d48dccec67 --- /dev/null +++ b/voxygen/src/anim/fish_small/jump.rs @@ -0,0 +1,42 @@ +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(); + + 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(); + + + + next.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.cardinalfish_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.cardinalfish_torso.scale = Vec3::one() / 10.88; + + next.cardinalfish_tail.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0); + next.cardinalfish_tail.scale = Vec3::one() * 1.01; + + next + } +} diff --git a/voxygen/src/anim/fish_small/mod.rs b/voxygen/src/anim/fish_small/mod.rs new file mode 100644 index 0000000000..00b25e90ea --- /dev/null +++ b/voxygen/src/anim/fish_small/mod.rs @@ -0,0 +1,59 @@ +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 { + cardinalfish_torso: Bone, + cardinalfish_tail: Bone, + +} + +impl FishSmallSkeleton { + pub fn new() -> Self { + Self { + cardinalfish_torso: Bone::default(), + cardinalfish_tail: Bone::default(), + } + } +} + +impl Skeleton for FishSmallSkeleton { + fn compute_matrices(&self) -> [FigureBoneData; 16] { + let torso_mat = self.cardinalfish_torso.compute_base_matrix(); + + + [ + FigureBoneData::new(torso_mat), + FigureBoneData::new(self.cardinalfish_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.cardinalfish_torso + .interpolate(&target.cardinalfish_torso, dt); + self.cardinalfish_tail.interpolate(&target.cardinalfish_tail, dt); + } +} diff --git a/voxygen/src/anim/fish_small/run.rs b/voxygen/src/anim/fish_small/run.rs new file mode 100644 index 0000000000..2a278a1624 --- /dev/null +++ b/voxygen/src/anim/fish_small/run.rs @@ -0,0 +1,54 @@ +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(); + + 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 duck_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.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; + next.cardinalfish_torso.ori = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.cardinalfish_torso.scale = Vec3::one() / 10.88; + + next.cardinalfish_tail.offset = + Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0); + next.cardinalfish_tail.scale = Vec3::one() * 1.01; + + next + } +} diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index afb3611057..bc1adc74f9 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -6,6 +6,9 @@ pub mod quadrupedmedium; pub mod birdmedium; pub mod fishmedium; pub mod dragon; +pub mod bird_small; +pub mod fish_small; +pub mod biped_large; use crate::render::FigureBoneData; use common::comp::{self, item::Tool}; diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index b381c487cb..b8fd3ba31b 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -280,6 +280,60 @@ impl FigureModelCache { None, None, ], + Body::BirdSmall(body) => [ + Some(mesh_crow_head(body.head)), + Some(mesh_crow_torso(body.torso)), + Some(mesh_crow_wing_l(body.wing_l)), + Some(mesh_crow_wing_r(body.wing_r)), + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ], + Body::FishSmall(body) => [ + Some(mesh_cardinalfish_torso(body.torso)), + Some(mesh_cardinalfish_tail(body.tail)), + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + None, + ], + Body::BipedLarge(body) => [ + Some(mesh_knight_head(body.head)), + Some(mesh_knight_upper_torso(body.upper_torso)), + Some(mesh_knight_lower_torso(body.lower_torso)), + Some(mesh_knight_shoulder_l(body.shoulder_l)), + Some(mesh_knight_shoulder_r(body.shoulder_r)), + Some(mesh_knight_hand_l(body.hand_l)), + Some(mesh_knight_hand_r(body.hand_r)), + Some(mesh_knight_leg_l(body.leg_l)), + Some(mesh_knight_leg_r(body.leg_r)), + Some(mesh_knight_foot_l(body.foot_l)), + Some(mesh_knight_foot_r(body.foot_r)), + None, + None, + None, + None, + None, + ], Body::Object(object) => [ Some(mesh_object(object)), None, diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 14f2b412d7..e453ef2ac8 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -10,7 +10,8 @@ use common::{ Belt, BodyType, Chest, EyeColor, Eyebrows, Foot, Hand, Pants, Race, Shoulder, Skin, }, item::Tool, - object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, Item, Itemkind + + object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, bird_small, fish_small, biped_large, Item, Itemkind }, figure::{DynaUnionizer, MatSegment, Material, Segment}, }; @@ -932,6 +933,160 @@ pub fn mesh_dragon_foot_br(foot_br: dragon::FootBR) -> Mesh { ) } +//// +pub fn mesh_crow_head(head: bird_small::Head) -> Mesh { + load_mesh( + match head { + bird_small::Head::Default => "npc.crow.crow_head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_crow_torso(torso: bird_small::Torso) -> Mesh { + load_mesh( + match torso { + bird_small::Torso::Default => "npc.crow.crow_torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_crow_wing_l(wing_l: bird_small::WingL) -> Mesh { + load_mesh( + match wing_l { + bird_small::WingL::Default => "npc.crow.crow_wing_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_crow_wing_r(wing_r: bird_small::WingR) -> Mesh { + load_mesh( + match wing_r { + bird_small::WingR::Default => "npc.crow.crow_wing_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} +//// +pub fn mesh_cardinalfish_torso(torso: fish_small::Torso) -> Mesh { + load_mesh( + match torso { + fish_small::Torso::Default => "npc.cardinalfish.cardinalfish_torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_cardinalfish_tail(tail: fish_small::Tail) -> Mesh { + load_mesh( + match tail { + fish_small::Tail::Default => "npc.cardinalfish.cardinalfish_tail", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} +//// +pub fn mesh_knight_head(head: biped_large::Head) -> Mesh { + load_mesh( + match head { + biped_large::Head::Default => "npc.knight.knight_", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_upper_torso(upper_torso: biped_large::UpperTorso) -> Mesh { + load_mesh( + match upper_torso { + biped_large::UpperTorso::Default => "npc.knight.knight_upper_torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_lower_torso(lower_torso: biped_large::LowerTorso) -> Mesh { + load_mesh( + match lower_torso { + biped_large::LowerTorso::Default => "npc.knight.knight_lower_torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_shoulder_l(shoulder_l: biped_large::ShoulderL) -> Mesh { + load_mesh( + match shoulder_l { + biped_large::ShoulderL::Default => "npc.knight.knight_shoulder_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_shoulder_r(shoulder_r: biped_large::ShoulderR) -> Mesh { + load_mesh( + match shoulder_r { + biped_large::ShoulderR::Default => "npc.knight.knight_shoulder_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_hand_l(hand_l: biped_large::HandL) -> Mesh { + load_mesh( + match hand_l { + biped_large::HandL::Default => "npc.knight.knight_hand_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_hand_r(hand_r: biped_large::HandR) -> Mesh { + load_mesh( + match hand_r { + biped_large::HandR::Default => "npc.knight.knight_hand_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_leg_l(leg_l: biped_large::LegL) -> Mesh { + load_mesh( + match leg_l { + biped_large::LegL::Default => "npc.knight.knight_leg_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_leg_r(leg_r: biped_large::LegR) -> Mesh { + load_mesh( + match leg_r { + biped_large::LegR::Default => "npc.knight.knight_leg_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_foot_l(foot_l: biped_large::FootL) -> Mesh { + load_mesh( + match foot_l { + biped_large::FootL::Default => "npc.knight.knight_foot_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_knight_foot_r(foot_r: biped_large::FootR) -> Mesh { + load_mesh( + match foot_r { + biped_large::FootR::Default => "npc.knight.knight_foot_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + //// pub fn mesh_object(obj: object::Body) -> Mesh { diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index f892380776..664d6ab937 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -7,7 +7,7 @@ pub use load::load_mesh; // TODO: Don't make this public. use crate::{ anim::{ self, character::CharacterSkeleton, object::ObjectSkeleton, quadruped::QuadrupedSkeleton, - quadrupedmedium::QuadrupedMediumSkeleton, birdmedium::BirdMediumSkeleton, fishmedium::FishMediumSkeleton, dragon::DragonSkeleton, Animation, Skeleton, + quadrupedmedium::QuadrupedMediumSkeleton, birdmedium::BirdMediumSkeleton, fishmedium::FishMediumSkeleton, dragon::DragonSkeleton, bird_small::BirdSmallSkeleton, fish_small::FishSmallSkeleton, biped_large::BipedLargeSkeleton, Animation, Skeleton, }, render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow}, scene::camera::{Camera, CameraMode}, @@ -35,6 +35,9 @@ pub struct FigureMgr { bird_medium_states: HashMap>, fish_medium_states: HashMap>, dragon_states: HashMap>, + bird_small_states: HashMap>, + fish_small_states: HashMap>, + biped_large_states: HashMap>, object_states: HashMap>, } @@ -48,6 +51,9 @@ impl FigureMgr { bird_medium_states: HashMap::new(), fish_medium_states: HashMap::new(), dragon_states: HashMap::new(), + bird_small_states: HashMap::new(), + fish_small_states: HashMap::new(), + biped_large_states: HashMap::new(), object_states: HashMap::new(), } } @@ -108,6 +114,15 @@ impl FigureMgr { Body::Dragon(_) => { self.dragon_states.remove(&entity); } + Body::BirdSmall(_) => { + self.bird_small_states.remove(&entity); + } + Body::FishSmall(_) => { + self.fish_small_states.remove(&entity); + } + Body::BipedLarge(_) => { + self.biped_large_states.remove(&entity); + } Body::Object(_) => { self.object_states.remove(&entity); } @@ -564,6 +579,177 @@ impl FigureMgr { action_animation_rate, ); } + Body::BirdSmall(_) => { + let state = self + .bird_small_states + .entry(entity) + .or_insert_with(|| { + FigureState::new(renderer, BirdSmallSkeleton::new()) + }); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::bird_small::IdleAnimation::update_skeleton( + &BirdSmallSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::bird_small::RunAnimation::update_skeleton( + &BirdSmallSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::bird_small::JumpAnimation::update_skeleton( + &BirdSmallSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } + Body::FishSmall(_) => { + let state = self + .fish_small_states + .entry(entity) + .or_insert_with(|| { + FigureState::new(renderer,FishSmallSkeleton::new()) + }); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::fish_small::IdleAnimation::update_skeleton( + &FishSmallSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::fish_small::RunAnimation::update_skeleton( + &FishSmallSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::fish_small::JumpAnimation::update_skeleton( + &FishSmallSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } + Body::BipedLarge(_) => { + let state = self + .biped_large_states + .entry(entity) + .or_insert_with(|| { + FigureState::new(renderer, BipedLargeSkeleton::new()) + }); + + let (character, last_character) = match (character, last_character) { + (Some(c), Some(l)) => (c, l), + _ => continue, + }; + + if !character.is_same_movement(&last_character.0) { + state.movement_time = 0.0; + } + + let target_base = match character.movement { + Stand => anim::biped_large::IdleAnimation::update_skeleton( + &BipedLargeSkeleton::new(), + time, + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Run => anim::biped_large::RunAnimation::update_skeleton( + &BipedLargeSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + Jump => anim::biped_large::JumpAnimation::update_skeleton( + &BipedLargeSkeleton::new(), + (vel.0.magnitude(), time), + state.movement_time, + &mut movement_animation_rate, + skeleton_attr, + ), + + // TODO! + _ => state.skeleton_mut().clone(), + }; + + state.skeleton.interpolate(&target_base, dt); + state.update( + renderer, + pos.0, + vel.0, + ori.0, + scale, + col, + dt, + movement_animation_rate, + action_animation_rate, + ); + } Body::Object(_) => { let state = self .object_states @@ -599,6 +785,12 @@ impl FigureMgr { .retain(|entity, _| ecs.entities().is_alive(*entity)); self.dragon_states .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.bird_small_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.fish_small_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); + self.biped_large_states + .retain(|entity, _| ecs.entities().is_alive(*entity)); self.object_states .retain(|entity, _| ecs.entities().is_alive(*entity)); } @@ -668,6 +860,18 @@ impl FigureMgr { .dragon_states .get(&entity) .map(|state| (state.locals(), state.bone_consts())), + Body::BirdSmall(_) => self + .bird_small_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), + Body::FishSmall(_) => self + .fish_small_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), + Body::BipedLarge(_) => self + .biped_large_states + .get(&entity) + .map(|state| (state.locals(), state.bone_consts())), Body::Object(_) => self .object_states .get(&entity) From 25448ae2a14a45b58bc1f61f0abfdee49323968e Mon Sep 17 00:00:00 2001 From: jshipsey Date: Thu, 24 Oct 2019 19:42:33 -0400 Subject: [PATCH 04/10] body tweak --- common/src/comp/body.rs | 6 ++ common/src/comp/body/biped_large.rs | 100 ++++++++++++++++++++++++++++ common/src/comp/body/bird_small.rs | 45 +++++++++++++ common/src/comp/body/fish_small.rs | 29 ++++++++ common/src/comp/mod.rs | 2 +- 5 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 common/src/comp/body/biped_large.rs create mode 100644 common/src/comp/body/bird_small.rs create mode 100644 common/src/comp/body/fish_small.rs diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 1f6c2101e3..c84d74d305 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -5,6 +5,9 @@ pub mod quadruped_medium; pub mod bird_medium; pub mod fish_medium; pub mod dragon; +pub mod bird_small; +pub mod fish_small; +pub mod biped_large; use specs::{Component, FlaggedStorage}; use specs_idvs::IDVStorage; @@ -17,6 +20,9 @@ pub enum 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), } diff --git a/common/src/comp/body/biped_large.rs b/common/src/comp/body/biped_large.rs new file mode 100644 index 0000000000..41eab2caf7 --- /dev/null +++ b/common/src/comp/body/biped_large.rs @@ -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]; \ No newline at end of file diff --git a/common/src/comp/body/bird_small.rs b/common/src/comp/body/bird_small.rs new file mode 100644 index 0000000000..eff28e3119 --- /dev/null +++ b/common/src/comp/body/bird_small.rs @@ -0,0 +1,45 @@ +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]; diff --git a/common/src/comp/body/fish_small.rs b/common/src/comp/body/fish_small.rs new file mode 100644 index 0000000000..0b5ba39ea7 --- /dev/null +++ b/common/src/comp/body/fish_small.rs @@ -0,0 +1,29 @@ +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]; \ No newline at end of file diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index eae3a2aa9b..572d5eb0e6 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -16,7 +16,7 @@ mod visual; // Reexports pub use admin::Admin; pub use agent::Agent; -pub use body::{humanoid, object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, Body}; +pub use body::{humanoid, object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, bird_small, fish_small, biped_large, Body}; pub use character_state::{ActionState, CharacterState, MovementState}; pub use controller::{ ControlEvent, Controller, ControllerInputs, InventoryManip, MountState, Mounting, From e858c31b4c71f376c043954a7e76a69bd9b44536 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Tue, 22 Oct 2019 22:56:45 -0400 Subject: [PATCH 05/10] fish_medium and bird_medium skelingtons --- voxygen/src/scene/figure/load.rs | 111 +++++++++++++++++++++++++++++++ voxygen/src/scene/figure/mod.rs | 2 + 2 files changed, 113 insertions(+) diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index e453ef2ac8..89a162afee 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -707,6 +707,7 @@ pub fn mesh_duck_m_head(head: bird_medium::Head) -> Mesh { Vec3::new(-7.0, -6.0, -6.0), ) } +<<<<<<< HEAD pub fn mesh_duck_m_torso(torso: bird_medium::Torso) -> Mesh { load_mesh( @@ -1088,6 +1089,116 @@ pub fn mesh_knight_foot_r(foot_r: biped_large::FootR) -> Mesh { } +======= + +pub fn mesh_duck_m_torso(torso: bird_medium::Torso) -> Mesh { + load_mesh( + match torso { + bird_medium::Torso::Default => "npc.duck_m.duck_m_body", + }, + Vec3::new(-8.0, -5.5, -6.0), + ) +} + +pub fn mesh_duck_m_tail(tail: bird_medium::Tail) -> Mesh { + load_mesh( + match tail { + bird_medium::Tail::Default => "npc.duck_m.duck_m_tail", + }, + Vec3::new(-4.0, -1.0, -1.0), + ) +} + +pub fn mesh_duck_m_wing_l(wing_l: bird_medium::WingL) -> Mesh { + load_mesh( + match wing_l { + bird_medium::WingL::Default => "npc.duck_m.duck_m_wing", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} + +pub fn mesh_duck_m_wing_r(wing_r: bird_medium::WingR) -> Mesh { + load_mesh( + match wing_r { + bird_medium::WingR::Default => "npc.duck_m.duck_m_wing", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} + +pub fn mesh_duck_m_leg_l(leg_l: bird_medium::LegL) -> Mesh { + load_mesh( + match leg_l { + bird_medium::LegL::Default => "npc.duck_m.duck_m_leg_l", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} + +pub fn mesh_duck_m_leg_r(leg_r: bird_medium::LegR) -> Mesh { + load_mesh( + match leg_r { + bird_medium::LegR::Default => "npc.duck_m.duck_m_leg_r", + }, + Vec3::new(-2.5, -4.0, -2.5), + ) +} +//// +pub fn mesh_marlin_head(head: fish_medium::Head) -> Mesh { + load_mesh( + match head { + fish_medium::Head::Default => "npc.marlin.marlin_head", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_torso(torso: fish_medium::Torso) -> Mesh { + load_mesh( + match torso { + fish_medium::Torso::Default => "npc.marlin.marlin_torso", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_rear(rear: fish_medium::Rear) -> Mesh { + load_mesh( + match rear { + fish_medium::Rear::Default => "npc.marlin.marlin_rear", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_tail(tail: fish_medium::Tail) -> Mesh { + load_mesh( + match tail { + fish_medium::Tail::Default => "npc.marlin.marlin_tail", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_fin_l(fin_l: fish_medium::FinL) -> Mesh { + load_mesh( + match fin_l { + fish_medium::FinL::Default => "npc.marlin.marlin_fin_l", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} + +pub fn mesh_marlin_fin_r(fin_r: fish_medium::FinR) -> Mesh { + load_mesh( + match fin_r { + fish_medium::FinR::Default => "npc.marlin.marlin_fin_r", + }, + Vec3::new(-7.0, -6.0, -6.0), + ) +} +>>>>>>> fish_medium and bird_medium skelingtons //// pub fn mesh_object(obj: object::Body) -> Mesh { use object::Body; diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 664d6ab937..f651c89a6a 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -8,6 +8,7 @@ use crate::{ anim::{ self, character::CharacterSkeleton, object::ObjectSkeleton, quadruped::QuadrupedSkeleton, quadrupedmedium::QuadrupedMediumSkeleton, birdmedium::BirdMediumSkeleton, fishmedium::FishMediumSkeleton, dragon::DragonSkeleton, bird_small::BirdSmallSkeleton, fish_small::FishSmallSkeleton, biped_large::BipedLargeSkeleton, Animation, Skeleton, + }, render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow}, scene::camera::{Camera, CameraMode}, @@ -38,6 +39,7 @@ pub struct FigureMgr { bird_small_states: HashMap>, fish_small_states: HashMap>, biped_large_states: HashMap>, + object_states: HashMap>, } From 4f5f7402f08794142c5d1df7917606efcac1ef6e Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 23 Oct 2019 00:59:05 -0400 Subject: [PATCH 06/10] added dragon skeleton --- voxygen/src/scene/figure/load.rs | 113 +------------------------------ voxygen/src/scene/figure/mod.rs | 1 - 2 files changed, 1 insertion(+), 113 deletions(-) diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 89a162afee..1fe08b87c5 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -12,6 +12,7 @@ use common::{ item::Tool, object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, bird_small, fish_small, biped_large, Item, Itemkind + }, figure::{DynaUnionizer, MatSegment, Material, Segment}, }; @@ -707,7 +708,6 @@ pub fn mesh_duck_m_head(head: bird_medium::Head) -> Mesh { Vec3::new(-7.0, -6.0, -6.0), ) } -<<<<<<< HEAD pub fn mesh_duck_m_torso(torso: bird_medium::Torso) -> Mesh { load_mesh( @@ -1088,117 +1088,6 @@ pub fn mesh_knight_foot_r(foot_r: biped_large::FootR) -> Mesh { ) } - -======= - -pub fn mesh_duck_m_torso(torso: bird_medium::Torso) -> Mesh { - load_mesh( - match torso { - bird_medium::Torso::Default => "npc.duck_m.duck_m_body", - }, - Vec3::new(-8.0, -5.5, -6.0), - ) -} - -pub fn mesh_duck_m_tail(tail: bird_medium::Tail) -> Mesh { - load_mesh( - match tail { - bird_medium::Tail::Default => "npc.duck_m.duck_m_tail", - }, - Vec3::new(-4.0, -1.0, -1.0), - ) -} - -pub fn mesh_duck_m_wing_l(wing_l: bird_medium::WingL) -> Mesh { - load_mesh( - match wing_l { - bird_medium::WingL::Default => "npc.duck_m.duck_m_wing", - }, - Vec3::new(-2.5, -4.0, -2.5), - ) -} - -pub fn mesh_duck_m_wing_r(wing_r: bird_medium::WingR) -> Mesh { - load_mesh( - match wing_r { - bird_medium::WingR::Default => "npc.duck_m.duck_m_wing", - }, - Vec3::new(-2.5, -4.0, -2.5), - ) -} - -pub fn mesh_duck_m_leg_l(leg_l: bird_medium::LegL) -> Mesh { - load_mesh( - match leg_l { - bird_medium::LegL::Default => "npc.duck_m.duck_m_leg_l", - }, - Vec3::new(-2.5, -4.0, -2.5), - ) -} - -pub fn mesh_duck_m_leg_r(leg_r: bird_medium::LegR) -> Mesh { - load_mesh( - match leg_r { - bird_medium::LegR::Default => "npc.duck_m.duck_m_leg_r", - }, - Vec3::new(-2.5, -4.0, -2.5), - ) -} -//// -pub fn mesh_marlin_head(head: fish_medium::Head) -> Mesh { - load_mesh( - match head { - fish_medium::Head::Default => "npc.marlin.marlin_head", - }, - Vec3::new(-7.0, -6.0, -6.0), - ) -} - -pub fn mesh_marlin_torso(torso: fish_medium::Torso) -> Mesh { - load_mesh( - match torso { - fish_medium::Torso::Default => "npc.marlin.marlin_torso", - }, - Vec3::new(-7.0, -6.0, -6.0), - ) -} - -pub fn mesh_marlin_rear(rear: fish_medium::Rear) -> Mesh { - load_mesh( - match rear { - fish_medium::Rear::Default => "npc.marlin.marlin_rear", - }, - Vec3::new(-7.0, -6.0, -6.0), - ) -} - -pub fn mesh_marlin_tail(tail: fish_medium::Tail) -> Mesh { - load_mesh( - match tail { - fish_medium::Tail::Default => "npc.marlin.marlin_tail", - }, - Vec3::new(-7.0, -6.0, -6.0), - ) -} - -pub fn mesh_marlin_fin_l(fin_l: fish_medium::FinL) -> Mesh { - load_mesh( - match fin_l { - fish_medium::FinL::Default => "npc.marlin.marlin_fin_l", - }, - Vec3::new(-7.0, -6.0, -6.0), - ) -} - -pub fn mesh_marlin_fin_r(fin_r: fish_medium::FinR) -> Mesh { - load_mesh( - match fin_r { - fish_medium::FinR::Default => "npc.marlin.marlin_fin_r", - }, - Vec3::new(-7.0, -6.0, -6.0), - ) -} ->>>>>>> fish_medium and bird_medium skelingtons //// pub fn mesh_object(obj: object::Body) -> Mesh { use object::Body; diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index f651c89a6a..176a7e59dd 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -39,7 +39,6 @@ pub struct FigureMgr { bird_small_states: HashMap>, fish_small_states: HashMap>, biped_large_states: HashMap>, - object_states: HashMap>, } From ada6142c1f9c9c30f9f2be7c630e7c15b275dc76 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 23 Oct 2019 21:10:26 -0400 Subject: [PATCH 07/10] added large bipeds, small birbs, small fish skeletons --- voxygen/src/scene/figure/load.rs | 1 + voxygen/src/scene/figure/mod.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 1fe08b87c5..7de261c8f9 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -1088,6 +1088,7 @@ pub fn mesh_knight_foot_r(foot_r: biped_large::FootR) -> Mesh { ) } + //// pub fn mesh_object(obj: object::Body) -> Mesh { use object::Body; diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 176a7e59dd..254a1c93f6 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -8,7 +8,10 @@ use crate::{ anim::{ self, character::CharacterSkeleton, object::ObjectSkeleton, quadruped::QuadrupedSkeleton, quadrupedmedium::QuadrupedMediumSkeleton, birdmedium::BirdMediumSkeleton, fishmedium::FishMediumSkeleton, dragon::DragonSkeleton, bird_small::BirdSmallSkeleton, fish_small::FishSmallSkeleton, biped_large::BipedLargeSkeleton, Animation, Skeleton, +<<<<<<< HEAD +======= +>>>>>>> added large bipeds, small birbs, small fish skeletons }, render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow}, scene::camera::{Camera, CameraMode}, From 2b5fd372c56b67f18ce101563861c3800f9ff53d Mon Sep 17 00:00:00 2001 From: jshipsey Date: Thu, 24 Oct 2019 21:26:32 -0400 Subject: [PATCH 08/10] streamlined body part naming scheme, swapped quadruped to quadruped_small, rewrote mesh names to reflect body type instead of npckind. finally. --- .../voxygen/voxel/npc/cardinalfish/tail.vox | 3 + .../voxygen/voxel/npc/cardinalfish/torso.vox | 3 + assets/voxygen/voxel/npc/crow/head.vox | 3 + assets/voxygen/voxel/npc/crow/torso.vox | 3 + assets/voxygen/voxel/npc/crow/wing_l.vox | 3 + assets/voxygen/voxel/npc/crow/wing_r.vox | 3 + ...dragon_chest_front.vox => chest_front.vox} | 0 .../{dragon_chest_rear.vox => chest_rear.vox} | 0 .../{dragon_foot_bl.vox => foot_bl.vox} | 0 .../{dragon_foot_br.vox => foot_br.vox} | 0 .../{dragon_foot_fl.vox => foot_fl.vox} | 0 .../{dragon_foot_fr.vox => foot_fr.vox} | 0 .../npc/dragon/{dragon_head.vox => head.vox} | 0 .../{dragon_tail_front.vox => tail_front.vox} | 0 .../{dragon_tail_rear.vox => tail_rear.vox} | 0 .../{dragon_wing_in_l.vox => wing_in_l.vox} | 0 .../{dragon_wing_in_r.vox => wing_in_r.vox} | 0 .../{dragon_wing_out_l.vox => wing_out_l.vox} | 0 .../{dragon_wing_out_r.vox => wing_out_r.vox} | 0 .../npc/duck_m/{duck_m_body.vox => body.vox} | 0 .../npc/duck_m/{duck_m_head.vox => head.vox} | 0 .../duck_m/{duck_m_leg_l.vox => leg_l.vox} | 0 .../duck_m/{duck_m_leg_r.vox => leg_r.vox} | 0 .../npc/duck_m/{duck_m_tail.vox => tail.vox} | 0 .../npc/duck_m/{duck_m_wing.vox => wing.vox} | 0 assets/voxygen/voxel/npc/knight/foot_l.vox | 3 + assets/voxygen/voxel/npc/knight/foot_r.vox | 3 + assets/voxygen/voxel/npc/knight/hand_l.vox | 3 + assets/voxygen/voxel/npc/knight/hand_r.vox | 3 + assets/voxygen/voxel/npc/knight/head.vox | 3 + assets/voxygen/voxel/npc/knight/leg_l.vox | 3 + assets/voxygen/voxel/npc/knight/leg_r.vox | 3 + .../voxygen/voxel/npc/knight/lower_torso.vox | 3 + .../voxygen/voxel/npc/knight/shoulder_l.vox | 3 + .../voxygen/voxel/npc/knight/shoulder_r.vox | 3 + .../voxygen/voxel/npc/knight/torso_upper.vox | 3 + .../marlin/{marlin_fin_l.vox => fin_l.vox} | 0 .../marlin/{marlin_fin_r.vox => fin_r.vox} | 0 .../npc/marlin/{marlin_head.vox => head.vox} | 0 .../npc/marlin/{marlin_rear.vox => rear.vox} | 0 .../npc/marlin/{marlin_tail.vox => tail.vox} | 0 .../marlin/{marlin_torso.vox => torso.vox} | 0 .../pig_purple/{pig_chest.vox => chest.vox} | 0 .../npc/pig_purple/{pig_head.vox => head.vox} | 0 .../pig_purple/{pig_leg_l.vox => leg_l.vox} | 0 .../pig_purple/{pig_leg_r.vox => leg_r.vox} | 0 .../npc/wolf/{wolf_ears.vox => ears.vox} | 0 .../wolf/{wolf_foot_lb.vox => foot_lb.vox} | 0 .../wolf/{wolf_foot_lf.vox => foot_lf.vox} | 0 .../wolf/{wolf_foot_rb.vox => foot_rb.vox} | 0 .../wolf/{wolf_foot_rf.vox => foot_rf.vox} | 0 .../{wolf_head_lower.vox => head_lower.vox} | 0 .../{wolf_head_upper.vox => head_upper.vox} | 0 .../voxel/npc/wolf/{wolf_jaw.vox => jaw.vox} | 0 .../npc/wolf/{wolf_tail.vox => tail.vox} | 0 .../{wolf_torso_back.vox => torso_back.vox} | 0 .../{wolf_torso_mid.vox => torso_mid.vox} | 0 common/src/comp/body.rs | 16 +- common/src/comp/body/biped_large.rs | 2 +- common/src/comp/body/bird_medium.rs | 2 +- common/src/comp/body/bird_small.rs | 1 - common/src/comp/body/dragon.rs | 7 +- common/src/comp/body/fish_medium.rs | 1 - common/src/comp/body/fish_small.rs | 3 +- .../body/{quadruped.rs => quadruped_small.rs} | 0 common/src/comp/mod.rs | 5 +- server/src/cmd.rs | 2 +- voxygen/src/anim/biped_large/idle.rs | 34 +-- voxygen/src/anim/biped_large/jump.rs | 35 +-- voxygen/src/anim/biped_large/mod.rs | 28 +-- voxygen/src/anim/biped_large/run.rs | 34 +-- .../anim/{birdmedium => bird_medium}/idle.rs | 7 +- .../anim/{birdmedium => bird_medium}/jump.rs | 13 +- .../anim/{birdmedium => bird_medium}/mod.rs | 17 +- .../anim/{birdmedium => bird_medium}/run.rs | 12 +- voxygen/src/anim/bird_small/idle.rs | 13 +- voxygen/src/anim/bird_small/jump.rs | 14 +- voxygen/src/anim/bird_small/mod.rs | 12 +- voxygen/src/anim/bird_small/run.rs | 13 +- voxygen/src/anim/dragon/idle.rs | 40 +-- voxygen/src/anim/dragon/jump.rs | 41 +--- voxygen/src/anim/dragon/mod.rs | 60 ++--- voxygen/src/anim/dragon/run.rs | 40 +-- .../anim/{fishmedium => fish_medium}/idle.rs | 7 +- .../anim/{fishmedium => fish_medium}/jump.rs | 11 +- .../anim/{fishmedium => fish_medium}/mod.rs | 16 +- .../anim/{fishmedium => fish_medium}/run.rs | 13 +- voxygen/src/anim/fish_small/idle.rs | 7 +- voxygen/src/anim/fish_small/jump.rs | 8 +- voxygen/src/anim/fish_small/mod.rs | 5 +- voxygen/src/anim/fish_small/run.rs | 7 +- voxygen/src/anim/mod.rs | 16 +- .../idle.rs | 0 .../jump.rs | 0 .../mod.rs | 0 .../run.rs | 0 .../{quadruped => quadruped_small}/idle.rs | 4 +- .../{quadruped => quadruped_small}/jump.rs | 4 +- .../{quadruped => quadruped_small}/mod.rs | 6 +- .../{quadruped => quadruped_small}/run.rs | 4 +- voxygen/src/scene/figure/cache.rs | 96 ++++---- voxygen/src/scene/figure/load.rs | 227 +++++++++--------- voxygen/src/scene/figure/mod.rs | 4 - 103 files changed, 415 insertions(+), 523 deletions(-) create mode 100644 assets/voxygen/voxel/npc/cardinalfish/tail.vox create mode 100644 assets/voxygen/voxel/npc/cardinalfish/torso.vox create mode 100644 assets/voxygen/voxel/npc/crow/head.vox create mode 100644 assets/voxygen/voxel/npc/crow/torso.vox create mode 100644 assets/voxygen/voxel/npc/crow/wing_l.vox create mode 100644 assets/voxygen/voxel/npc/crow/wing_r.vox rename assets/voxygen/voxel/npc/dragon/{dragon_chest_front.vox => chest_front.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_chest_rear.vox => chest_rear.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_foot_bl.vox => foot_bl.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_foot_br.vox => foot_br.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_foot_fl.vox => foot_fl.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_foot_fr.vox => foot_fr.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_head.vox => head.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_tail_front.vox => tail_front.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_tail_rear.vox => tail_rear.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_wing_in_l.vox => wing_in_l.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_wing_in_r.vox => wing_in_r.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_wing_out_l.vox => wing_out_l.vox} (100%) rename assets/voxygen/voxel/npc/dragon/{dragon_wing_out_r.vox => wing_out_r.vox} (100%) rename assets/voxygen/voxel/npc/duck_m/{duck_m_body.vox => body.vox} (100%) rename assets/voxygen/voxel/npc/duck_m/{duck_m_head.vox => head.vox} (100%) rename assets/voxygen/voxel/npc/duck_m/{duck_m_leg_l.vox => leg_l.vox} (100%) rename assets/voxygen/voxel/npc/duck_m/{duck_m_leg_r.vox => leg_r.vox} (100%) rename assets/voxygen/voxel/npc/duck_m/{duck_m_tail.vox => tail.vox} (100%) rename assets/voxygen/voxel/npc/duck_m/{duck_m_wing.vox => wing.vox} (100%) create mode 100644 assets/voxygen/voxel/npc/knight/foot_l.vox create mode 100644 assets/voxygen/voxel/npc/knight/foot_r.vox create mode 100644 assets/voxygen/voxel/npc/knight/hand_l.vox create mode 100644 assets/voxygen/voxel/npc/knight/hand_r.vox create mode 100644 assets/voxygen/voxel/npc/knight/head.vox create mode 100644 assets/voxygen/voxel/npc/knight/leg_l.vox create mode 100644 assets/voxygen/voxel/npc/knight/leg_r.vox create mode 100644 assets/voxygen/voxel/npc/knight/lower_torso.vox create mode 100644 assets/voxygen/voxel/npc/knight/shoulder_l.vox create mode 100644 assets/voxygen/voxel/npc/knight/shoulder_r.vox create mode 100644 assets/voxygen/voxel/npc/knight/torso_upper.vox rename assets/voxygen/voxel/npc/marlin/{marlin_fin_l.vox => fin_l.vox} (100%) rename assets/voxygen/voxel/npc/marlin/{marlin_fin_r.vox => fin_r.vox} (100%) rename assets/voxygen/voxel/npc/marlin/{marlin_head.vox => head.vox} (100%) rename assets/voxygen/voxel/npc/marlin/{marlin_rear.vox => rear.vox} (100%) rename assets/voxygen/voxel/npc/marlin/{marlin_tail.vox => tail.vox} (100%) rename assets/voxygen/voxel/npc/marlin/{marlin_torso.vox => torso.vox} (100%) rename assets/voxygen/voxel/npc/pig_purple/{pig_chest.vox => chest.vox} (100%) rename assets/voxygen/voxel/npc/pig_purple/{pig_head.vox => head.vox} (100%) rename assets/voxygen/voxel/npc/pig_purple/{pig_leg_l.vox => leg_l.vox} (100%) rename assets/voxygen/voxel/npc/pig_purple/{pig_leg_r.vox => leg_r.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_ears.vox => ears.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_foot_lb.vox => foot_lb.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_foot_lf.vox => foot_lf.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_foot_rb.vox => foot_rb.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_foot_rf.vox => foot_rf.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_head_lower.vox => head_lower.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_head_upper.vox => head_upper.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_jaw.vox => jaw.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_tail.vox => tail.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_torso_back.vox => torso_back.vox} (100%) rename assets/voxygen/voxel/npc/wolf/{wolf_torso_mid.vox => torso_mid.vox} (100%) rename common/src/comp/body/{quadruped.rs => quadruped_small.rs} (100%) rename voxygen/src/anim/{birdmedium => bird_medium}/idle.rs (91%) rename voxygen/src/anim/{birdmedium => bird_medium}/jump.rs (85%) rename voxygen/src/anim/{birdmedium => bird_medium}/mod.rs (87%) rename voxygen/src/anim/{birdmedium => bird_medium}/run.rs (87%) rename voxygen/src/anim/{fishmedium => fish_medium}/idle.rs (91%) rename voxygen/src/anim/{fishmedium => fish_medium}/jump.rs (84%) rename voxygen/src/anim/{fishmedium => fish_medium}/mod.rs (86%) rename voxygen/src/anim/{fishmedium => fish_medium}/run.rs (83%) rename voxygen/src/anim/{quadrupedmedium => quadruped_medium}/idle.rs (100%) rename voxygen/src/anim/{quadrupedmedium => quadruped_medium}/jump.rs (100%) rename voxygen/src/anim/{quadrupedmedium => quadruped_medium}/mod.rs (100%) rename voxygen/src/anim/{quadrupedmedium => quadruped_medium}/run.rs (100%) rename voxygen/src/anim/{quadruped => quadruped_small}/idle.rs (96%) rename voxygen/src/anim/{quadruped => quadruped_small}/jump.rs (96%) rename voxygen/src/anim/{quadruped => quadruped_small}/mod.rs (94%) rename voxygen/src/anim/{quadruped => quadruped_small}/run.rs (96%) diff --git a/assets/voxygen/voxel/npc/cardinalfish/tail.vox b/assets/voxygen/voxel/npc/cardinalfish/tail.vox new file mode 100644 index 0000000000..c58fe81db3 --- /dev/null +++ b/assets/voxygen/voxel/npc/cardinalfish/tail.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2d294e515c61b0bce7eb81609e611b24a89d4543a81328cee03b41f22b86980 +size 1320 diff --git a/assets/voxygen/voxel/npc/cardinalfish/torso.vox b/assets/voxygen/voxel/npc/cardinalfish/torso.vox new file mode 100644 index 0000000000..b9ce93fc17 --- /dev/null +++ b/assets/voxygen/voxel/npc/cardinalfish/torso.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f36f0d362133bfaf0a04262abc05d0acbe34949f0b202c5c676fa33adb0fe553 +size 2100 diff --git a/assets/voxygen/voxel/npc/crow/head.vox b/assets/voxygen/voxel/npc/crow/head.vox new file mode 100644 index 0000000000..f14dcf709f --- /dev/null +++ b/assets/voxygen/voxel/npc/crow/head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c427b188ca4275197e9dc80716a0b67d66327d1a095d22ba9333e806c3bb18b +size 1420 diff --git a/assets/voxygen/voxel/npc/crow/torso.vox b/assets/voxygen/voxel/npc/crow/torso.vox new file mode 100644 index 0000000000..c7fc172c57 --- /dev/null +++ b/assets/voxygen/voxel/npc/crow/torso.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c7174b3c97e19dbbd5c5fe5495841e1a0ad0ea2f7ac249440df8ea5d0950beb +size 2900 diff --git a/assets/voxygen/voxel/npc/crow/wing_l.vox b/assets/voxygen/voxel/npc/crow/wing_l.vox new file mode 100644 index 0000000000..757d9ba333 --- /dev/null +++ b/assets/voxygen/voxel/npc/crow/wing_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f5e5670531fabc51dc1f5578c555ee96b2ec19b71df51b662685ed92935ccc2 +size 1292 diff --git a/assets/voxygen/voxel/npc/crow/wing_r.vox b/assets/voxygen/voxel/npc/crow/wing_r.vox new file mode 100644 index 0000000000..757d9ba333 --- /dev/null +++ b/assets/voxygen/voxel/npc/crow/wing_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f5e5670531fabc51dc1f5578c555ee96b2ec19b71df51b662685ed92935ccc2 +size 1292 diff --git a/assets/voxygen/voxel/npc/dragon/dragon_chest_front.vox b/assets/voxygen/voxel/npc/dragon/chest_front.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_chest_front.vox rename to assets/voxygen/voxel/npc/dragon/chest_front.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_chest_rear.vox b/assets/voxygen/voxel/npc/dragon/chest_rear.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_chest_rear.vox rename to assets/voxygen/voxel/npc/dragon/chest_rear.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_foot_bl.vox b/assets/voxygen/voxel/npc/dragon/foot_bl.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_foot_bl.vox rename to assets/voxygen/voxel/npc/dragon/foot_bl.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_foot_br.vox b/assets/voxygen/voxel/npc/dragon/foot_br.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_foot_br.vox rename to assets/voxygen/voxel/npc/dragon/foot_br.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_foot_fl.vox b/assets/voxygen/voxel/npc/dragon/foot_fl.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_foot_fl.vox rename to assets/voxygen/voxel/npc/dragon/foot_fl.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_foot_fr.vox b/assets/voxygen/voxel/npc/dragon/foot_fr.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_foot_fr.vox rename to assets/voxygen/voxel/npc/dragon/foot_fr.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_head.vox b/assets/voxygen/voxel/npc/dragon/head.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_head.vox rename to assets/voxygen/voxel/npc/dragon/head.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_tail_front.vox b/assets/voxygen/voxel/npc/dragon/tail_front.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_tail_front.vox rename to assets/voxygen/voxel/npc/dragon/tail_front.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_tail_rear.vox b/assets/voxygen/voxel/npc/dragon/tail_rear.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_tail_rear.vox rename to assets/voxygen/voxel/npc/dragon/tail_rear.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_wing_in_l.vox b/assets/voxygen/voxel/npc/dragon/wing_in_l.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_wing_in_l.vox rename to assets/voxygen/voxel/npc/dragon/wing_in_l.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_wing_in_r.vox b/assets/voxygen/voxel/npc/dragon/wing_in_r.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_wing_in_r.vox rename to assets/voxygen/voxel/npc/dragon/wing_in_r.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_wing_out_l.vox b/assets/voxygen/voxel/npc/dragon/wing_out_l.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_wing_out_l.vox rename to assets/voxygen/voxel/npc/dragon/wing_out_l.vox diff --git a/assets/voxygen/voxel/npc/dragon/dragon_wing_out_r.vox b/assets/voxygen/voxel/npc/dragon/wing_out_r.vox similarity index 100% rename from assets/voxygen/voxel/npc/dragon/dragon_wing_out_r.vox rename to assets/voxygen/voxel/npc/dragon/wing_out_r.vox diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_body.vox b/assets/voxygen/voxel/npc/duck_m/body.vox similarity index 100% rename from assets/voxygen/voxel/npc/duck_m/duck_m_body.vox rename to assets/voxygen/voxel/npc/duck_m/body.vox diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_head.vox b/assets/voxygen/voxel/npc/duck_m/head.vox similarity index 100% rename from assets/voxygen/voxel/npc/duck_m/duck_m_head.vox rename to assets/voxygen/voxel/npc/duck_m/head.vox diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_leg_l.vox b/assets/voxygen/voxel/npc/duck_m/leg_l.vox similarity index 100% rename from assets/voxygen/voxel/npc/duck_m/duck_m_leg_l.vox rename to assets/voxygen/voxel/npc/duck_m/leg_l.vox diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_leg_r.vox b/assets/voxygen/voxel/npc/duck_m/leg_r.vox similarity index 100% rename from assets/voxygen/voxel/npc/duck_m/duck_m_leg_r.vox rename to assets/voxygen/voxel/npc/duck_m/leg_r.vox diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_tail.vox b/assets/voxygen/voxel/npc/duck_m/tail.vox similarity index 100% rename from assets/voxygen/voxel/npc/duck_m/duck_m_tail.vox rename to assets/voxygen/voxel/npc/duck_m/tail.vox diff --git a/assets/voxygen/voxel/npc/duck_m/duck_m_wing.vox b/assets/voxygen/voxel/npc/duck_m/wing.vox similarity index 100% rename from assets/voxygen/voxel/npc/duck_m/duck_m_wing.vox rename to assets/voxygen/voxel/npc/duck_m/wing.vox diff --git a/assets/voxygen/voxel/npc/knight/foot_l.vox b/assets/voxygen/voxel/npc/knight/foot_l.vox new file mode 100644 index 0000000000..d5946e40ed --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/foot_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ef4829618aa75b7d87bf608eb06c761f03f798912982e2edf971a2999531be8 +size 1388 diff --git a/assets/voxygen/voxel/npc/knight/foot_r.vox b/assets/voxygen/voxel/npc/knight/foot_r.vox new file mode 100644 index 0000000000..83361e2b9e --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/foot_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:634d800724de41dd2755f3c066aa748797aff5c299c620651d736e2a8095772e +size 1388 diff --git a/assets/voxygen/voxel/npc/knight/hand_l.vox b/assets/voxygen/voxel/npc/knight/hand_l.vox new file mode 100644 index 0000000000..d6fb9a604e --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/hand_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:392002386275e85e7fcc9d2174baf9da9d6df8e40818b0aee184c191dfe736a5 +size 1440 diff --git a/assets/voxygen/voxel/npc/knight/hand_r.vox b/assets/voxygen/voxel/npc/knight/hand_r.vox new file mode 100644 index 0000000000..7f297f3cd8 --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/hand_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9257231eac4887eec381a900b743b0b02fae1d626146767b79042c3b6ee135a +size 1432 diff --git a/assets/voxygen/voxel/npc/knight/head.vox b/assets/voxygen/voxel/npc/knight/head.vox new file mode 100644 index 0000000000..70f7667c63 --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4432921d3f584bdcdf5ea47bb89771532bdaa43a0c2bc65d6ba10f61e7a2f123 +size 3524 diff --git a/assets/voxygen/voxel/npc/knight/leg_l.vox b/assets/voxygen/voxel/npc/knight/leg_l.vox new file mode 100644 index 0000000000..8f200e1f5a --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/leg_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b183b026fdee036061550b9b7fa790e5921ae19a7355b1ff6e478f8a2cdfa489 +size 1776 diff --git a/assets/voxygen/voxel/npc/knight/leg_r.vox b/assets/voxygen/voxel/npc/knight/leg_r.vox new file mode 100644 index 0000000000..c60d410e74 --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/leg_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60563e0e3cf012f3da6f3d5069fd3450cf73c7273b3e2ac55082daa5bc1b0f8b +size 1776 diff --git a/assets/voxygen/voxel/npc/knight/lower_torso.vox b/assets/voxygen/voxel/npc/knight/lower_torso.vox new file mode 100644 index 0000000000..e04193bc0b --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/lower_torso.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a9f2658e6da77d24671ea4375f24703714b1d9ed0d6e035dbddefe4fc595393 +size 4260 diff --git a/assets/voxygen/voxel/npc/knight/shoulder_l.vox b/assets/voxygen/voxel/npc/knight/shoulder_l.vox new file mode 100644 index 0000000000..f227e0e4db --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/shoulder_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11e0fcaef237348c3a7d2375f3714d62ee9e0f707a189612f600eac506dffc3e +size 1748 diff --git a/assets/voxygen/voxel/npc/knight/shoulder_r.vox b/assets/voxygen/voxel/npc/knight/shoulder_r.vox new file mode 100644 index 0000000000..624d5be848 --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/shoulder_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f03637a6b4574d0554473e9d971a595ba09053d732beea48d03388c613b558c +size 1748 diff --git a/assets/voxygen/voxel/npc/knight/torso_upper.vox b/assets/voxygen/voxel/npc/knight/torso_upper.vox new file mode 100644 index 0000000000..e4ada8306d --- /dev/null +++ b/assets/voxygen/voxel/npc/knight/torso_upper.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07437596c5a7947da998b5bb53bc87ab4e3bfb4d9f94c1202bf60b8736b67c5c +size 6832 diff --git a/assets/voxygen/voxel/npc/marlin/marlin_fin_l.vox b/assets/voxygen/voxel/npc/marlin/fin_l.vox similarity index 100% rename from assets/voxygen/voxel/npc/marlin/marlin_fin_l.vox rename to assets/voxygen/voxel/npc/marlin/fin_l.vox diff --git a/assets/voxygen/voxel/npc/marlin/marlin_fin_r.vox b/assets/voxygen/voxel/npc/marlin/fin_r.vox similarity index 100% rename from assets/voxygen/voxel/npc/marlin/marlin_fin_r.vox rename to assets/voxygen/voxel/npc/marlin/fin_r.vox diff --git a/assets/voxygen/voxel/npc/marlin/marlin_head.vox b/assets/voxygen/voxel/npc/marlin/head.vox similarity index 100% rename from assets/voxygen/voxel/npc/marlin/marlin_head.vox rename to assets/voxygen/voxel/npc/marlin/head.vox diff --git a/assets/voxygen/voxel/npc/marlin/marlin_rear.vox b/assets/voxygen/voxel/npc/marlin/rear.vox similarity index 100% rename from assets/voxygen/voxel/npc/marlin/marlin_rear.vox rename to assets/voxygen/voxel/npc/marlin/rear.vox diff --git a/assets/voxygen/voxel/npc/marlin/marlin_tail.vox b/assets/voxygen/voxel/npc/marlin/tail.vox similarity index 100% rename from assets/voxygen/voxel/npc/marlin/marlin_tail.vox rename to assets/voxygen/voxel/npc/marlin/tail.vox diff --git a/assets/voxygen/voxel/npc/marlin/marlin_torso.vox b/assets/voxygen/voxel/npc/marlin/torso.vox similarity index 100% rename from assets/voxygen/voxel/npc/marlin/marlin_torso.vox rename to assets/voxygen/voxel/npc/marlin/torso.vox diff --git a/assets/voxygen/voxel/npc/pig_purple/pig_chest.vox b/assets/voxygen/voxel/npc/pig_purple/chest.vox similarity index 100% rename from assets/voxygen/voxel/npc/pig_purple/pig_chest.vox rename to assets/voxygen/voxel/npc/pig_purple/chest.vox diff --git a/assets/voxygen/voxel/npc/pig_purple/pig_head.vox b/assets/voxygen/voxel/npc/pig_purple/head.vox similarity index 100% rename from assets/voxygen/voxel/npc/pig_purple/pig_head.vox rename to assets/voxygen/voxel/npc/pig_purple/head.vox diff --git a/assets/voxygen/voxel/npc/pig_purple/pig_leg_l.vox b/assets/voxygen/voxel/npc/pig_purple/leg_l.vox similarity index 100% rename from assets/voxygen/voxel/npc/pig_purple/pig_leg_l.vox rename to assets/voxygen/voxel/npc/pig_purple/leg_l.vox diff --git a/assets/voxygen/voxel/npc/pig_purple/pig_leg_r.vox b/assets/voxygen/voxel/npc/pig_purple/leg_r.vox similarity index 100% rename from assets/voxygen/voxel/npc/pig_purple/pig_leg_r.vox rename to assets/voxygen/voxel/npc/pig_purple/leg_r.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_ears.vox b/assets/voxygen/voxel/npc/wolf/ears.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_ears.vox rename to assets/voxygen/voxel/npc/wolf/ears.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_foot_lb.vox b/assets/voxygen/voxel/npc/wolf/foot_lb.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_foot_lb.vox rename to assets/voxygen/voxel/npc/wolf/foot_lb.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_foot_lf.vox b/assets/voxygen/voxel/npc/wolf/foot_lf.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_foot_lf.vox rename to assets/voxygen/voxel/npc/wolf/foot_lf.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_foot_rb.vox b/assets/voxygen/voxel/npc/wolf/foot_rb.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_foot_rb.vox rename to assets/voxygen/voxel/npc/wolf/foot_rb.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_foot_rf.vox b/assets/voxygen/voxel/npc/wolf/foot_rf.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_foot_rf.vox rename to assets/voxygen/voxel/npc/wolf/foot_rf.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_head_lower.vox b/assets/voxygen/voxel/npc/wolf/head_lower.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_head_lower.vox rename to assets/voxygen/voxel/npc/wolf/head_lower.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_head_upper.vox b/assets/voxygen/voxel/npc/wolf/head_upper.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_head_upper.vox rename to assets/voxygen/voxel/npc/wolf/head_upper.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_jaw.vox b/assets/voxygen/voxel/npc/wolf/jaw.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_jaw.vox rename to assets/voxygen/voxel/npc/wolf/jaw.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_tail.vox b/assets/voxygen/voxel/npc/wolf/tail.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_tail.vox rename to assets/voxygen/voxel/npc/wolf/tail.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_torso_back.vox b/assets/voxygen/voxel/npc/wolf/torso_back.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_torso_back.vox rename to assets/voxygen/voxel/npc/wolf/torso_back.vox diff --git a/assets/voxygen/voxel/npc/wolf/wolf_torso_mid.vox b/assets/voxygen/voxel/npc/wolf/torso_mid.vox similarity index 100% rename from assets/voxygen/voxel/npc/wolf/wolf_torso_mid.vox rename to assets/voxygen/voxel/npc/wolf/torso_mid.vox diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index c84d74d305..b2ba589b24 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -1,13 +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 bird_medium; -pub mod fish_medium; -pub mod dragon; -pub mod bird_small; -pub mod fish_small; -pub mod biped_large; +pub mod quadruped_small; use specs::{Component, FlaggedStorage}; use specs_idvs::IDVStorage; @@ -15,7 +15,7 @@ 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), diff --git a/common/src/comp/body/biped_large.rs b/common/src/comp/body/biped_large.rs index 41eab2caf7..9e9dc2a3cf 100644 --- a/common/src/comp/body/biped_large.rs +++ b/common/src/comp/body/biped_large.rs @@ -97,4 +97,4 @@ const ALL_FOOT_LS: [FootL; 1] = [FootL::Default]; pub enum FootR { Default, } -const ALL_FOOT_RS: [FootR; 1] = [FootR::Default]; \ No newline at end of file +const ALL_FOOT_RS: [FootR; 1] = [FootR::Default]; diff --git a/common/src/comp/body/bird_medium.rs b/common/src/comp/body/bird_medium.rs index 38a0cc438f..6968b2d2a5 100644 --- a/common/src/comp/body/bird_medium.rs +++ b/common/src/comp/body/bird_medium.rs @@ -65,4 +65,4 @@ const ALL_LEG_LS: [LegL; 1] = [LegL::Default]; pub enum LegR { Default, } -const ALL_LEG_RS: [LegR; 1] = [LegR::Default]; \ No newline at end of file +const ALL_LEG_RS: [LegR; 1] = [LegR::Default]; diff --git a/common/src/comp/body/bird_small.rs b/common/src/comp/body/bird_small.rs index eff28e3119..533613fe3a 100644 --- a/common/src/comp/body/bird_small.rs +++ b/common/src/comp/body/bird_small.rs @@ -31,7 +31,6 @@ pub enum Torso { } const ALL_TORSOS: [Torso; 1] = [Torso::Default]; - #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum WingL { Default, diff --git a/common/src/comp/body/dragon.rs b/common/src/comp/body/dragon.rs index d0b748d6fd..1b777d5aa4 100644 --- a/common/src/comp/body/dragon.rs +++ b/common/src/comp/body/dragon.rs @@ -15,9 +15,6 @@ pub struct Body { pub foot_fr: FootFR, pub foot_bl: FootBL, pub foot_br: FootBR, - - - } impl Body { pub fn random() -> Self { @@ -36,8 +33,6 @@ impl Body { 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(), - - } } } @@ -118,4 +113,4 @@ const ALL_FOOT_BLS: [FootBL; 1] = [FootBL::Default]; pub enum FootBR { Default, } -const ALL_FOOT_BRS: [FootBR; 1] = [FootBR::Default]; \ No newline at end of file +const ALL_FOOT_BRS: [FootBR; 1] = [FootBR::Default]; diff --git a/common/src/comp/body/fish_medium.rs b/common/src/comp/body/fish_medium.rs index 7da9bce91f..6d1c92a5f3 100644 --- a/common/src/comp/body/fish_medium.rs +++ b/common/src/comp/body/fish_medium.rs @@ -19,7 +19,6 @@ impl Body { 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(), - } } } diff --git a/common/src/comp/body/fish_small.rs b/common/src/comp/body/fish_small.rs index 0b5ba39ea7..6d0150de43 100644 --- a/common/src/comp/body/fish_small.rs +++ b/common/src/comp/body/fish_small.rs @@ -15,7 +15,6 @@ impl Body { } } - #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum Torso { Default, @@ -26,4 +25,4 @@ const ALL_TORSOS: [Torso; 1] = [Torso::Default]; pub enum Tail { Default, } -const ALL_TAILS: [Tail; 1] = [Tail::Default]; \ No newline at end of file +const ALL_TAILS: [Tail; 1] = [Tail::Default]; diff --git a/common/src/comp/body/quadruped.rs b/common/src/comp/body/quadruped_small.rs similarity index 100% rename from common/src/comp/body/quadruped.rs rename to common/src/comp/body/quadruped_small.rs diff --git a/common/src/comp/mod.rs b/common/src/comp/mod.rs index 572d5eb0e6..fa13636e02 100644 --- a/common/src/comp/mod.rs +++ b/common/src/comp/mod.rs @@ -16,7 +16,10 @@ mod visual; // Reexports pub use admin::Admin; pub use agent::Agent; -pub use body::{humanoid, object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, bird_small, fish_small, biped_large, 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, diff --git a/server/src/cmd.rs b/server/src/cmd.rs index 0b967a36db..7f8bf53b55 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -553,7 +553,7 @@ fn alignment_to_agent(alignment: &str, target: EcsEntity) -> Option 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()), } } diff --git a/voxygen/src/anim/biped_large/idle.rs b/voxygen/src/anim/biped_large/idle.rs index 09be0204ac..0fced4adc8 100644 --- a/voxygen/src/anim/biped_large/idle.rs +++ b/voxygen/src/anim/biped_large/idle.rs @@ -38,60 +38,48 @@ impl Animation for IdleAnimation { * 0.25, ); - next.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_head.scale = Vec3::one() / 10.88; next.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_upper_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_upper_torso.scale = Vec3::one() / 10.88; next.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_lower_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_lower_torso.scale = Vec3::one() / 10.88; next.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_shoulder_l.scale = Vec3::one() / 10.88; next.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_shoulder_r.scale = Vec3::one() / 10.88; next.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_hand_l.scale = Vec3::one() / 10.88; next.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_hand_r.scale = Vec3::one() / 10.88; next.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_leg_l.scale = Vec3::one() / 10.88; next.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_leg_r.scale = Vec3::one() / 10.88; next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_foot_l.scale = Vec3::one() / 10.88; next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_foot_r.scale = Vec3::one() / 10.88; next } diff --git a/voxygen/src/anim/biped_large/jump.rs b/voxygen/src/anim/biped_large/jump.rs index 1745bad157..31e554cad8 100644 --- a/voxygen/src/anim/biped_large/jump.rs +++ b/voxygen/src/anim/biped_large/jump.rs @@ -25,61 +25,48 @@ impl Animation for JumpAnimation { let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - - next.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_head.scale = Vec3::one() / 10.88; next.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_upper_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_upper_torso.scale = Vec3::one() / 10.88; next.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_lower_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_lower_torso.scale = Vec3::one() / 10.88; next.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_shoulder_l.scale = Vec3::one() / 10.88; next.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_shoulder_r.scale = Vec3::one() / 10.88; next.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_hand_l.scale = Vec3::one() / 10.88; next.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_hand_r.scale = Vec3::one() / 10.88; next.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_leg_l.scale = Vec3::one() / 10.88; next.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_leg_r.scale = Vec3::one() / 10.88; next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_foot_l.scale = Vec3::one() / 10.88; next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_foot_r.scale = Vec3::one() / 10.88; next } diff --git a/voxygen/src/anim/biped_large/mod.rs b/voxygen/src/anim/biped_large/mod.rs index fc2c7c65f9..0843554a2f 100644 --- a/voxygen/src/anim/biped_large/mod.rs +++ b/voxygen/src/anim/biped_large/mod.rs @@ -23,9 +23,6 @@ pub struct BipedLargeSkeleton { knight_leg_r: Bone, knight_foot_l: Bone, knight_foot_r: Bone, - - - } impl BipedLargeSkeleton { @@ -42,7 +39,6 @@ impl BipedLargeSkeleton { knight_leg_r: Bone::default(), knight_foot_l: Bone::default(), knight_foot_r: Bone::default(), - } } } @@ -55,17 +51,18 @@ impl Skeleton for BipedLargeSkeleton { let leg_l_mat = self.knight_leg_l.compute_base_matrix(); let leg_r_mat = self.knight_leg_r.compute_base_matrix(); - [ FigureBoneData::new(self.knight_head.compute_base_matrix()), - FigureBoneData::new( - upper_torso_mat, - ), + FigureBoneData::new(upper_torso_mat), FigureBoneData::new(self.knight_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.knight_hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat), - FigureBoneData::new(self.knight_hand_r.compute_base_matrix() * shoulder_r_mat * upper_torso_mat), + FigureBoneData::new( + self.knight_hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat, + ), + FigureBoneData::new( + self.knight_hand_r.compute_base_matrix() * shoulder_r_mat * upper_torso_mat, + ), FigureBoneData::new(leg_l_mat), FigureBoneData::new(leg_r_mat), FigureBoneData::new(self.knight_foot_l.compute_base_matrix() * leg_l_mat), @@ -79,12 +76,13 @@ impl Skeleton for BipedLargeSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.knight_head - .interpolate(&target.knight_head, dt); - self.knight_upper_torso.interpolate(&target.knight_upper_torso, dt); + self.knight_head.interpolate(&target.knight_head, dt); + self.knight_upper_torso + .interpolate(&target.knight_upper_torso, dt); self.knight_lower_torso .interpolate(&target.knight_lower_torso, dt); - self.knight_shoulder_l.interpolate(&target.knight_shoulder_l, dt); + self.knight_shoulder_l + .interpolate(&target.knight_shoulder_l, dt); self.knight_shoulder_r .interpolate(&target.knight_shoulder_r, dt); self.knight_hand_l.interpolate(&target.knight_hand_l, dt); @@ -93,7 +91,5 @@ impl Skeleton for BipedLargeSkeleton { self.knight_leg_r.interpolate(&target.knight_leg_r, dt); self.knight_foot_l.interpolate(&target.knight_foot_l, dt); self.knight_foot_r.interpolate(&target.knight_foot_r, dt); - - } } diff --git a/voxygen/src/anim/biped_large/run.rs b/voxygen/src/anim/biped_large/run.rs index 3e92091d9a..17c532713a 100644 --- a/voxygen/src/anim/biped_large/run.rs +++ b/voxygen/src/anim/biped_large/run.rs @@ -38,60 +38,48 @@ impl Animation for RunAnimation { * 0.25, ); - next.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_head.scale = Vec3::one() / 10.88; next.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_upper_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_upper_torso.scale = Vec3::one() / 10.88; next.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_lower_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_lower_torso.scale = Vec3::one() / 10.88; next.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_shoulder_l.scale = Vec3::one() / 10.88; next.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_shoulder_r.scale = Vec3::one() / 10.88; next.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_hand_l.scale = Vec3::one() / 10.88; next.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_hand_r.scale = Vec3::one() / 10.88; next.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_leg_l.scale = Vec3::one() / 10.88; next.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_leg_r.scale = Vec3::one() / 10.88; next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_foot_l.scale = Vec3::one() / 10.88; next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.knight_foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.knight_foot_r.scale = Vec3::one() / 10.88; next } diff --git a/voxygen/src/anim/birdmedium/idle.rs b/voxygen/src/anim/bird_medium/idle.rs similarity index 91% rename from voxygen/src/anim/birdmedium/idle.rs rename to voxygen/src/anim/bird_medium/idle.rs index b3770c6142..b8d57b912a 100644 --- a/voxygen/src/anim/birdmedium/idle.rs +++ b/voxygen/src/anim/bird_medium/idle.rs @@ -38,14 +38,12 @@ impl Animation for IdleAnimation { * 0.25, ); - next.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; next.duck_m_head.ori = Quaternion::rotation_z(duck_m_look.x) * Quaternion::rotation_x(duck_m_look.y); next.duck_m_head.scale = Vec3::one() / 10.88; - next.duck_m_torso.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.duck_m_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.duck_m_torso.ori = Quaternion::rotation_x(0.0); next.duck_m_torso.scale = Vec3::one() * 1.01; @@ -54,8 +52,7 @@ impl Animation for IdleAnimation { next.duck_m_tail.scale = Vec3::one() * 0.98; next.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0); + next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.duck_m_wing_l.scale = Vec3::one() / 11.0; next.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; diff --git a/voxygen/src/anim/birdmedium/jump.rs b/voxygen/src/anim/bird_medium/jump.rs similarity index 85% rename from voxygen/src/anim/birdmedium/jump.rs rename to voxygen/src/anim/bird_medium/jump.rs index 191412c2d5..5ceef62a59 100644 --- a/voxygen/src/anim/birdmedium/jump.rs +++ b/voxygen/src/anim/bird_medium/jump.rs @@ -25,15 +25,11 @@ impl Animation for JumpAnimation { let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - - next.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.duck_m_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.duck_m_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.duck_m_head.scale = Vec3::one() / 10.88; - next.duck_m_torso.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.duck_m_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.duck_m_torso.ori = Quaternion::rotation_x(0.0); next.duck_m_torso.scale = Vec3::one() * 1.01; @@ -42,8 +38,7 @@ impl Animation for JumpAnimation { next.duck_m_tail.scale = Vec3::one() * 0.98; next.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0); + next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.duck_m_wing_l.scale = Vec3::one() / 11.0; next.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; @@ -59,4 +54,4 @@ impl Animation for JumpAnimation { next.duck_m_leg_r.scale = Vec3::one() * 1.00; next } -} \ No newline at end of file +} diff --git a/voxygen/src/anim/birdmedium/mod.rs b/voxygen/src/anim/bird_medium/mod.rs similarity index 87% rename from voxygen/src/anim/birdmedium/mod.rs rename to voxygen/src/anim/bird_medium/mod.rs index 53292603ba..3cbe7e0fc6 100644 --- a/voxygen/src/anim/birdmedium/mod.rs +++ b/voxygen/src/anim/bird_medium/mod.rs @@ -19,7 +19,6 @@ pub struct BirdMediumSkeleton { duck_m_wing_r: Bone, duck_m_leg_l: Bone, duck_m_leg_r: Bone, - } impl BirdMediumSkeleton { @@ -32,8 +31,6 @@ impl BirdMediumSkeleton { duck_m_wing_r: Bone::default(), duck_m_leg_l: Bone::default(), duck_m_leg_r: Bone::default(), - - } } } @@ -42,12 +39,9 @@ impl Skeleton for BirdMediumSkeleton { fn compute_matrices(&self) -> [FigureBoneData; 16] { let torso_mat = self.duck_m_torso.compute_base_matrix(); - [ FigureBoneData::new(self.duck_m_head.compute_base_matrix() * torso_mat), - FigureBoneData::new( - torso_mat, - ), + FigureBoneData::new(torso_mat), FigureBoneData::new(self.duck_m_tail.compute_base_matrix() * torso_mat), FigureBoneData::new(self.duck_m_wing_l.compute_base_matrix() * torso_mat), FigureBoneData::new(self.duck_m_wing_r.compute_base_matrix() * torso_mat), @@ -66,14 +60,11 @@ impl Skeleton for BirdMediumSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.duck_m_head - .interpolate(&target.duck_m_head, dt); + self.duck_m_head.interpolate(&target.duck_m_head, dt); self.duck_m_torso.interpolate(&target.duck_m_torso, dt); - self.duck_m_tail - .interpolate(&target.duck_m_tail, dt); + self.duck_m_tail.interpolate(&target.duck_m_tail, dt); self.duck_m_wing_l.interpolate(&target.duck_m_wing_l, dt); - self.duck_m_wing_r - .interpolate(&target.duck_m_wing_r, dt); + self.duck_m_wing_r.interpolate(&target.duck_m_wing_r, dt); self.duck_m_leg_l.interpolate(&target.duck_m_leg_l, dt); self.duck_m_leg_r.interpolate(&target.duck_m_leg_r, dt); } diff --git a/voxygen/src/anim/birdmedium/run.rs b/voxygen/src/anim/bird_medium/run.rs similarity index 87% rename from voxygen/src/anim/birdmedium/run.rs rename to voxygen/src/anim/bird_medium/run.rs index ac940f6ae7..e2609673bd 100644 --- a/voxygen/src/anim/birdmedium/run.rs +++ b/voxygen/src/anim/bird_medium/run.rs @@ -38,14 +38,11 @@ impl Animation for RunAnimation { * 0.25, ); - next.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.duck_m_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.duck_m_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.duck_m_head.scale = Vec3::one() / 10.88; - next.duck_m_torso.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.duck_m_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.duck_m_torso.ori = Quaternion::rotation_x(0.0); next.duck_m_torso.scale = Vec3::one() * 1.01; @@ -54,8 +51,7 @@ impl Animation for RunAnimation { next.duck_m_tail.scale = Vec3::one() * 0.98; next.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0); + next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.duck_m_wing_l.scale = Vec3::one() / 11.0; next.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; @@ -71,4 +67,4 @@ impl Animation for RunAnimation { next.duck_m_leg_r.scale = Vec3::one() * 1.00; next } -} \ No newline at end of file +} diff --git a/voxygen/src/anim/bird_small/idle.rs b/voxygen/src/anim/bird_small/idle.rs index 8b2fdd9e27..209a95bc1d 100644 --- a/voxygen/src/anim/bird_small/idle.rs +++ b/voxygen/src/anim/bird_small/idle.rs @@ -38,25 +38,20 @@ impl Animation for IdleAnimation { * 0.25, ); - next.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_head.scale = Vec3::one() / 10.88; next.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_torso.scale = Vec3::one() / 10.88; next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_wing_l.scale = Vec3::one() / 10.88; next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_wing_r.scale = Vec3::one() / 10.88; next diff --git a/voxygen/src/anim/bird_small/jump.rs b/voxygen/src/anim/bird_small/jump.rs index f2d9eb928f..726ebc2987 100644 --- a/voxygen/src/anim/bird_small/jump.rs +++ b/voxygen/src/anim/bird_small/jump.rs @@ -25,26 +25,20 @@ impl Animation for JumpAnimation { let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - - next.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_head.scale = Vec3::one() / 10.88; next.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_torso.scale = Vec3::one() / 10.88; next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_wing_l.scale = Vec3::one() / 10.88; next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_wing_r.scale = Vec3::one() / 10.88; next diff --git a/voxygen/src/anim/bird_small/mod.rs b/voxygen/src/anim/bird_small/mod.rs index 472c861eea..6755f3a4f1 100644 --- a/voxygen/src/anim/bird_small/mod.rs +++ b/voxygen/src/anim/bird_small/mod.rs @@ -25,7 +25,6 @@ impl BirdSmallSkeleton { crow_torso: Bone::default(), crow_wing_l: Bone::default(), crow_wing_r: Bone::default(), - } } } @@ -34,12 +33,9 @@ impl Skeleton for BirdSmallSkeleton { fn compute_matrices(&self) -> [FigureBoneData; 16] { let torso_mat = self.crow_torso.compute_base_matrix(); - [ FigureBoneData::new(self.crow_head.compute_base_matrix() * torso_mat), - FigureBoneData::new( - torso_mat, - ), + FigureBoneData::new(torso_mat), FigureBoneData::new(self.crow_wing_l.compute_base_matrix() * torso_mat), FigureBoneData::new(self.crow_wing_r.compute_base_matrix() * torso_mat), FigureBoneData::default(), @@ -58,11 +54,9 @@ impl Skeleton for BirdSmallSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.crow_head - .interpolate(&target.crow_head, dt); + self.crow_head.interpolate(&target.crow_head, dt); self.crow_torso.interpolate(&target.crow_torso, dt); self.crow_wing_l.interpolate(&target.crow_wing_l, dt); - self.crow_wing_r - .interpolate(&target.crow_wing_r, dt); + self.crow_wing_r.interpolate(&target.crow_wing_r, dt); } } diff --git a/voxygen/src/anim/bird_small/run.rs b/voxygen/src/anim/bird_small/run.rs index 3a4fb0fc98..a11271c81d 100644 --- a/voxygen/src/anim/bird_small/run.rs +++ b/voxygen/src/anim/bird_small/run.rs @@ -38,25 +38,20 @@ impl Animation for RunAnimation { * 0.25, ); - next.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_head.scale = Vec3::one() / 10.88; next.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_torso.scale = Vec3::one() / 10.88; next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_l.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_wing_l.scale = Vec3::one() / 10.88; next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_r.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.crow_wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.crow_wing_r.scale = Vec3::one() / 10.88; next diff --git a/voxygen/src/anim/dragon/idle.rs b/voxygen/src/anim/dragon/idle.rs index 1d4df279a3..967f8baa9f 100644 --- a/voxygen/src/anim/dragon/idle.rs +++ b/voxygen/src/anim/dragon/idle.rs @@ -38,69 +38,55 @@ impl Animation for IdleAnimation { * 0.25, ); - next.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.dragon_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.dragon_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.dragon_head.scale = Vec3::one() / 10.88; - next.dragon_chest_front.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_chest_front.ori = Quaternion::rotation_x(0.0); next.dragon_chest_front.scale = Vec3::one() * 1.01; - next.dragon_chest_rear.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0); next.dragon_chest_rear.scale = Vec3::one() * 1.01; - next.dragon_tail_front.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_tail_front.ori = Quaternion::rotation_x(0.0); next.dragon_tail_front.scale = Vec3::one() * 1.01; - next.dragon_tail_rear.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0); next.dragon_tail_rear.scale = Vec3::one() * 1.01; - next.dragon_wing_in_l.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0); next.dragon_wing_in_l.scale = Vec3::one() * 1.01; - next.dragon_wing_in_r.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0); next.dragon_wing_in_r.scale = Vec3::one() * 1.01; - next.dragon_wing_out_l.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0); next.dragon_wing_out_l.scale = Vec3::one() * 1.01; - next.dragon_wing_out_r.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0); next.dragon_wing_out_r.scale = Vec3::one() * 1.01; - next.dragon_foot_fl.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0); next.dragon_foot_fl.scale = Vec3::one() * 1.01; - next.dragon_foot_fr.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fr.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0); next.dragon_foot_fr.scale = Vec3::one() * 1.01; - next.dragon_foot_bl.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_bl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0); next.dragon_foot_bl.scale = Vec3::one() * 1.01; - next.dragon_foot_br.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_br.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_br.ori = Quaternion::rotation_x(0.0); next.dragon_foot_br.scale = Vec3::one() * 1.01; next diff --git a/voxygen/src/anim/dragon/jump.rs b/voxygen/src/anim/dragon/jump.rs index 6b94bd54cd..daccdcfa79 100644 --- a/voxygen/src/anim/dragon/jump.rs +++ b/voxygen/src/anim/dragon/jump.rs @@ -25,70 +25,55 @@ impl Animation for JumpAnimation { let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - - next.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.dragon_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.dragon_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.dragon_head.scale = Vec3::one() / 10.88; - next.dragon_chest_front.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_chest_front.ori = Quaternion::rotation_x(0.0); next.dragon_chest_front.scale = Vec3::one() * 1.01; - next.dragon_chest_rear.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0); next.dragon_chest_rear.scale = Vec3::one() * 1.01; - next.dragon_tail_front.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_tail_front.ori = Quaternion::rotation_x(0.0); next.dragon_tail_front.scale = Vec3::one() * 1.01; - next.dragon_tail_rear.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0); next.dragon_tail_rear.scale = Vec3::one() * 1.01; - next.dragon_wing_in_l.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0); next.dragon_wing_in_l.scale = Vec3::one() * 1.01; - next.dragon_wing_in_r.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0); next.dragon_wing_in_r.scale = Vec3::one() * 1.01; - next.dragon_wing_out_l.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0); next.dragon_wing_out_l.scale = Vec3::one() * 1.01; - next.dragon_wing_out_r.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0); next.dragon_wing_out_r.scale = Vec3::one() * 1.01; - next.dragon_foot_fl.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0); next.dragon_foot_fl.scale = Vec3::one() * 1.01; - next.dragon_foot_fr.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fr.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0); next.dragon_foot_fr.scale = Vec3::one() * 1.01; - next.dragon_foot_bl.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_bl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0); next.dragon_foot_bl.scale = Vec3::one() * 1.01; - next.dragon_foot_br.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_br.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_br.ori = Quaternion::rotation_x(0.0); next.dragon_foot_br.scale = Vec3::one() * 1.01; next diff --git a/voxygen/src/anim/dragon/mod.rs b/voxygen/src/anim/dragon/mod.rs index 139cfd6bec..5a39eeffe5 100644 --- a/voxygen/src/anim/dragon/mod.rs +++ b/voxygen/src/anim/dragon/mod.rs @@ -25,27 +25,24 @@ pub struct DragonSkeleton { dragon_foot_fr: Bone, dragon_foot_bl: Bone, dragon_foot_br: Bone, - } impl DragonSkeleton { pub fn new() -> Self { Self { - dragon_head: Bone::default(), - dragon_chest_front: Bone::default(), - dragon_chest_rear: Bone::default(), - dragon_tail_front: Bone::default(), - dragon_tail_rear: Bone::default(), - dragon_wing_in_l: Bone::default(), - dragon_wing_in_r: Bone::default(), - dragon_wing_out_l: Bone::default(), - dragon_wing_out_r: Bone::default(), - dragon_foot_fl: Bone::default(), - dragon_foot_fr: Bone::default(), - dragon_foot_bl: Bone::default(), - dragon_foot_br: Bone::default(), - - + dragon_head: Bone::default(), + dragon_chest_front: Bone::default(), + dragon_chest_rear: Bone::default(), + dragon_tail_front: Bone::default(), + dragon_tail_rear: Bone::default(), + dragon_wing_in_l: Bone::default(), + dragon_wing_in_r: Bone::default(), + dragon_wing_out_l: Bone::default(), + dragon_wing_out_r: Bone::default(), + dragon_foot_fl: Bone::default(), + dragon_foot_fr: Bone::default(), + dragon_foot_bl: Bone::default(), + dragon_foot_br: Bone::default(), } } } @@ -57,12 +54,9 @@ impl Skeleton for DragonSkeleton { let wing_in_r_mat = self.dragon_wing_in_r.compute_base_matrix(); let tail_front_mat = self.dragon_tail_front.compute_base_matrix(); - [ FigureBoneData::new(self.dragon_head.compute_base_matrix() * chest_front_mat), - FigureBoneData::new( - chest_front_mat, - ), + FigureBoneData::new(chest_front_mat), FigureBoneData::new(self.dragon_chest_rear.compute_base_matrix() * chest_front_mat), FigureBoneData::new(tail_front_mat), FigureBoneData::new(self.dragon_tail_rear.compute_base_matrix() * tail_front_mat), @@ -82,19 +76,25 @@ impl Skeleton for DragonSkeleton { fn interpolate(&mut self, target: &Self, dt: f32) { self.dragon_head.interpolate(&target.dragon_head, dt); - self.dragon_chest_front.interpolate(&target.dragon_chest_front, dt); - self.dragon_chest_rear.interpolate(&target.dragon_chest_rear, dt); - self.dragon_tail_front.interpolate(&target.dragon_tail_front, dt); - self.dragon_tail_rear.interpolate(&target.dragon_tail_rear, dt); - self.dragon_wing_in_l.interpolate(&target.dragon_wing_in_l, dt); - self.dragon_wing_in_r.interpolate(&target.dragon_wing_in_r, dt); - self.dragon_wing_out_l.interpolate(&target.dragon_wing_out_l, dt); - self.dragon_wing_out_r.interpolate(&target.dragon_wing_out_r, dt); + self.dragon_chest_front + .interpolate(&target.dragon_chest_front, dt); + self.dragon_chest_rear + .interpolate(&target.dragon_chest_rear, dt); + self.dragon_tail_front + .interpolate(&target.dragon_tail_front, dt); + self.dragon_tail_rear + .interpolate(&target.dragon_tail_rear, dt); + self.dragon_wing_in_l + .interpolate(&target.dragon_wing_in_l, dt); + self.dragon_wing_in_r + .interpolate(&target.dragon_wing_in_r, dt); + self.dragon_wing_out_l + .interpolate(&target.dragon_wing_out_l, dt); + self.dragon_wing_out_r + .interpolate(&target.dragon_wing_out_r, dt); self.dragon_foot_fl.interpolate(&target.dragon_foot_fl, dt); self.dragon_foot_fr.interpolate(&target.dragon_foot_fr, dt); self.dragon_foot_bl.interpolate(&target.dragon_foot_bl, dt); self.dragon_foot_br.interpolate(&target.dragon_foot_br, dt); - - } } diff --git a/voxygen/src/anim/dragon/run.rs b/voxygen/src/anim/dragon/run.rs index 9c053fb3a7..d3da869934 100644 --- a/voxygen/src/anim/dragon/run.rs +++ b/voxygen/src/anim/dragon/run.rs @@ -38,69 +38,55 @@ impl Animation for RunAnimation { * 0.25, ); - next.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.dragon_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.dragon_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.dragon_head.scale = Vec3::one() / 10.88; - next.dragon_chest_front.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_chest_front.ori = Quaternion::rotation_x(0.0); next.dragon_chest_front.scale = Vec3::one() * 1.01; - next.dragon_chest_rear.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_chest_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0); next.dragon_chest_rear.scale = Vec3::one() * 1.01; - next.dragon_tail_front.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_tail_front.ori = Quaternion::rotation_x(0.0); next.dragon_tail_front.scale = Vec3::one() * 1.01; - next.dragon_tail_rear.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_tail_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0); next.dragon_tail_rear.scale = Vec3::one() * 1.01; - next.dragon_wing_in_l.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0); next.dragon_wing_in_l.scale = Vec3::one() * 1.01; - next.dragon_wing_in_r.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_in_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0); next.dragon_wing_in_r.scale = Vec3::one() * 1.01; - next.dragon_wing_out_l.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0); next.dragon_wing_out_l.scale = Vec3::one() * 1.01; - next.dragon_wing_out_r.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_wing_out_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0); next.dragon_wing_out_r.scale = Vec3::one() * 1.01; - next.dragon_foot_fl.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0); next.dragon_foot_fl.scale = Vec3::one() * 1.01; - next.dragon_foot_fr.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_fr.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0); next.dragon_foot_fr.scale = Vec3::one() * 1.01; - next.dragon_foot_bl.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_bl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0); next.dragon_foot_bl.scale = Vec3::one() * 1.01; - next.dragon_foot_br.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.dragon_foot_br.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.dragon_foot_br.ori = Quaternion::rotation_x(0.0); next.dragon_foot_br.scale = Vec3::one() * 1.01; next diff --git a/voxygen/src/anim/fishmedium/idle.rs b/voxygen/src/anim/fish_medium/idle.rs similarity index 91% rename from voxygen/src/anim/fishmedium/idle.rs rename to voxygen/src/anim/fish_medium/idle.rs index 2b04526f34..a960d839e2 100644 --- a/voxygen/src/anim/fishmedium/idle.rs +++ b/voxygen/src/anim/fish_medium/idle.rs @@ -38,14 +38,12 @@ impl Animation for IdleAnimation { * 0.25, ); - next.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; next.marlin_head.ori = Quaternion::rotation_z(duck_m_look.x) * Quaternion::rotation_x(duck_m_look.y); next.marlin_head.scale = Vec3::one() / 10.88; - next.marlin_torso.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.marlin_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.marlin_torso.ori = Quaternion::rotation_x(0.0); next.marlin_torso.scale = Vec3::one() * 1.01; @@ -54,8 +52,7 @@ impl Animation for IdleAnimation { next.marlin_rear.scale = Vec3::one() * 0.98; next.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.marlin_tail.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0); + next.marlin_tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.marlin_tail.scale = Vec3::one() / 11.0; next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; diff --git a/voxygen/src/anim/fishmedium/jump.rs b/voxygen/src/anim/fish_medium/jump.rs similarity index 84% rename from voxygen/src/anim/fishmedium/jump.rs rename to voxygen/src/anim/fish_medium/jump.rs index cb817e502b..fe91b5b29a 100644 --- a/voxygen/src/anim/fishmedium/jump.rs +++ b/voxygen/src/anim/fish_medium/jump.rs @@ -25,15 +25,11 @@ impl Animation for JumpAnimation { let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - - next.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.marlin_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.marlin_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.marlin_head.scale = Vec3::one() / 10.88; - next.marlin_torso.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.marlin_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.marlin_torso.ori = Quaternion::rotation_x(0.0); next.marlin_torso.scale = Vec3::one() * 1.01; @@ -42,8 +38,7 @@ impl Animation for JumpAnimation { next.marlin_rear.scale = Vec3::one() * 0.98; next.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.marlin_tail.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0); + next.marlin_tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.marlin_tail.scale = Vec3::one() / 11.0; next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; diff --git a/voxygen/src/anim/fishmedium/mod.rs b/voxygen/src/anim/fish_medium/mod.rs similarity index 86% rename from voxygen/src/anim/fishmedium/mod.rs rename to voxygen/src/anim/fish_medium/mod.rs index 6689dbea3a..3b7b93fd5d 100644 --- a/voxygen/src/anim/fishmedium/mod.rs +++ b/voxygen/src/anim/fish_medium/mod.rs @@ -18,7 +18,6 @@ pub struct FishMediumSkeleton { marlin_tail: Bone, marlin_fin_l: Bone, marlin_fin_r: Bone, - } impl FishMediumSkeleton { @@ -30,7 +29,6 @@ impl FishMediumSkeleton { marlin_tail: Bone::default(), marlin_fin_l: Bone::default(), marlin_fin_r: Bone::default(), - } } } @@ -40,12 +38,9 @@ impl Skeleton for FishMediumSkeleton { let torso_mat = self.marlin_torso.compute_base_matrix(); let rear_mat = self.marlin_rear.compute_base_matrix(); - [ FigureBoneData::new(self.marlin_head.compute_base_matrix() * torso_mat), - FigureBoneData::new( - torso_mat, - ), + FigureBoneData::new(torso_mat), FigureBoneData::new(rear_mat * torso_mat), FigureBoneData::new(self.marlin_tail.compute_base_matrix() * rear_mat), FigureBoneData::new(self.marlin_fin_l.compute_base_matrix() * rear_mat), @@ -64,14 +59,11 @@ impl Skeleton for FishMediumSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.marlin_head - .interpolate(&target.marlin_head, dt); + self.marlin_head.interpolate(&target.marlin_head, dt); self.marlin_torso.interpolate(&target.marlin_torso, dt); - self.marlin_rear - .interpolate(&target.marlin_rear, dt); + self.marlin_rear.interpolate(&target.marlin_rear, dt); self.marlin_tail.interpolate(&target.marlin_tail, dt); - self.marlin_fin_l - .interpolate(&target.marlin_fin_l, dt); + self.marlin_fin_l.interpolate(&target.marlin_fin_l, dt); self.marlin_fin_r.interpolate(&target.marlin_fin_r, dt); } } diff --git a/voxygen/src/anim/fishmedium/run.rs b/voxygen/src/anim/fish_medium/run.rs similarity index 83% rename from voxygen/src/anim/fishmedium/run.rs rename to voxygen/src/anim/fish_medium/run.rs index 0f1e92743f..5c97c3c4d7 100644 --- a/voxygen/src/anim/fishmedium/run.rs +++ b/voxygen/src/anim/fish_medium/run.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, FishMediumSkeleton, }; -use std::{f32::consts::PI}; +use std::f32::consts::PI; use vek::*; pub struct RunAnimation; @@ -25,15 +25,11 @@ impl Animation for RunAnimation { let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - - next.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.marlin_head.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.marlin_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.marlin_head.scale = Vec3::one() / 10.88; - next.marlin_torso.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.marlin_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.marlin_torso.ori = Quaternion::rotation_x(0.0); next.marlin_torso.scale = Vec3::one() * 1.01; @@ -42,8 +38,7 @@ impl Animation for RunAnimation { next.marlin_rear.scale = Vec3::one() * 0.98; next.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.marlin_tail.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0); + next.marlin_tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.marlin_tail.scale = Vec3::one() / 11.0; next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; diff --git a/voxygen/src/anim/fish_small/idle.rs b/voxygen/src/anim/fish_small/idle.rs index 1ca41f58ae..797a7f3416 100644 --- a/voxygen/src/anim/fish_small/idle.rs +++ b/voxygen/src/anim/fish_small/idle.rs @@ -38,14 +38,11 @@ impl Animation for IdleAnimation { * 0.25, ); - next.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.cardinalfish_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.cardinalfish_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.cardinalfish_torso.scale = Vec3::one() / 10.88; - next.cardinalfish_tail.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.cardinalfish_tail.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0); next.cardinalfish_tail.scale = Vec3::one() * 1.01; diff --git a/voxygen/src/anim/fish_small/jump.rs b/voxygen/src/anim/fish_small/jump.rs index d48dccec67..844ea0408d 100644 --- a/voxygen/src/anim/fish_small/jump.rs +++ b/voxygen/src/anim/fish_small/jump.rs @@ -25,15 +25,11 @@ impl Animation for JumpAnimation { let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - - next.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.cardinalfish_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.cardinalfish_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.cardinalfish_torso.scale = Vec3::one() / 10.88; - next.cardinalfish_tail.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.cardinalfish_tail.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0); next.cardinalfish_tail.scale = Vec3::one() * 1.01; diff --git a/voxygen/src/anim/fish_small/mod.rs b/voxygen/src/anim/fish_small/mod.rs index 00b25e90ea..1164594bda 100644 --- a/voxygen/src/anim/fish_small/mod.rs +++ b/voxygen/src/anim/fish_small/mod.rs @@ -14,7 +14,6 @@ use crate::render::FigureBoneData; pub struct FishSmallSkeleton { cardinalfish_torso: Bone, cardinalfish_tail: Bone, - } impl FishSmallSkeleton { @@ -30,7 +29,6 @@ impl Skeleton for FishSmallSkeleton { fn compute_matrices(&self) -> [FigureBoneData; 16] { let torso_mat = self.cardinalfish_torso.compute_base_matrix(); - [ FigureBoneData::new(torso_mat), FigureBoneData::new(self.cardinalfish_tail.compute_base_matrix() * torso_mat), @@ -54,6 +52,7 @@ impl Skeleton for FishSmallSkeleton { fn interpolate(&mut self, target: &Self, dt: f32) { self.cardinalfish_torso .interpolate(&target.cardinalfish_torso, dt); - self.cardinalfish_tail.interpolate(&target.cardinalfish_tail, dt); + self.cardinalfish_tail + .interpolate(&target.cardinalfish_tail, dt); } } diff --git a/voxygen/src/anim/fish_small/run.rs b/voxygen/src/anim/fish_small/run.rs index 2a278a1624..d11bf2a895 100644 --- a/voxygen/src/anim/fish_small/run.rs +++ b/voxygen/src/anim/fish_small/run.rs @@ -38,14 +38,11 @@ impl Animation for RunAnimation { * 0.25, ); - next.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.cardinalfish_torso.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); + next.cardinalfish_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.cardinalfish_torso.scale = Vec3::one() / 10.88; - next.cardinalfish_tail.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); + next.cardinalfish_tail.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0); next.cardinalfish_tail.scale = Vec3::one() * 1.01; diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index bc1adc74f9..a65eb04a6d 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -1,14 +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 birdmedium; -pub mod fishmedium; -pub mod dragon; -pub mod bird_small; -pub mod fish_small; -pub mod biped_large; +pub mod quadruped_medium; +pub mod quadruped_small; use crate::render::FigureBoneData; use common::comp::{self, item::Tool}; diff --git a/voxygen/src/anim/quadrupedmedium/idle.rs b/voxygen/src/anim/quadruped_medium/idle.rs similarity index 100% rename from voxygen/src/anim/quadrupedmedium/idle.rs rename to voxygen/src/anim/quadruped_medium/idle.rs diff --git a/voxygen/src/anim/quadrupedmedium/jump.rs b/voxygen/src/anim/quadruped_medium/jump.rs similarity index 100% rename from voxygen/src/anim/quadrupedmedium/jump.rs rename to voxygen/src/anim/quadruped_medium/jump.rs diff --git a/voxygen/src/anim/quadrupedmedium/mod.rs b/voxygen/src/anim/quadruped_medium/mod.rs similarity index 100% rename from voxygen/src/anim/quadrupedmedium/mod.rs rename to voxygen/src/anim/quadruped_medium/mod.rs diff --git a/voxygen/src/anim/quadrupedmedium/run.rs b/voxygen/src/anim/quadruped_medium/run.rs similarity index 100% rename from voxygen/src/anim/quadrupedmedium/run.rs rename to voxygen/src/anim/quadruped_medium/run.rs diff --git a/voxygen/src/anim/quadruped/idle.rs b/voxygen/src/anim/quadruped_small/idle.rs similarity index 96% rename from voxygen/src/anim/quadruped/idle.rs rename to voxygen/src/anim/quadruped_small/idle.rs index fc0f912acc..96f8754855 100644 --- a/voxygen/src/anim/quadruped/idle.rs +++ b/voxygen/src/anim/quadruped_small/idle.rs @@ -1,6 +1,6 @@ use super::{ super::{Animation, SkeletonAttr}, - QuadrupedSkeleton, + QuadrupedSmallSkeleton, }; use std::{f32::consts::PI, ops::Mul}; use vek::*; @@ -8,7 +8,7 @@ use vek::*; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Skeleton = QuadrupedSkeleton; + type Skeleton = QuadrupedSmallSkeleton; type Dependency = (f64); fn update_skeleton( diff --git a/voxygen/src/anim/quadruped/jump.rs b/voxygen/src/anim/quadruped_small/jump.rs similarity index 96% rename from voxygen/src/anim/quadruped/jump.rs rename to voxygen/src/anim/quadruped_small/jump.rs index d0cf3fbe39..62e287ef0e 100644 --- a/voxygen/src/anim/quadruped/jump.rs +++ b/voxygen/src/anim/quadruped_small/jump.rs @@ -1,6 +1,6 @@ use super::{ super::{Animation, SkeletonAttr}, - QuadrupedSkeleton, + QuadrupedSmallSkeleton, }; use std::f32::consts::PI; use vek::*; @@ -8,7 +8,7 @@ use vek::*; pub struct JumpAnimation; impl Animation for JumpAnimation { - type Skeleton = QuadrupedSkeleton; + type Skeleton = QuadrupedSmallSkeleton; type Dependency = (f32, f64); fn update_skeleton( diff --git a/voxygen/src/anim/quadruped/mod.rs b/voxygen/src/anim/quadruped_small/mod.rs similarity index 94% rename from voxygen/src/anim/quadruped/mod.rs rename to voxygen/src/anim/quadruped_small/mod.rs index 662c641b38..5f3c7e64b3 100644 --- a/voxygen/src/anim/quadruped/mod.rs +++ b/voxygen/src/anim/quadruped_small/mod.rs @@ -11,7 +11,7 @@ use super::{Bone, Skeleton}; use crate::render::FigureBoneData; #[derive(Clone)] -pub struct QuadrupedSkeleton { +pub struct QuadrupedSmallSkeleton { pig_head: Bone, pig_chest: Bone, pig_leg_lf: Bone, @@ -20,7 +20,7 @@ pub struct QuadrupedSkeleton { pig_leg_rb: Bone, } -impl QuadrupedSkeleton { +impl QuadrupedSmallSkeleton { pub fn new() -> Self { Self { pig_head: Bone::default(), @@ -33,7 +33,7 @@ impl QuadrupedSkeleton { } } -impl Skeleton for QuadrupedSkeleton { +impl Skeleton for QuadrupedSmallSkeleton { fn compute_matrices(&self) -> [FigureBoneData; 16] { [ FigureBoneData::new(self.pig_head.compute_base_matrix()), diff --git a/voxygen/src/anim/quadruped/run.rs b/voxygen/src/anim/quadruped_small/run.rs similarity index 96% rename from voxygen/src/anim/quadruped/run.rs rename to voxygen/src/anim/quadruped_small/run.rs index f43863a063..a6f9b877a7 100644 --- a/voxygen/src/anim/quadruped/run.rs +++ b/voxygen/src/anim/quadruped_small/run.rs @@ -1,13 +1,13 @@ use super::{ super::{Animation, SkeletonAttr}, - QuadrupedSkeleton, + QuadrupedSmallSkeleton, }; use vek::*; pub struct RunAnimation; impl Animation for RunAnimation { - type Skeleton = QuadrupedSkeleton; + type Skeleton = QuadrupedSmallSkeleton; type Dependency = (f32, f64); fn update_skeleton( diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index b8fd3ba31b..eb3874c159 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -190,13 +190,13 @@ impl FigureModelCache { None, None, ], - Body::Quadruped(body) => [ - Some(mesh_pig_head(body.head)), - Some(mesh_pig_chest(body.chest)), - Some(mesh_pig_leg_lf(body.leg_l)), - Some(mesh_pig_leg_rf(body.leg_r)), - Some(mesh_pig_leg_lb(body.leg_l)), - Some(mesh_pig_leg_rb(body.leg_r)), + Body::QuadrupedSmall(body) => [ + Some(mesh_quadruped_small_head(body.head)), + Some(mesh_quadruped_small_chest(body.chest)), + Some(mesh_quadruped_small_leg_lf(body.leg_l)), + Some(mesh_quadruped_small_leg_rf(body.leg_r)), + Some(mesh_quadruped_small_leg_lb(body.leg_l)), + Some(mesh_quadruped_small_leg_rb(body.leg_r)), None, None, None, @@ -209,17 +209,17 @@ impl FigureModelCache { None, ], Body::QuadrupedMedium(body) => [ - Some(mesh_wolf_head_upper(body.head_upper)), - Some(mesh_wolf_jaw(body.jaw)), - Some(mesh_wolf_head_lower(body.head_lower)), - Some(mesh_wolf_tail(body.tail)), - Some(mesh_wolf_torso_back(body.torso_back)), - Some(mesh_wolf_torso_mid(body.torso_mid)), - Some(mesh_wolf_ears(body.ears)), - Some(mesh_wolf_foot_lf(body.foot_lf)), - Some(mesh_wolf_foot_rf(body.foot_rf)), - Some(mesh_wolf_foot_lb(body.foot_lb)), - Some(mesh_wolf_foot_rb(body.foot_rb)), + Some(mesh_quadruped_medium_head_upper(body.head_upper)), + Some(mesh_quadruped_medium_jaw(body.jaw)), + Some(mesh_quadruped_medium_head_lower(body.head_lower)), + Some(mesh_quadruped_medium_tail(body.tail)), + Some(mesh_quadruped_medium_torso_back(body.torso_back)), + Some(mesh_quadruped_medium_torso_mid(body.torso_mid)), + Some(mesh_quadruped_medium_ears(body.ears)), + Some(mesh_quadruped_medium_foot_lf(body.foot_lf)), + Some(mesh_quadruped_medium_foot_rf(body.foot_rf)), + Some(mesh_quadruped_medium_foot_lb(body.foot_lb)), + Some(mesh_quadruped_medium_foot_rb(body.foot_rb)), None, None, None, @@ -227,13 +227,13 @@ impl FigureModelCache { None, ], Body::BirdMedium(body) => [ - Some(mesh_duck_m_head(body.head)), - Some(mesh_duck_m_torso(body.torso)), - Some(mesh_duck_m_tail(body.tail)), - Some(mesh_duck_m_wing_l(body.wing_l)), - Some(mesh_duck_m_wing_r(body.wing_r)), - Some(mesh_duck_m_leg_l(body.leg_l)), - Some(mesh_duck_m_leg_r(body.leg_r)), + Some(mesh_bird_medium_head(body.head)), + Some(mesh_bird_medium_torso(body.torso)), + Some(mesh_bird_medium_tail(body.tail)), + Some(mesh_bird_medium_wing_l(body.wing_l)), + Some(mesh_bird_medium_wing_r(body.wing_r)), + Some(mesh_bird_medium_leg_l(body.leg_l)), + Some(mesh_bird_medium_leg_r(body.leg_r)), None, None, None, @@ -245,12 +245,12 @@ impl FigureModelCache { None, ], Body::FishMedium(body) => [ - Some(mesh_marlin_head(body.head)), - Some(mesh_marlin_torso(body.torso)), - Some(mesh_marlin_rear(body.rear)), - Some(mesh_marlin_tail(body.tail)), - Some(mesh_marlin_fin_l(body.fin_l)), - Some(mesh_marlin_fin_r(body.fin_r)), + Some(mesh_fish_medium_head(body.head)), + Some(mesh_fish_medium_torso(body.torso)), + Some(mesh_fish_medium_rear(body.rear)), + Some(mesh_fish_medium_tail(body.tail)), + Some(mesh_fish_medium_fin_l(body.fin_l)), + Some(mesh_fish_medium_fin_r(body.fin_r)), None, None, None, @@ -281,10 +281,10 @@ impl FigureModelCache { None, ], Body::BirdSmall(body) => [ - Some(mesh_crow_head(body.head)), - Some(mesh_crow_torso(body.torso)), - Some(mesh_crow_wing_l(body.wing_l)), - Some(mesh_crow_wing_r(body.wing_r)), + Some(mesh_bird_small_head(body.head)), + Some(mesh_bird_small_torso(body.torso)), + Some(mesh_bird_small_wing_l(body.wing_l)), + Some(mesh_bird_small_wing_r(body.wing_r)), None, None, None, @@ -299,8 +299,8 @@ impl FigureModelCache { None, ], Body::FishSmall(body) => [ - Some(mesh_cardinalfish_torso(body.torso)), - Some(mesh_cardinalfish_tail(body.tail)), + Some(mesh_fish_small_torso(body.torso)), + Some(mesh_fish_small_tail(body.tail)), None, None, None, @@ -317,17 +317,17 @@ impl FigureModelCache { None, ], Body::BipedLarge(body) => [ - Some(mesh_knight_head(body.head)), - Some(mesh_knight_upper_torso(body.upper_torso)), - Some(mesh_knight_lower_torso(body.lower_torso)), - Some(mesh_knight_shoulder_l(body.shoulder_l)), - Some(mesh_knight_shoulder_r(body.shoulder_r)), - Some(mesh_knight_hand_l(body.hand_l)), - Some(mesh_knight_hand_r(body.hand_r)), - Some(mesh_knight_leg_l(body.leg_l)), - Some(mesh_knight_leg_r(body.leg_r)), - Some(mesh_knight_foot_l(body.foot_l)), - Some(mesh_knight_foot_r(body.foot_r)), + Some(mesh_biped_large_head(body.head)), + Some(mesh_biped_large_upper_torso(body.upper_torso)), + Some(mesh_biped_large_lower_torso(body.lower_torso)), + Some(mesh_biped_large_shoulder_l(body.shoulder_l)), + Some(mesh_biped_large_shoulder_r(body.shoulder_r)), + Some(mesh_biped_large_hand_l(body.hand_l)), + Some(mesh_biped_large_hand_r(body.hand_r)), + Some(mesh_biped_large_leg_l(body.leg_l)), + Some(mesh_biped_large_leg_r(body.leg_r)), + Some(mesh_biped_large_foot_l(body.foot_l)), + Some(mesh_biped_large_foot_r(body.foot_r)), None, None, None, diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 7de261c8f9..967c1314f5 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -6,12 +6,14 @@ use common::comp::humanoid::Body; use common::{ assets::{self, watch::ReloadIndicator, Asset}, comp::{ + biped_large, bird_medium, bird_small, dragon, fish_medium, fish_small, humanoid::{ Belt, BodyType, Chest, EyeColor, Eyebrows, Foot, Hand, Pants, Race, Shoulder, Skin, }, item::Tool, - object, quadruped, quadruped_medium, bird_medium, fish_medium, dragon, bird_small, fish_small, biped_large, Item, Itemkind + object, quadruped_small, quadruped_medium, bird_medium, fish_medium, dragon, bird_small, fish_small, biped_large, Item, Itemkind + }, figure::{DynaUnionizer, MatSegment, Material, Segment}, @@ -547,271 +549,279 @@ pub fn mesh_draw() -> Mesh { //} ///////// -pub fn mesh_pig_head(head: quadruped::Head) -> Mesh { +pub fn mesh_quadruped_small_head(head: quadruped_small::Head) -> Mesh { load_mesh( match head { - quadruped::Head::Default => "npc.pig_purple.pig_head", + quadruped_small::Head::Default => "npc.pig_purple.head", }, Vec3::new(-6.0, 4.5, 3.0), ) } -pub fn mesh_pig_chest(chest: quadruped::Chest) -> Mesh { +pub fn mesh_quadruped_small_chest(chest: quadruped_small::Chest) -> Mesh { load_mesh( match chest { - quadruped::Chest::Default => "npc.pig_purple.pig_chest", + quadruped_small::Chest::Default => "npc.pig_purple.chest", }, Vec3::new(-5.0, 4.5, 0.0), ) } -pub fn mesh_pig_leg_lf(leg_l: quadruped::LegL) -> Mesh { +pub fn mesh_quadruped_small_leg_lf(leg_l: quadruped_small::LegL) -> Mesh { load_mesh( match leg_l { - quadruped::LegL::Default => "npc.pig_purple.pig_leg_l", + quadruped_small::LegL::Default => "npc.pig_purple.leg_l", }, Vec3::new(0.0, -1.0, -1.5), ) } -pub fn mesh_pig_leg_rf(leg_r: quadruped::LegR) -> Mesh { +pub fn mesh_quadruped_small_leg_rf(leg_r: quadruped_small::LegR) -> Mesh { load_mesh( match leg_r { - quadruped::LegR::Default => "npc.pig_purple.pig_leg_r", + quadruped_small::LegR::Default => "npc.pig_purple.leg_r", }, Vec3::new(0.0, -1.0, -1.5), ) } -pub fn mesh_pig_leg_lb(leg_l: quadruped::LegL) -> Mesh { +pub fn mesh_quadruped_small_leg_lb(leg_l: quadruped_small::LegL) -> Mesh { load_mesh( match leg_l { - quadruped::LegL::Default => "npc.pig_purple.pig_leg_l", + quadruped_small::LegL::Default => "npc.pig_purple.leg_l", }, Vec3::new(0.0, -1.0, -1.5), ) } -pub fn mesh_pig_leg_rb(leg_r: quadruped::LegR) -> Mesh { +pub fn mesh_quadruped_small_leg_rb(leg_r: quadruped_small::LegR) -> Mesh { load_mesh( match leg_r { - quadruped::LegR::Default => "npc.pig_purple.pig_leg_r", + quadruped_small::LegR::Default => "npc.pig_purple.leg_r", }, Vec3::new(0.0, -1.0, -1.5), ) } ////// -pub fn mesh_wolf_head_upper(upper_head: quadruped_medium::HeadUpper) -> Mesh { +pub fn mesh_quadruped_medium_head_upper( + upper_head: quadruped_medium::HeadUpper, +) -> Mesh { load_mesh( match upper_head { - quadruped_medium::HeadUpper::Default => "npc.wolf.wolf_head_upper", + quadruped_medium::HeadUpper::Default => "npc.wolf.head_upper", }, Vec3::new(-7.0, -6.0, -5.5), ) } -pub fn mesh_wolf_jaw(jaw: quadruped_medium::Jaw) -> Mesh { +pub fn mesh_quadruped_medium_jaw(jaw: quadruped_medium::Jaw) -> Mesh { load_mesh( match jaw { - quadruped_medium::Jaw::Default => "npc.wolf.wolf_jaw", + quadruped_medium::Jaw::Default => "npc.wolf.jaw", }, Vec3::new(-3.0, -3.0, -2.5), ) } -pub fn mesh_wolf_head_lower(head_lower: quadruped_medium::HeadLower) -> Mesh { +pub fn mesh_quadruped_medium_head_lower( + head_lower: quadruped_medium::HeadLower, +) -> Mesh { load_mesh( match head_lower { - quadruped_medium::HeadLower::Default => "npc.wolf.wolf_head_lower", + quadruped_medium::HeadLower::Default => "npc.wolf.head_lower", }, Vec3::new(-7.0, -6.0, -5.5), ) } -pub fn mesh_wolf_tail(tail: quadruped_medium::Tail) -> Mesh { +pub fn mesh_quadruped_medium_tail(tail: quadruped_medium::Tail) -> Mesh { load_mesh( match tail { - quadruped_medium::Tail::Default => "npc.wolf.wolf_tail", + quadruped_medium::Tail::Default => "npc.wolf.tail", }, Vec3::new(-2.0, -12.0, -5.0), ) } -pub fn mesh_wolf_torso_back(torso_back: quadruped_medium::TorsoBack) -> Mesh { +pub fn mesh_quadruped_medium_torso_back( + torso_back: quadruped_medium::TorsoBack, +) -> Mesh { load_mesh( match torso_back { - quadruped_medium::TorsoBack::Default => "npc.wolf.wolf_torso_back", + quadruped_medium::TorsoBack::Default => "npc.wolf.torso_back", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_wolf_torso_mid(torso_mid: quadruped_medium::TorsoMid) -> Mesh { +pub fn mesh_quadruped_medium_torso_mid( + torso_mid: quadruped_medium::TorsoMid, +) -> Mesh { load_mesh( match torso_mid { - quadruped_medium::TorsoMid::Default => "npc.wolf.wolf_torso_mid", + quadruped_medium::TorsoMid::Default => "npc.wolf.torso_mid", }, Vec3::new(-8.0, -5.5, -6.0), ) } -pub fn mesh_wolf_ears(ears: quadruped_medium::Ears) -> Mesh { +pub fn mesh_quadruped_medium_ears(ears: quadruped_medium::Ears) -> Mesh { load_mesh( match ears { - quadruped_medium::Ears::Default => "npc.wolf.wolf_ears", + quadruped_medium::Ears::Default => "npc.wolf.ears", }, Vec3::new(-4.0, -1.0, -1.0), ) } -pub fn mesh_wolf_foot_lf(foot_lf: quadruped_medium::FootLF) -> Mesh { +pub fn mesh_quadruped_medium_foot_lf(foot_lf: quadruped_medium::FootLF) -> Mesh { load_mesh( match foot_lf { - quadruped_medium::FootLF::Default => "npc.wolf.wolf_foot_lf", + quadruped_medium::FootLF::Default => "npc.wolf.foot_lf", }, Vec3::new(-2.5, -4.0, -2.5), ) } -pub fn mesh_wolf_foot_rf(foot_rf: quadruped_medium::FootRF) -> Mesh { +pub fn mesh_quadruped_medium_foot_rf(foot_rf: quadruped_medium::FootRF) -> Mesh { load_mesh( match foot_rf { - quadruped_medium::FootRF::Default => "npc.wolf.wolf_foot_rf", + quadruped_medium::FootRF::Default => "npc.wolf.foot_rf", }, Vec3::new(-2.5, -4.0, -2.5), ) } -pub fn mesh_wolf_foot_lb(foot_lb: quadruped_medium::FootLB) -> Mesh { +pub fn mesh_quadruped_medium_foot_lb(foot_lb: quadruped_medium::FootLB) -> Mesh { load_mesh( match foot_lb { - quadruped_medium::FootLB::Default => "npc.wolf.wolf_foot_lb", + quadruped_medium::FootLB::Default => "npc.wolf.foot_lb", }, Vec3::new(-2.5, -4.0, -2.5), ) } -pub fn mesh_wolf_foot_rb(foot_rb: quadruped_medium::FootRB) -> Mesh { +pub fn mesh_quadruped_medium_foot_rb(foot_rb: quadruped_medium::FootRB) -> Mesh { load_mesh( match foot_rb { - quadruped_medium::FootRB::Default => "npc.wolf.wolf_foot_rb", + quadruped_medium::FootRB::Default => "npc.wolf.foot_rb", }, Vec3::new(-2.5, -4.0, -2.5), ) } //// -pub fn mesh_duck_m_head(head: bird_medium::Head) -> Mesh { +pub fn mesh_bird_medium_head(head: bird_medium::Head) -> Mesh { load_mesh( match head { - bird_medium::Head::Default => "npc.duck_m.duck_m_head", + bird_medium::Head::Default => "npc.duck_m.head", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_duck_m_torso(torso: bird_medium::Torso) -> Mesh { +pub fn mesh_bird_medium_torso(torso: bird_medium::Torso) -> Mesh { load_mesh( match torso { - bird_medium::Torso::Default => "npc.duck_m.duck_m_body", + bird_medium::Torso::Default => "npc.duck_m.body", }, Vec3::new(-8.0, -5.5, -6.0), ) } -pub fn mesh_duck_m_tail(tail: bird_medium::Tail) -> Mesh { +pub fn mesh_bird_medium_tail(tail: bird_medium::Tail) -> Mesh { load_mesh( match tail { - bird_medium::Tail::Default => "npc.duck_m.duck_m_tail", + bird_medium::Tail::Default => "npc.duck_m.tail", }, Vec3::new(-4.0, -1.0, -1.0), ) } -pub fn mesh_duck_m_wing_l(wing_l: bird_medium::WingL) -> Mesh { +pub fn mesh_bird_medium_wing_l(wing_l: bird_medium::WingL) -> Mesh { load_mesh( match wing_l { - bird_medium::WingL::Default => "npc.duck_m.duck_m_wing", + bird_medium::WingL::Default => "npc.duck_m.wing", }, Vec3::new(-2.5, -4.0, -2.5), ) } -pub fn mesh_duck_m_wing_r(wing_r: bird_medium::WingR) -> Mesh { +pub fn mesh_bird_medium_wing_r(wing_r: bird_medium::WingR) -> Mesh { load_mesh( match wing_r { - bird_medium::WingR::Default => "npc.duck_m.duck_m_wing", + bird_medium::WingR::Default => "npc.duck_m.wing", }, Vec3::new(-2.5, -4.0, -2.5), ) } -pub fn mesh_duck_m_leg_l(leg_l: bird_medium::LegL) -> Mesh { +pub fn mesh_bird_medium_leg_l(leg_l: bird_medium::LegL) -> Mesh { load_mesh( match leg_l { - bird_medium::LegL::Default => "npc.duck_m.duck_m_leg_l", + bird_medium::LegL::Default => "npc.duck_m.leg_l", }, Vec3::new(-2.5, -4.0, -2.5), ) } -pub fn mesh_duck_m_leg_r(leg_r: bird_medium::LegR) -> Mesh { +pub fn mesh_bird_medium_leg_r(leg_r: bird_medium::LegR) -> Mesh { load_mesh( match leg_r { - bird_medium::LegR::Default => "npc.duck_m.duck_m_leg_r", + bird_medium::LegR::Default => "npc.duck_m.leg_r", }, Vec3::new(-2.5, -4.0, -2.5), ) } //// -pub fn mesh_marlin_head(head: fish_medium::Head) -> Mesh { +pub fn mesh_fish_medium_head(head: fish_medium::Head) -> Mesh { load_mesh( match head { - fish_medium::Head::Default => "npc.marlin.marlin_head", + fish_medium::Head::Default => "npc.marlin.head", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_marlin_torso(torso: fish_medium::Torso) -> Mesh { +pub fn mesh_fish_medium_torso(torso: fish_medium::Torso) -> Mesh { load_mesh( match torso { - fish_medium::Torso::Default => "npc.marlin.marlin_torso", + fish_medium::Torso::Default => "npc.marlin.torso", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_marlin_rear(rear: fish_medium::Rear) -> Mesh { +pub fn mesh_fish_medium_rear(rear: fish_medium::Rear) -> Mesh { load_mesh( match rear { - fish_medium::Rear::Default => "npc.marlin.marlin_rear", + fish_medium::Rear::Default => "npc.marlin.rear", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_marlin_tail(tail: fish_medium::Tail) -> Mesh { +pub fn mesh_fish_medium_tail(tail: fish_medium::Tail) -> Mesh { load_mesh( match tail { - fish_medium::Tail::Default => "npc.marlin.marlin_tail", + fish_medium::Tail::Default => "npc.marlin.tail", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_marlin_fin_l(fin_l: fish_medium::FinL) -> Mesh { +pub fn mesh_fish_medium_fin_l(fin_l: fish_medium::FinL) -> Mesh { load_mesh( match fin_l { - fish_medium::FinL::Default => "npc.marlin.marlin_fin_l", + fish_medium::FinL::Default => "npc.marlin.fin_l", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_marlin_fin_r(fin_r: fish_medium::FinR) -> Mesh { +pub fn mesh_fish_medium_fin_r(fin_r: fish_medium::FinR) -> Mesh { load_mesh( match fin_r { - fish_medium::FinR::Default => "npc.marlin.marlin_fin_r", + fish_medium::FinR::Default => "npc.marlin.fin_r", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -820,7 +830,7 @@ pub fn mesh_marlin_fin_r(fin_r: fish_medium::FinR) -> Mesh { pub fn mesh_dragon_head(head: dragon::Head) -> Mesh { load_mesh( match head { - dragon::Head::Default => "npc.dragon.dragon_head", + dragon::Head::Default => "npc.dragon.head", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -829,7 +839,7 @@ pub fn mesh_dragon_head(head: dragon::Head) -> Mesh { pub fn mesh_dragon_chest_front(chest_front: dragon::ChestFront) -> Mesh { load_mesh( match chest_front { - dragon::ChestFront::Default => "npc.dragon.dragon_chest_front", + dragon::ChestFront::Default => "npc.dragon.chest_front", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -838,7 +848,7 @@ pub fn mesh_dragon_chest_front(chest_front: dragon::ChestFront) -> Mesh Mesh { load_mesh( match chest_rear { - dragon::ChestRear::Default => "npc.dragon.dragon_chest_rear", + dragon::ChestRear::Default => "npc.dragon.chest_rear", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -847,7 +857,7 @@ pub fn mesh_dragon_chest_rear(chest_rear: dragon::ChestRear) -> Mesh Mesh { load_mesh( match tail_front { - dragon::TailFront::Default => "npc.dragon.dragon_tail_front", + dragon::TailFront::Default => "npc.dragon.tail_front", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -856,7 +866,7 @@ pub fn mesh_dragon_tail_front(tail_front: dragon::TailFront) -> Mesh Mesh { load_mesh( match tail_rear { - dragon::TailRear::Default => "npc.dragon.dragon_tail_rear", + dragon::TailRear::Default => "npc.dragon.tail_rear", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -865,7 +875,7 @@ pub fn mesh_dragon_tail_rear(tail_rear: dragon::TailRear) -> Mesh Mesh { load_mesh( match wing_in_l { - dragon::WingInL::Default => "npc.dragon.dragon_wing_in_l", + dragon::WingInL::Default => "npc.dragon.wing_in_l", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -874,7 +884,7 @@ pub fn mesh_dragon_wing_in_l(wing_in_l: dragon::WingInL) -> Mesh pub fn mesh_dragon_wing_in_r(wing_in_r: dragon::WingInR) -> Mesh { load_mesh( match wing_in_r { - dragon::WingInR::Default => "npc.dragon.dragon_wing_in_r", + dragon::WingInR::Default => "npc.dragon.wing_in_r", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -883,7 +893,7 @@ pub fn mesh_dragon_wing_in_r(wing_in_r: dragon::WingInR) -> Mesh pub fn mesh_dragon_wing_out_l(wing_out_l: dragon::WingOutL) -> Mesh { load_mesh( match wing_out_l { - dragon::WingOutL::Default => "npc.dragon.dragon_wing_out_l", + dragon::WingOutL::Default => "npc.dragon.wing_out_l", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -892,7 +902,7 @@ pub fn mesh_dragon_wing_out_l(wing_out_l: dragon::WingOutL) -> Mesh Mesh { load_mesh( match wing_out_r { - dragon::WingOutR::Default => "npc.dragon.dragon_wing_out_r", + dragon::WingOutR::Default => "npc.dragon.wing_out_r", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -901,7 +911,7 @@ pub fn mesh_dragon_wing_out_r(wing_out_r: dragon::WingOutR) -> Mesh Mesh { load_mesh( match foot_fl { - dragon::FootFL::Default => "npc.dragon.dragon_foot_fl", + dragon::FootFL::Default => "npc.dragon.foot_fl", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -910,7 +920,7 @@ pub fn mesh_dragon_foot_fl(foot_fl: dragon::FootFL) -> Mesh { pub fn mesh_dragon_foot_fr(foot_fr: dragon::FootFR) -> Mesh { load_mesh( match foot_fr { - dragon::FootFR::Default => "npc.dragon.dragon_foot_fr", + dragon::FootFR::Default => "npc.dragon.foot_fr", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -919,7 +929,7 @@ pub fn mesh_dragon_foot_fr(foot_fr: dragon::FootFR) -> Mesh { pub fn mesh_dragon_foot_bl(foot_bl: dragon::FootBL) -> Mesh { load_mesh( match foot_bl { - dragon::FootBL::Default => "npc.dragon.dragon_foot_bl", + dragon::FootBL::Default => "npc.dragon.foot_bl", }, Vec3::new(-7.0, -6.0, -6.0), ) @@ -928,167 +938,166 @@ pub fn mesh_dragon_foot_bl(foot_bl: dragon::FootBL) -> Mesh { pub fn mesh_dragon_foot_br(foot_br: dragon::FootBR) -> Mesh { load_mesh( match foot_br { - dragon::FootBR::Default => "npc.dragon.dragon_foot_br", + dragon::FootBR::Default => "npc.dragon.foot_br", }, Vec3::new(-7.0, -6.0, -6.0), ) } //// -pub fn mesh_crow_head(head: bird_small::Head) -> Mesh { +pub fn mesh_bird_small_head(head: bird_small::Head) -> Mesh { load_mesh( match head { - bird_small::Head::Default => "npc.crow.crow_head", + bird_small::Head::Default => "npc.crow.head", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_crow_torso(torso: bird_small::Torso) -> Mesh { +pub fn mesh_bird_small_torso(torso: bird_small::Torso) -> Mesh { load_mesh( match torso { - bird_small::Torso::Default => "npc.crow.crow_torso", + bird_small::Torso::Default => "npc.crow.torso", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_crow_wing_l(wing_l: bird_small::WingL) -> Mesh { +pub fn mesh_bird_small_wing_l(wing_l: bird_small::WingL) -> Mesh { load_mesh( match wing_l { - bird_small::WingL::Default => "npc.crow.crow_wing_l", + bird_small::WingL::Default => "npc.crow.wing_l", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_crow_wing_r(wing_r: bird_small::WingR) -> Mesh { +pub fn mesh_bird_small_wing_r(wing_r: bird_small::WingR) -> Mesh { load_mesh( match wing_r { - bird_small::WingR::Default => "npc.crow.crow_wing_r", + bird_small::WingR::Default => "npc.crow.wing_r", }, Vec3::new(-7.0, -6.0, -6.0), ) } //// -pub fn mesh_cardinalfish_torso(torso: fish_small::Torso) -> Mesh { +pub fn mesh_fish_small_torso(torso: fish_small::Torso) -> Mesh { load_mesh( match torso { - fish_small::Torso::Default => "npc.cardinalfish.cardinalfish_torso", + fish_small::Torso::Default => "npc.cardinalfish.torso", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_cardinalfish_tail(tail: fish_small::Tail) -> Mesh { +pub fn mesh_fish_small_tail(tail: fish_small::Tail) -> Mesh { load_mesh( match tail { - fish_small::Tail::Default => "npc.cardinalfish.cardinalfish_tail", + fish_small::Tail::Default => "npc.cardinalfish.tail", }, Vec3::new(-7.0, -6.0, -6.0), ) } //// -pub fn mesh_knight_head(head: biped_large::Head) -> Mesh { +pub fn mesh_biped_large_head(head: biped_large::Head) -> Mesh { load_mesh( match head { - biped_large::Head::Default => "npc.knight.knight_", + biped_large::Head::Default => "npc.knight.head", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_upper_torso(upper_torso: biped_large::UpperTorso) -> Mesh { +pub fn mesh_biped_large_upper_torso(upper_torso: biped_large::UpperTorso) -> Mesh { load_mesh( match upper_torso { - biped_large::UpperTorso::Default => "npc.knight.knight_upper_torso", + biped_large::UpperTorso::Default => "npc.knight.upper_torso", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_lower_torso(lower_torso: biped_large::LowerTorso) -> Mesh { +pub fn mesh_biped_large_lower_torso(lower_torso: biped_large::LowerTorso) -> Mesh { load_mesh( match lower_torso { - biped_large::LowerTorso::Default => "npc.knight.knight_lower_torso", + biped_large::LowerTorso::Default => "npc.knight.lower_torso", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_shoulder_l(shoulder_l: biped_large::ShoulderL) -> Mesh { +pub fn mesh_biped_large_shoulder_l(shoulder_l: biped_large::ShoulderL) -> Mesh { load_mesh( match shoulder_l { - biped_large::ShoulderL::Default => "npc.knight.knight_shoulder_l", + biped_large::ShoulderL::Default => "npc.knight.shoulder_l", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_shoulder_r(shoulder_r: biped_large::ShoulderR) -> Mesh { +pub fn mesh_biped_large_shoulder_r(shoulder_r: biped_large::ShoulderR) -> Mesh { load_mesh( match shoulder_r { - biped_large::ShoulderR::Default => "npc.knight.knight_shoulder_r", + biped_large::ShoulderR::Default => "npc.knight.shoulder_r", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_hand_l(hand_l: biped_large::HandL) -> Mesh { +pub fn mesh_biped_large_hand_l(hand_l: biped_large::HandL) -> Mesh { load_mesh( match hand_l { - biped_large::HandL::Default => "npc.knight.knight_hand_l", + biped_large::HandL::Default => "npc.knight.hand_l", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_hand_r(hand_r: biped_large::HandR) -> Mesh { +pub fn mesh_biped_large_hand_r(hand_r: biped_large::HandR) -> Mesh { load_mesh( match hand_r { - biped_large::HandR::Default => "npc.knight.knight_hand_r", + biped_large::HandR::Default => "npc.knight.hand_r", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_leg_l(leg_l: biped_large::LegL) -> Mesh { +pub fn mesh_biped_large_leg_l(leg_l: biped_large::LegL) -> Mesh { load_mesh( match leg_l { - biped_large::LegL::Default => "npc.knight.knight_leg_l", + biped_large::LegL::Default => "npc.knight.leg_l", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_leg_r(leg_r: biped_large::LegR) -> Mesh { +pub fn mesh_biped_large_leg_r(leg_r: biped_large::LegR) -> Mesh { load_mesh( match leg_r { - biped_large::LegR::Default => "npc.knight.knight_leg_r", + biped_large::LegR::Default => "npc.knight.leg_r", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_foot_l(foot_l: biped_large::FootL) -> Mesh { +pub fn mesh_biped_large_foot_l(foot_l: biped_large::FootL) -> Mesh { load_mesh( match foot_l { - biped_large::FootL::Default => "npc.knight.knight_foot_l", + biped_large::FootL::Default => "npc.knight.foot_l", }, Vec3::new(-7.0, -6.0, -6.0), ) } -pub fn mesh_knight_foot_r(foot_r: biped_large::FootR) -> Mesh { +pub fn mesh_biped_large_foot_r(foot_r: biped_large::FootR) -> Mesh { load_mesh( match foot_r { - biped_large::FootR::Default => "npc.knight.knight_foot_r", + biped_large::FootR::Default => "npc.knight.foot_r", }, Vec3::new(-7.0, -6.0, -6.0), ) } - //// pub fn mesh_object(obj: object::Body) -> Mesh { use object::Body; diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 254a1c93f6..664d6ab937 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -8,10 +8,6 @@ use crate::{ anim::{ self, character::CharacterSkeleton, object::ObjectSkeleton, quadruped::QuadrupedSkeleton, quadrupedmedium::QuadrupedMediumSkeleton, birdmedium::BirdMediumSkeleton, fishmedium::FishMediumSkeleton, dragon::DragonSkeleton, bird_small::BirdSmallSkeleton, fish_small::FishSmallSkeleton, biped_large::BipedLargeSkeleton, Animation, Skeleton, -<<<<<<< HEAD - -======= ->>>>>>> added large bipeds, small birbs, small fish skeletons }, render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow}, scene::camera::{Camera, CameraMode}, From c5942dfcc90fe5ae2739ba3d067808dd77fc52db Mon Sep 17 00:00:00 2001 From: jshipsey Date: Fri, 25 Oct 2019 19:18:34 -0400 Subject: [PATCH 09/10] purged references to npckind from anim files, removed warnings --- voxygen/src/anim/biped_large/idle.rs | 90 +++++++---------- voxygen/src/anim/biped_large/jump.rs | 75 +++++++-------- voxygen/src/anim/biped_large/mod.rs | 92 +++++++++--------- voxygen/src/anim/biped_large/run.rs | 90 +++++++---------- voxygen/src/anim/bird_medium/idle.rs | 67 +++++-------- voxygen/src/anim/bird_medium/jump.rs | 51 +++++----- voxygen/src/anim/bird_medium/mod.rs | 56 +++++------ voxygen/src/anim/bird_medium/run.rs | 66 +++++-------- voxygen/src/anim/bird_small/idle.rs | 48 +++------- voxygen/src/anim/bird_small/jump.rs | 33 +++---- voxygen/src/anim/bird_small/mod.rs | 32 +++---- voxygen/src/anim/bird_small/run.rs | 48 +++------- voxygen/src/anim/dragon/idle.rs | 102 ++++++++------------ voxygen/src/anim/dragon/jump.rs | 87 ++++++++--------- voxygen/src/anim/dragon/mod.rs | 112 ++++++++++------------ voxygen/src/anim/dragon/run.rs | 102 ++++++++------------ voxygen/src/anim/fish_medium/idle.rs | 61 ++++-------- voxygen/src/anim/fish_medium/jump.rs | 47 ++++----- voxygen/src/anim/fish_medium/mod.rs | 48 +++++----- voxygen/src/anim/fish_medium/run.rs | 47 ++++----- voxygen/src/anim/fish_small/idle.rs | 36 ++----- voxygen/src/anim/fish_small/jump.rs | 21 ++-- voxygen/src/anim/fish_small/mod.rs | 18 ++-- voxygen/src/anim/fish_small/run.rs | 36 ++----- voxygen/src/anim/quadruped_medium/idle.rs | 74 +++++++------- voxygen/src/anim/quadruped_medium/jump.rs | 70 +++++++------- voxygen/src/anim/quadruped_medium/mod.rs | 93 +++++++++--------- voxygen/src/anim/quadruped_medium/run.rs | 69 +++++++------ voxygen/src/scene/figure/load.rs | 9 -- 29 files changed, 755 insertions(+), 1025 deletions(-) diff --git a/voxygen/src/anim/biped_large/idle.rs b/voxygen/src/anim/biped_large/idle.rs index 0fced4adc8..1bae88481e 100644 --- a/voxygen/src/anim/biped_large/idle.rs +++ b/voxygen/src/anim/biped_large/idle.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, BipedLargeSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct IdleAnimation; @@ -13,74 +13,56 @@ impl Animation for IdleAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, + _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(); + 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; - let duck_m_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.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.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_head.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.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_upper_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.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_lower_torso.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.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_shoulder_l.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.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_shoulder_r.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.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_hand_l.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.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_hand_r.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.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_leg_l.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.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_leg_r.scale = Vec3::one() / 10.88; - - next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_foot_l.scale = Vec3::one() / 10.88; - - next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_foot_r.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 } } diff --git a/voxygen/src/anim/biped_large/jump.rs b/voxygen/src/anim/biped_large/jump.rs index 31e554cad8..0494cf0bb8 100644 --- a/voxygen/src/anim/biped_large/jump.rs +++ b/voxygen/src/anim/biped_large/jump.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, BipedLargeSkeleton, }; -use std::f32::consts::PI; +//use std::f32::consts::PI; use vek::*; pub struct JumpAnimation; @@ -14,60 +14,55 @@ impl Animation for JumpAnimation { fn update_skeleton( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - anim_time: f64, + _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(); + 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.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_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.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_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.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_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.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_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.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_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.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_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.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_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.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_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.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_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.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_foot_l.scale = Vec3::one() / 10.88; - - next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_foot_r.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 } } diff --git a/voxygen/src/anim/biped_large/mod.rs b/voxygen/src/anim/biped_large/mod.rs index 0843554a2f..b1bc01d4ce 100644 --- a/voxygen/src/anim/biped_large/mod.rs +++ b/voxygen/src/anim/biped_large/mod.rs @@ -12,61 +12,61 @@ use crate::render::FigureBoneData; #[derive(Clone)] pub struct BipedLargeSkeleton { - knight_head: Bone, - knight_upper_torso: Bone, - knight_lower_torso: Bone, - knight_shoulder_l: Bone, - knight_shoulder_r: Bone, - knight_hand_l: Bone, - knight_hand_r: Bone, - knight_leg_l: Bone, - knight_leg_r: Bone, - knight_foot_l: Bone, - knight_foot_r: Bone, + 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 { - knight_head: Bone::default(), - knight_upper_torso: Bone::default(), - knight_lower_torso: Bone::default(), - knight_shoulder_l: Bone::default(), - knight_shoulder_r: Bone::default(), - knight_hand_l: Bone::default(), - knight_hand_r: Bone::default(), - knight_leg_l: Bone::default(), - knight_leg_r: Bone::default(), - knight_foot_l: Bone::default(), - knight_foot_r: Bone::default(), + 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.knight_upper_torso.compute_base_matrix(); - let shoulder_l_mat = self.knight_shoulder_l.compute_base_matrix(); - let shoulder_r_mat = self.knight_shoulder_r.compute_base_matrix(); - let leg_l_mat = self.knight_leg_l.compute_base_matrix(); - let leg_r_mat = self.knight_leg_r.compute_base_matrix(); + 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.knight_head.compute_base_matrix()), + FigureBoneData::new(self.head.compute_base_matrix()), FigureBoneData::new(upper_torso_mat), - FigureBoneData::new(self.knight_lower_torso.compute_base_matrix() * 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.knight_hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat, + self.hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat, ), FigureBoneData::new( - self.knight_hand_r.compute_base_matrix() * shoulder_r_mat * upper_torso_mat, + 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.knight_foot_l.compute_base_matrix() * leg_l_mat), - FigureBoneData::new(self.knight_foot_r.compute_base_matrix() * 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(), @@ -76,20 +76,16 @@ impl Skeleton for BipedLargeSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.knight_head.interpolate(&target.knight_head, dt); - self.knight_upper_torso - .interpolate(&target.knight_upper_torso, dt); - self.knight_lower_torso - .interpolate(&target.knight_lower_torso, dt); - self.knight_shoulder_l - .interpolate(&target.knight_shoulder_l, dt); - self.knight_shoulder_r - .interpolate(&target.knight_shoulder_r, dt); - self.knight_hand_l.interpolate(&target.knight_hand_l, dt); - self.knight_hand_r.interpolate(&target.knight_hand_r, dt); - self.knight_leg_l.interpolate(&target.knight_leg_l, dt); - self.knight_leg_r.interpolate(&target.knight_leg_r, dt); - self.knight_foot_l.interpolate(&target.knight_foot_l, dt); - self.knight_foot_r.interpolate(&target.knight_foot_r, dt); + 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); } } diff --git a/voxygen/src/anim/biped_large/run.rs b/voxygen/src/anim/biped_large/run.rs index 17c532713a..4f77065716 100644 --- a/voxygen/src/anim/biped_large/run.rs +++ b/voxygen/src/anim/biped_large/run.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, BipedLargeSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct RunAnimation; @@ -13,74 +13,56 @@ impl Animation for RunAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - (_velocity, global_time): Self::Dependency, - anim_time: f64, + (_velocity, _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(); + 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; - let duck_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.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.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_head.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.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_upper_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.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_lower_torso.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.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_shoulder_l.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.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_shoulder_r.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.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_hand_l.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.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_hand_r.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.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_leg_l.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.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_leg_r.scale = Vec3::one() / 10.88; - - next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_foot_l.scale = Vec3::one() / 10.88; - - next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.knight_foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.knight_foot_r.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 } } diff --git a/voxygen/src/anim/bird_medium/idle.rs b/voxygen/src/anim/bird_medium/idle.rs index b8d57b912a..d2156415e7 100644 --- a/voxygen/src/anim/bird_medium/idle.rs +++ b/voxygen/src/anim/bird_medium/idle.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, BirdMediumSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct IdleAnimation; @@ -13,59 +13,40 @@ impl Animation for IdleAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, + _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(); + 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; - let duck_m_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.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.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.duck_m_head.ori = - Quaternion::rotation_z(duck_m_look.x) * Quaternion::rotation_x(duck_m_look.y); - next.duck_m_head.scale = Vec3::one() / 10.88; + 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.duck_m_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.duck_m_torso.ori = Quaternion::rotation_x(0.0); - next.duck_m_torso.scale = Vec3::one() * 1.01; + 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.duck_m_tail.offset = Vec3::new(0.0, 3.1, -4.5); - next.duck_m_tail.ori = Quaternion::rotation_z(0.0); - next.duck_m_tail.scale = Vec3::one() * 0.98; + 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.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.duck_m_wing_l.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.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; - next.duck_m_wing_r.ori = Quaternion::rotation_y(0.0); - next.duck_m_wing_r.scale = Vec3::one() / 11.0; - - next.duck_m_leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; - next.duck_m_leg_l.ori = Quaternion::rotation_y(0.0); - next.duck_m_leg_l.scale = Vec3::one() / 10.5; - - next.duck_m_leg_r.offset = Vec3::new(0.0, 0.75, 5.25); - next.duck_m_leg_r.ori = Quaternion::rotation_x(0.0); - next.duck_m_leg_r.scale = Vec3::one() * 1.00; + 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 } } diff --git a/voxygen/src/anim/bird_medium/jump.rs b/voxygen/src/anim/bird_medium/jump.rs index 5ceef62a59..14d57abe9b 100644 --- a/voxygen/src/anim/bird_medium/jump.rs +++ b/voxygen/src/anim/bird_medium/jump.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, BirdMediumSkeleton, }; -use std::f32::consts::PI; +//use std::f32::consts::PI; use vek::*; pub struct JumpAnimation; @@ -14,44 +14,39 @@ impl Animation for JumpAnimation { fn update_skeleton( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - anim_time: f64, + _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(); + 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.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.duck_m_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.duck_m_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.duck_m_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.duck_m_torso.ori = Quaternion::rotation_x(0.0); - next.duck_m_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.duck_m_tail.offset = Vec3::new(0.0, 3.1, -4.5); - next.duck_m_tail.ori = Quaternion::rotation_z(0.0); - next.duck_m_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.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.duck_m_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.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; - next.duck_m_wing_r.ori = Quaternion::rotation_y(0.0); - next.duck_m_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.duck_m_leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; - next.duck_m_leg_l.ori = Quaternion::rotation_y(0.0); - next.duck_m_leg_l.scale = Vec3::one() / 10.5; - - next.duck_m_leg_r.offset = Vec3::new(0.0, 0.75, 5.25); - next.duck_m_leg_r.ori = Quaternion::rotation_x(0.0); - next.duck_m_leg_r.scale = Vec3::one() * 1.00; + 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 } } diff --git a/voxygen/src/anim/bird_medium/mod.rs b/voxygen/src/anim/bird_medium/mod.rs index 3cbe7e0fc6..0ed048b719 100644 --- a/voxygen/src/anim/bird_medium/mod.rs +++ b/voxygen/src/anim/bird_medium/mod.rs @@ -12,41 +12,41 @@ use crate::render::FigureBoneData; #[derive(Clone)] pub struct BirdMediumSkeleton { - duck_m_head: Bone, - duck_m_torso: Bone, - duck_m_tail: Bone, - duck_m_wing_l: Bone, - duck_m_wing_r: Bone, - duck_m_leg_l: Bone, - duck_m_leg_r: Bone, + 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 { - duck_m_head: Bone::default(), - duck_m_torso: Bone::default(), - duck_m_tail: Bone::default(), - duck_m_wing_l: Bone::default(), - duck_m_wing_r: Bone::default(), - duck_m_leg_l: Bone::default(), - duck_m_leg_r: Bone::default(), + 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.duck_m_torso.compute_base_matrix(); + let torso_mat = self.torso.compute_base_matrix(); [ - FigureBoneData::new(self.duck_m_head.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.head.compute_base_matrix() * torso_mat), FigureBoneData::new(torso_mat), - FigureBoneData::new(self.duck_m_tail.compute_base_matrix() * torso_mat), - FigureBoneData::new(self.duck_m_wing_l.compute_base_matrix() * torso_mat), - FigureBoneData::new(self.duck_m_wing_r.compute_base_matrix() * torso_mat), - FigureBoneData::new(self.duck_m_leg_l.compute_base_matrix()), - FigureBoneData::new(self.duck_m_leg_r.compute_base_matrix()), + 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(), @@ -60,12 +60,12 @@ impl Skeleton for BirdMediumSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.duck_m_head.interpolate(&target.duck_m_head, dt); - self.duck_m_torso.interpolate(&target.duck_m_torso, dt); - self.duck_m_tail.interpolate(&target.duck_m_tail, dt); - self.duck_m_wing_l.interpolate(&target.duck_m_wing_l, dt); - self.duck_m_wing_r.interpolate(&target.duck_m_wing_r, dt); - self.duck_m_leg_l.interpolate(&target.duck_m_leg_l, dt); - self.duck_m_leg_r.interpolate(&target.duck_m_leg_r, dt); + 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); } } diff --git a/voxygen/src/anim/bird_medium/run.rs b/voxygen/src/anim/bird_medium/run.rs index e2609673bd..11f825cb96 100644 --- a/voxygen/src/anim/bird_medium/run.rs +++ b/voxygen/src/anim/bird_medium/run.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, BirdMediumSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct RunAnimation; @@ -13,58 +13,40 @@ impl Animation for RunAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - (_velocity, global_time): Self::Dependency, - anim_time: f64, + (_velocity, _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(); + 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; - let duck_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.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.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.duck_m_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.duck_m_head.scale = Vec3::one() / 10.88; + 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.duck_m_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.duck_m_torso.ori = Quaternion::rotation_x(0.0); - next.duck_m_torso.scale = Vec3::one() * 1.01; + 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.duck_m_tail.offset = Vec3::new(0.0, 3.1, -4.5); - next.duck_m_tail.ori = Quaternion::rotation_z(0.0); - next.duck_m_tail.scale = Vec3::one() * 0.98; + 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.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.duck_m_wing_l.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.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; - next.duck_m_wing_r.ori = Quaternion::rotation_y(0.0); - next.duck_m_wing_r.scale = Vec3::one() / 11.0; - - next.duck_m_leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; - next.duck_m_leg_l.ori = Quaternion::rotation_y(0.0); - next.duck_m_leg_l.scale = Vec3::one() / 10.5; - - next.duck_m_leg_r.offset = Vec3::new(0.0, 0.75, 5.25); - next.duck_m_leg_r.ori = Quaternion::rotation_x(0.0); - next.duck_m_leg_r.scale = Vec3::one() * 1.00; + 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 } } diff --git a/voxygen/src/anim/bird_small/idle.rs b/voxygen/src/anim/bird_small/idle.rs index 209a95bc1d..9cef0371f3 100644 --- a/voxygen/src/anim/bird_small/idle.rs +++ b/voxygen/src/anim/bird_small/idle.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, BirdSmallSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct IdleAnimation; @@ -13,46 +13,28 @@ impl Animation for IdleAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, + _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(); + 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; - let duck_m_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.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.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_head.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.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_torso.scale = Vec3::one() / 10.88; - - next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_wing_l.scale = Vec3::one() / 10.88; - - next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_wing_r.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 } diff --git a/voxygen/src/anim/bird_small/jump.rs b/voxygen/src/anim/bird_small/jump.rs index 726ebc2987..21dd935088 100644 --- a/voxygen/src/anim/bird_small/jump.rs +++ b/voxygen/src/anim/bird_small/jump.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, BirdSmallSkeleton, }; -use std::f32::consts::PI; +//use std::f32::consts::PI; use vek::*; pub struct JumpAnimation; @@ -14,32 +14,27 @@ impl Animation for JumpAnimation { fn update_skeleton( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - anim_time: f64, + _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(); + 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.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_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.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_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.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_wing_l.scale = Vec3::one() / 10.88; - - next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_wing_r.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 } diff --git a/voxygen/src/anim/bird_small/mod.rs b/voxygen/src/anim/bird_small/mod.rs index 6755f3a4f1..dff5671b62 100644 --- a/voxygen/src/anim/bird_small/mod.rs +++ b/voxygen/src/anim/bird_small/mod.rs @@ -12,32 +12,32 @@ use crate::render::FigureBoneData; #[derive(Clone)] pub struct BirdSmallSkeleton { - crow_head: Bone, - crow_torso: Bone, - crow_wing_l: Bone, - crow_wing_r: Bone, + head: Bone, + torso: Bone, + wing_l: Bone, + wing_r: Bone, } impl BirdSmallSkeleton { pub fn new() -> Self { Self { - crow_head: Bone::default(), - crow_torso: Bone::default(), - crow_wing_l: Bone::default(), - crow_wing_r: Bone::default(), + 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.crow_torso.compute_base_matrix(); + let torso_mat = self.torso.compute_base_matrix(); [ - FigureBoneData::new(self.crow_head.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.head.compute_base_matrix() * torso_mat), FigureBoneData::new(torso_mat), - FigureBoneData::new(self.crow_wing_l.compute_base_matrix() * torso_mat), - FigureBoneData::new(self.crow_wing_r.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::default(), FigureBoneData::default(), FigureBoneData::default(), @@ -54,9 +54,9 @@ impl Skeleton for BirdSmallSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.crow_head.interpolate(&target.crow_head, dt); - self.crow_torso.interpolate(&target.crow_torso, dt); - self.crow_wing_l.interpolate(&target.crow_wing_l, dt); - self.crow_wing_r.interpolate(&target.crow_wing_r, dt); + 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); } } diff --git a/voxygen/src/anim/bird_small/run.rs b/voxygen/src/anim/bird_small/run.rs index a11271c81d..62762cc33f 100644 --- a/voxygen/src/anim/bird_small/run.rs +++ b/voxygen/src/anim/bird_small/run.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, BirdSmallSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct RunAnimation; @@ -13,46 +13,28 @@ impl Animation for RunAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - (_velocity, global_time): Self::Dependency, - anim_time: f64, + (_velocity, _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(); + 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; - let duck_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.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.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_head.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.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_torso.scale = Vec3::one() / 10.88; - - next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_wing_l.scale = Vec3::one() / 10.88; - - next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.crow_wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.crow_wing_r.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 } diff --git a/voxygen/src/anim/dragon/idle.rs b/voxygen/src/anim/dragon/idle.rs index 967f8baa9f..9073740442 100644 --- a/voxygen/src/anim/dragon/idle.rs +++ b/voxygen/src/anim/dragon/idle.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, DragonSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct IdleAnimation; @@ -13,82 +13,64 @@ impl Animation for IdleAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, + _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(); + 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; - let duck_m_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.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.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.dragon_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.dragon_head.scale = Vec3::one() / 10.88; + 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.dragon_chest_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_chest_front.ori = Quaternion::rotation_x(0.0); - next.dragon_chest_front.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.dragon_chest_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0); - next.dragon_chest_rear.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.dragon_tail_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_tail_front.ori = Quaternion::rotation_x(0.0); - next.dragon_tail_front.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.dragon_tail_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0); - next.dragon_tail_rear.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.dragon_wing_in_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0); - next.dragon_wing_in_l.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.dragon_wing_in_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0); - next.dragon_wing_in_r.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.dragon_wing_out_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0); - next.dragon_wing_out_l.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.dragon_wing_out_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0); - next.dragon_wing_out_r.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.dragon_foot_fl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_fl.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.dragon_foot_fr.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_fr.scale = Vec3::one() * 1.01; - - next.dragon_foot_bl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_bl.scale = Vec3::one() * 1.01; - - next.dragon_foot_br.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_br.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_br.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 } } diff --git a/voxygen/src/anim/dragon/jump.rs b/voxygen/src/anim/dragon/jump.rs index daccdcfa79..8aa98d93cd 100644 --- a/voxygen/src/anim/dragon/jump.rs +++ b/voxygen/src/anim/dragon/jump.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, DragonSkeleton, }; -use std::f32::consts::PI; +//use std::f32::consts::PI; use vek::*; pub struct JumpAnimation; @@ -14,68 +14,63 @@ impl Animation for JumpAnimation { fn update_skeleton( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - anim_time: f64, + _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(); + 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.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.dragon_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.dragon_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.dragon_chest_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_chest_front.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_chest_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_tail_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_tail_front.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_tail_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_wing_in_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_wing_in_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_wing_out_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_wing_out_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_foot_fl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_foot_fr.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0); - next.dragon_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.dragon_foot_bl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_bl.scale = Vec3::one() * 1.01; - - next.dragon_foot_br.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_br.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_br.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 } } diff --git a/voxygen/src/anim/dragon/mod.rs b/voxygen/src/anim/dragon/mod.rs index 5a39eeffe5..b6950956e5 100644 --- a/voxygen/src/anim/dragon/mod.rs +++ b/voxygen/src/anim/dragon/mod.rs @@ -12,62 +12,62 @@ use crate::render::FigureBoneData; #[derive(Clone)] pub struct DragonSkeleton { - dragon_head: Bone, - dragon_chest_front: Bone, - dragon_chest_rear: Bone, - dragon_tail_front: Bone, - dragon_tail_rear: Bone, - dragon_wing_in_l: Bone, - dragon_wing_in_r: Bone, - dragon_wing_out_l: Bone, - dragon_wing_out_r: Bone, - dragon_foot_fl: Bone, - dragon_foot_fr: Bone, - dragon_foot_bl: Bone, - dragon_foot_br: Bone, + 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 { - dragon_head: Bone::default(), - dragon_chest_front: Bone::default(), - dragon_chest_rear: Bone::default(), - dragon_tail_front: Bone::default(), - dragon_tail_rear: Bone::default(), - dragon_wing_in_l: Bone::default(), - dragon_wing_in_r: Bone::default(), - dragon_wing_out_l: Bone::default(), - dragon_wing_out_r: Bone::default(), - dragon_foot_fl: Bone::default(), - dragon_foot_fr: Bone::default(), - dragon_foot_bl: Bone::default(), - dragon_foot_br: Bone::default(), + 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.dragon_chest_front.compute_base_matrix(); - let wing_in_l_mat = self.dragon_wing_in_l.compute_base_matrix(); - let wing_in_r_mat = self.dragon_wing_in_r.compute_base_matrix(); - let tail_front_mat = self.dragon_tail_front.compute_base_matrix(); + 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.dragon_head.compute_base_matrix() * chest_front_mat), + FigureBoneData::new(self.head.compute_base_matrix() * chest_front_mat), FigureBoneData::new(chest_front_mat), - FigureBoneData::new(self.dragon_chest_rear.compute_base_matrix() * chest_front_mat), + FigureBoneData::new(self.chest_rear.compute_base_matrix() * chest_front_mat), FigureBoneData::new(tail_front_mat), - FigureBoneData::new(self.dragon_tail_rear.compute_base_matrix() * 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.dragon_wing_out_l.compute_base_matrix() * wing_in_l_mat), - FigureBoneData::new(self.dragon_wing_out_r.compute_base_matrix() * wing_in_r_mat), - FigureBoneData::new(self.dragon_foot_fl.compute_base_matrix()), - FigureBoneData::new(self.dragon_foot_fr.compute_base_matrix()), - FigureBoneData::new(self.dragon_foot_bl.compute_base_matrix()), - FigureBoneData::new(self.dragon_foot_br.compute_base_matrix()), + 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(), @@ -75,26 +75,18 @@ impl Skeleton for DragonSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.dragon_head.interpolate(&target.dragon_head, dt); - self.dragon_chest_front - .interpolate(&target.dragon_chest_front, dt); - self.dragon_chest_rear - .interpolate(&target.dragon_chest_rear, dt); - self.dragon_tail_front - .interpolate(&target.dragon_tail_front, dt); - self.dragon_tail_rear - .interpolate(&target.dragon_tail_rear, dt); - self.dragon_wing_in_l - .interpolate(&target.dragon_wing_in_l, dt); - self.dragon_wing_in_r - .interpolate(&target.dragon_wing_in_r, dt); - self.dragon_wing_out_l - .interpolate(&target.dragon_wing_out_l, dt); - self.dragon_wing_out_r - .interpolate(&target.dragon_wing_out_r, dt); - self.dragon_foot_fl.interpolate(&target.dragon_foot_fl, dt); - self.dragon_foot_fr.interpolate(&target.dragon_foot_fr, dt); - self.dragon_foot_bl.interpolate(&target.dragon_foot_bl, dt); - self.dragon_foot_br.interpolate(&target.dragon_foot_br, dt); + 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); } } diff --git a/voxygen/src/anim/dragon/run.rs b/voxygen/src/anim/dragon/run.rs index d3da869934..2abe9fae1a 100644 --- a/voxygen/src/anim/dragon/run.rs +++ b/voxygen/src/anim/dragon/run.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, DragonSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct RunAnimation; @@ -13,82 +13,64 @@ impl Animation for RunAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - (_velocity, global_time): Self::Dependency, - anim_time: f64, + (_velocity, _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(); + 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; - let duck_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.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.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.dragon_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.dragon_head.scale = Vec3::one() / 10.88; + 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.dragon_chest_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_chest_front.ori = Quaternion::rotation_x(0.0); - next.dragon_chest_front.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.dragon_chest_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0); - next.dragon_chest_rear.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.dragon_tail_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_tail_front.ori = Quaternion::rotation_x(0.0); - next.dragon_tail_front.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.dragon_tail_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0); - next.dragon_tail_rear.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.dragon_wing_in_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0); - next.dragon_wing_in_l.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.dragon_wing_in_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0); - next.dragon_wing_in_r.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.dragon_wing_out_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0); - next.dragon_wing_out_l.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.dragon_wing_out_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0); - next.dragon_wing_out_r.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.dragon_foot_fl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_fl.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.dragon_foot_fr.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_fr.scale = Vec3::one() * 1.01; - - next.dragon_foot_bl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_bl.scale = Vec3::one() * 1.01; - - next.dragon_foot_br.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.dragon_foot_br.ori = Quaternion::rotation_x(0.0); - next.dragon_foot_br.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 } } diff --git a/voxygen/src/anim/fish_medium/idle.rs b/voxygen/src/anim/fish_medium/idle.rs index a960d839e2..5a04c110af 100644 --- a/voxygen/src/anim/fish_medium/idle.rs +++ b/voxygen/src/anim/fish_medium/idle.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, FishMediumSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct IdleAnimation; @@ -13,55 +13,36 @@ impl Animation for IdleAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, + _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(); + 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; - let duck_m_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.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.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.marlin_head.ori = - Quaternion::rotation_z(duck_m_look.x) * Quaternion::rotation_x(duck_m_look.y); - next.marlin_head.scale = Vec3::one() / 10.88; + 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.marlin_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.marlin_torso.ori = Quaternion::rotation_x(0.0); - next.marlin_torso.scale = Vec3::one() * 1.01; + 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.marlin_rear.offset = Vec3::new(0.0, 3.1, -4.5); - next.marlin_rear.ori = Quaternion::rotation_z(0.0); - next.marlin_rear.scale = Vec3::one() * 0.98; + 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.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.marlin_tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.marlin_tail.scale = Vec3::one() / 11.0; - - next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; - next.marlin_fin_l.ori = Quaternion::rotation_y(0.0); - next.marlin_fin_l.scale = Vec3::one() / 11.0; - - next.marlin_fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; - next.marlin_fin_r.ori = Quaternion::rotation_y(0.0); - next.marlin_fin_r.scale = Vec3::one() / 10.5; + 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 } } diff --git a/voxygen/src/anim/fish_medium/jump.rs b/voxygen/src/anim/fish_medium/jump.rs index fe91b5b29a..6b6266e402 100644 --- a/voxygen/src/anim/fish_medium/jump.rs +++ b/voxygen/src/anim/fish_medium/jump.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, FishMediumSkeleton, }; -use std::f32::consts::PI; +//use std::f32::consts::PI; use vek::*; pub struct JumpAnimation; @@ -13,41 +13,36 @@ impl Animation for JumpAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, + _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(); + 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.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.marlin_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.marlin_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.marlin_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.marlin_torso.ori = Quaternion::rotation_x(0.0); - next.marlin_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.marlin_rear.offset = Vec3::new(0.0, 3.1, -4.5); - next.marlin_rear.ori = Quaternion::rotation_z(0.0); - next.marlin_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.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.marlin_tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.marlin_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.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; - next.marlin_fin_l.ori = Quaternion::rotation_y(0.0); - next.marlin_fin_l.scale = Vec3::one() / 11.0; - - next.marlin_fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; - next.marlin_fin_r.ori = Quaternion::rotation_y(0.0); - next.marlin_fin_r.scale = Vec3::one() / 10.5; + 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 } } diff --git a/voxygen/src/anim/fish_medium/mod.rs b/voxygen/src/anim/fish_medium/mod.rs index 3b7b93fd5d..566967a532 100644 --- a/voxygen/src/anim/fish_medium/mod.rs +++ b/voxygen/src/anim/fish_medium/mod.rs @@ -12,39 +12,39 @@ use crate::render::FigureBoneData; #[derive(Clone)] pub struct FishMediumSkeleton { - marlin_head: Bone, - marlin_torso: Bone, - marlin_rear: Bone, - marlin_tail: Bone, - marlin_fin_l: Bone, - marlin_fin_r: Bone, + head: Bone, + torso: Bone, + rear: Bone, + tail: Bone, + fin_l: Bone, + fin_r: Bone, } impl FishMediumSkeleton { pub fn new() -> Self { Self { - marlin_head: Bone::default(), - marlin_torso: Bone::default(), - marlin_rear: Bone::default(), - marlin_tail: Bone::default(), - marlin_fin_l: Bone::default(), - marlin_fin_r: Bone::default(), + 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.marlin_torso.compute_base_matrix(); - let rear_mat = self.marlin_rear.compute_base_matrix(); + let torso_mat = self.torso.compute_base_matrix(); + let rear_mat = self.rear.compute_base_matrix(); [ - FigureBoneData::new(self.marlin_head.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.head.compute_base_matrix() * torso_mat), FigureBoneData::new(torso_mat), FigureBoneData::new(rear_mat * torso_mat), - FigureBoneData::new(self.marlin_tail.compute_base_matrix() * rear_mat), - FigureBoneData::new(self.marlin_fin_l.compute_base_matrix() * rear_mat), - FigureBoneData::new(self.marlin_fin_r.compute_base_matrix() * rear_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(), @@ -59,11 +59,11 @@ impl Skeleton for FishMediumSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.marlin_head.interpolate(&target.marlin_head, dt); - self.marlin_torso.interpolate(&target.marlin_torso, dt); - self.marlin_rear.interpolate(&target.marlin_rear, dt); - self.marlin_tail.interpolate(&target.marlin_tail, dt); - self.marlin_fin_l.interpolate(&target.marlin_fin_l, dt); - self.marlin_fin_r.interpolate(&target.marlin_fin_r, dt); + 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); } } diff --git a/voxygen/src/anim/fish_medium/run.rs b/voxygen/src/anim/fish_medium/run.rs index 5c97c3c4d7..18886ee935 100644 --- a/voxygen/src/anim/fish_medium/run.rs +++ b/voxygen/src/anim/fish_medium/run.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, FishMediumSkeleton, }; -use std::f32::consts::PI; +//use std::f32::consts::PI; use vek::*; pub struct RunAnimation; @@ -13,41 +13,36 @@ impl Animation for RunAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, + _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(); + 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.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.marlin_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.marlin_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.marlin_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.marlin_torso.ori = Quaternion::rotation_x(0.0); - next.marlin_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.marlin_rear.offset = Vec3::new(0.0, 3.1, -4.5); - next.marlin_rear.ori = Quaternion::rotation_z(0.0); - next.marlin_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.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0; - next.marlin_tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.marlin_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.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0; - next.marlin_fin_l.ori = Quaternion::rotation_y(0.0); - next.marlin_fin_l.scale = Vec3::one() / 11.0; - - next.marlin_fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0; - next.marlin_fin_r.ori = Quaternion::rotation_y(0.0); - next.marlin_fin_r.scale = Vec3::one() / 10.5; + 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 } } diff --git a/voxygen/src/anim/fish_small/idle.rs b/voxygen/src/anim/fish_small/idle.rs index 797a7f3416..67ba7bc94f 100644 --- a/voxygen/src/anim/fish_small/idle.rs +++ b/voxygen/src/anim/fish_small/idle.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, FishSmallSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct IdleAnimation; @@ -13,38 +13,20 @@ impl Animation for IdleAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - global_time: Self::Dependency, - anim_time: f64, + _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(); + 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; - let duck_m_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.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.cardinalfish_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.cardinalfish_torso.scale = Vec3::one() / 10.88; - - next.cardinalfish_tail.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0); - next.cardinalfish_tail.scale = Vec3::one() * 1.01; + 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 } diff --git a/voxygen/src/anim/fish_small/jump.rs b/voxygen/src/anim/fish_small/jump.rs index 844ea0408d..f8088c84df 100644 --- a/voxygen/src/anim/fish_small/jump.rs +++ b/voxygen/src/anim/fish_small/jump.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, FishSmallSkeleton, }; -use std::f32::consts::PI; +//use std::f32::consts::PI; use vek::*; pub struct JumpAnimation; @@ -14,24 +14,19 @@ impl Animation for JumpAnimation { fn update_skeleton( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - anim_time: f64, + _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(); + 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.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.cardinalfish_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.cardinalfish_torso.scale = Vec3::one() / 10.88; - - next.cardinalfish_tail.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0); - next.cardinalfish_tail.scale = Vec3::one() * 1.01; + 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 } diff --git a/voxygen/src/anim/fish_small/mod.rs b/voxygen/src/anim/fish_small/mod.rs index 1164594bda..3d8b8e1184 100644 --- a/voxygen/src/anim/fish_small/mod.rs +++ b/voxygen/src/anim/fish_small/mod.rs @@ -12,26 +12,26 @@ use crate::render::FigureBoneData; #[derive(Clone)] pub struct FishSmallSkeleton { - cardinalfish_torso: Bone, - cardinalfish_tail: Bone, + torso: Bone, + tail: Bone, } impl FishSmallSkeleton { pub fn new() -> Self { Self { - cardinalfish_torso: Bone::default(), - cardinalfish_tail: Bone::default(), + torso: Bone::default(), + tail: Bone::default(), } } } impl Skeleton for FishSmallSkeleton { fn compute_matrices(&self) -> [FigureBoneData; 16] { - let torso_mat = self.cardinalfish_torso.compute_base_matrix(); + let torso_mat = self.torso.compute_base_matrix(); [ FigureBoneData::new(torso_mat), - FigureBoneData::new(self.cardinalfish_tail.compute_base_matrix() * torso_mat), + FigureBoneData::new(self.tail.compute_base_matrix() * torso_mat), FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), @@ -50,9 +50,7 @@ impl Skeleton for FishSmallSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.cardinalfish_torso - .interpolate(&target.cardinalfish_torso, dt); - self.cardinalfish_tail - .interpolate(&target.cardinalfish_tail, dt); + self.torso.interpolate(&target.torso, dt); + self.tail.interpolate(&target.tail, dt); } } diff --git a/voxygen/src/anim/fish_small/run.rs b/voxygen/src/anim/fish_small/run.rs index d11bf2a895..0f1952c9dd 100644 --- a/voxygen/src/anim/fish_small/run.rs +++ b/voxygen/src/anim/fish_small/run.rs @@ -2,7 +2,7 @@ use super::{ super::{Animation, SkeletonAttr}, FishSmallSkeleton, }; -use std::{f32::consts::PI, ops::Mul}; +//use std::{f32::consts::PI, ops::Mul}; use vek::*; pub struct RunAnimation; @@ -13,38 +13,20 @@ impl Animation for RunAnimation { fn update_skeleton( skeleton: &Self::Skeleton, - (_velocity, global_time): Self::Dependency, - anim_time: f64, + (_velocity, _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(); + 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; - let duck_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.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0; - next.cardinalfish_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.cardinalfish_torso.scale = Vec3::one() / 10.88; - - next.cardinalfish_tail.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0); - next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0); - next.cardinalfish_tail.scale = Vec3::one() * 1.01; + 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 } diff --git a/voxygen/src/anim/quadruped_medium/idle.rs b/voxygen/src/anim/quadruped_medium/idle.rs index 63c1bcd97e..54affc86f8 100644 --- a/voxygen/src/anim/quadruped_medium/idle.rs +++ b/voxygen/src/anim/quadruped_medium/idle.rs @@ -25,7 +25,7 @@ impl Animation for IdleAnimation { let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos(); - let wolf_look = Vec2::new( + let look = Vec2::new( ((global_time + anim_time) as f32 / 8.0) .floor() .mul(7331.0) @@ -37,7 +37,7 @@ impl Animation for IdleAnimation { .sin() * 0.25, ); - let wolf_tail = Vec2::new( + let tailmove = Vec2::new( ((global_time + anim_time) as f32 / 2.0) .floor() .mul(7331.0) @@ -50,52 +50,50 @@ impl Animation for IdleAnimation { * 0.125, ); - next.wolf_head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_ultra_slow * 0.4) / 11.0; - next.wolf_head_upper.ori = - Quaternion::rotation_z(wolf_look.x) * Quaternion::rotation_x(wolf_look.y); - next.wolf_head_upper.scale = Vec3::one() / 10.88; + 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.wolf_jaw.offset = - Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0 + wave_slow * 0.2); - next.wolf_jaw.ori = Quaternion::rotation_x(wave_slow * 0.05); - next.wolf_jaw.scale = Vec3::one() * 1.01; + 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.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_ultra_slow * 0.20); - next.wolf_head_lower.ori = Quaternion::rotation_z(0.0); - next.wolf_head_lower.scale = Vec3::one() * 0.98; + 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.wolf_tail.offset = Vec3::new(0.0, -13.0, 8.0 + wave_ultra_slow * 1.2) / 11.0; - next.wolf_tail.ori = Quaternion::rotation_z(0.0 + wave_slow * 0.2 + wolf_tail.x) - * Quaternion::rotation_x(wolf_tail.y); - next.wolf_tail.scale = Vec3::one() / 11.0; + 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.wolf_torso_back.offset = Vec3::new(0.0, -11.7, 11.0 + wave_ultra_slow * 1.2) / 11.0; - next.wolf_torso_back.ori = Quaternion::rotation_y(wave_slow_cos * 0.015); - next.wolf_torso_back.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.wolf_torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_ultra_slow * 0.7) / 11.0; - next.wolf_torso_mid.ori = Quaternion::rotation_y(wave_slow * 0.015); - next.wolf_torso_mid.scale = Vec3::one() / 10.5; + 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.wolf_ears.offset = Vec3::new(0.0, 0.75, 5.25); - next.wolf_ears.ori = Quaternion::rotation_x(0.0 + wave_slow * 0.1); - next.wolf_ears.scale = Vec3::one() * 1.05; + 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.wolf_foot_lf.offset = Vec3::new(-5.0, 5.0, 2.5) / 11.0; - next.wolf_foot_lf.ori = Quaternion::rotation_x(0.0); - next.wolf_foot_lf.scale = Vec3::one() / 11.0; + 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.wolf_foot_rf.offset = Vec3::new(5.0, 5.0, 2.5) / 11.0; - next.wolf_foot_rf.ori = Quaternion::rotation_x(0.0); - next.wolf_foot_rf.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.wolf_foot_lb.offset = Vec3::new(-5.0, -10.0, 2.5) / 11.0; - next.wolf_foot_lb.ori = Quaternion::rotation_x(0.0); - next.wolf_foot_lb.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.wolf_foot_rb.offset = Vec3::new(5.0, -10.0, 2.5) / 11.0; - next.wolf_foot_rb.ori = Quaternion::rotation_x(0.0); - next.wolf_foot_rb.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 } diff --git a/voxygen/src/anim/quadruped_medium/jump.rs b/voxygen/src/anim/quadruped_medium/jump.rs index 06f93aa6f7..d262a85067 100644 --- a/voxygen/src/anim/quadruped_medium/jump.rs +++ b/voxygen/src/anim/quadruped_medium/jump.rs @@ -24,56 +24,52 @@ impl Animation for JumpAnimation { 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.wolf_head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) / 11.0; - next.wolf_head_upper.ori = + 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.wolf_head_upper.scale = Vec3::one() / 10.88; + next.head_upper.scale = Vec3::one() / 10.88; - next.wolf_jaw.offset = Vec3::new(0.0, 4.5, 2.0); - next.wolf_jaw.ori = Quaternion::rotation_x(0.0); - next.wolf_jaw.scale = Vec3::one() * 1.01; + 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.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5); - next.wolf_head_lower.ori = Quaternion::rotation_x(wave_stop * -0.1); - next.wolf_head_lower.scale = Vec3::one() * 0.98; + 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.wolf_tail.offset = Vec3::new(0.0, -12.0, 8.0) / 11.0; - next.wolf_tail.ori = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25); - next.wolf_tail.scale = Vec3::one() / 11.0; + 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.wolf_torso_back.offset = + next.torso_back.offset = Vec3::new(0.0, -9.5 + wave_stop * 1.0, 11.0 + wave_stop * 2.2) / 11.0; - next.wolf_torso_back.ori = Quaternion::rotation_x(wave_slow * -0.25); - next.wolf_torso_back.scale = Vec3::one() / 11.0; + next.torso_back.ori = Quaternion::rotation_x(wave_slow * -0.25); + next.torso_back.scale = Vec3::one() / 11.0; - next.wolf_torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_stop * 3.6) / 11.0; - next.wolf_torso_mid.ori = Quaternion::rotation_x(wave_slow * -0.25); - next.wolf_torso_mid.scale = Vec3::one() / 10.5; + 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.wolf_ears.offset = Vec3::new(0.0, 0.75, 6.25); - next.wolf_ears.ori = Quaternion::rotation_x(0.0); - next.wolf_ears.scale = Vec3::one() * 1.05; + 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.wolf_foot_lf.offset = - Vec3::new(-5.0, 5.0 + wave_stop * 3.0, 5.0 + wave_stop * 7.0) / 11.0; - next.wolf_foot_lf.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15); - next.wolf_foot_lf.scale = Vec3::one() / 11.0; + 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.wolf_foot_rf.offset = - Vec3::new(5.0, 5.0 - wave_stop * 3.0, 5.0 + wave_stop * 5.0) / 11.0; - next.wolf_foot_rf.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15); - next.wolf_foot_rf.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.wolf_foot_lb.offset = + next.foot_lb.offset = Vec3::new(-5.0, -10.0 - wave_stop * 2.0, 5.0 + wave_stop * 0.0) / 11.0; - next.wolf_foot_lb.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15); - next.wolf_foot_lb.scale = Vec3::one() / 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.wolf_foot_rb.offset = - Vec3::new(5.0, -10.0 + wave_stop * 2.0, 5.0 + wave_stop * 2.0) / 11.0; - next.wolf_foot_rb.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15); - next.wolf_foot_rb.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 } diff --git a/voxygen/src/anim/quadruped_medium/mod.rs b/voxygen/src/anim/quadruped_medium/mod.rs index 1941442eac..3f294968d8 100644 --- a/voxygen/src/anim/quadruped_medium/mod.rs +++ b/voxygen/src/anim/quadruped_medium/mod.rs @@ -12,57 +12,55 @@ use crate::render::FigureBoneData; #[derive(Clone)] pub struct QuadrupedMediumSkeleton { - wolf_head_upper: Bone, - wolf_jaw: Bone, - wolf_head_lower: Bone, - wolf_tail: Bone, - wolf_torso_back: Bone, - wolf_torso_mid: Bone, - wolf_ears: Bone, - wolf_foot_lf: Bone, - wolf_foot_rf: Bone, - wolf_foot_lb: Bone, - wolf_foot_rb: Bone, + head_upper: Bone, + jaw: Bone, + head_lower: Bone, + tail: Bone, + torso_back: Bone, + torso_mid: Bone, + ears: Bone, + foot_lf: Bone, + foot_rf: Bone, + foot_lb: Bone, + foot_rb: Bone, } impl QuadrupedMediumSkeleton { pub fn new() -> Self { Self { - wolf_head_upper: Bone::default(), - wolf_jaw: Bone::default(), - wolf_head_lower: Bone::default(), - wolf_tail: Bone::default(), - wolf_torso_back: Bone::default(), - wolf_torso_mid: Bone::default(), - wolf_ears: Bone::default(), - wolf_foot_lf: Bone::default(), - wolf_foot_rf: Bone::default(), - wolf_foot_lb: Bone::default(), - wolf_foot_rb: Bone::default(), + head_upper: Bone::default(), + jaw: Bone::default(), + head_lower: Bone::default(), + tail: Bone::default(), + torso_back: Bone::default(), + torso_mid: Bone::default(), + ears: Bone::default(), + foot_lf: Bone::default(), + foot_rf: Bone::default(), + foot_lb: Bone::default(), + foot_rb: Bone::default(), } } } impl Skeleton for QuadrupedMediumSkeleton { fn compute_matrices(&self) -> [FigureBoneData; 16] { - let ears_mat = self.wolf_ears.compute_base_matrix(); - let head_upper_mat = self.wolf_head_upper.compute_base_matrix(); - let head_lower_mat = self.wolf_head_lower.compute_base_matrix(); + let ears_mat = self.ears.compute_base_matrix(); + let head_upper_mat = self.head_upper.compute_base_matrix(); + let head_lower_mat = self.head_lower.compute_base_matrix(); [ FigureBoneData::new(head_upper_mat), - FigureBoneData::new( - head_upper_mat * head_lower_mat * self.wolf_jaw.compute_base_matrix(), - ), + FigureBoneData::new(head_upper_mat * head_lower_mat * self.jaw.compute_base_matrix()), FigureBoneData::new(head_upper_mat * head_lower_mat), - FigureBoneData::new(self.wolf_tail.compute_base_matrix()), - FigureBoneData::new(self.wolf_torso_back.compute_base_matrix()), - FigureBoneData::new(self.wolf_torso_mid.compute_base_matrix()), + FigureBoneData::new(self.tail.compute_base_matrix()), + FigureBoneData::new(self.torso_back.compute_base_matrix()), + FigureBoneData::new(self.torso_mid.compute_base_matrix()), FigureBoneData::new(head_upper_mat * ears_mat), - FigureBoneData::new(self.wolf_foot_lf.compute_base_matrix()), - FigureBoneData::new(self.wolf_foot_rf.compute_base_matrix()), - FigureBoneData::new(self.wolf_foot_lb.compute_base_matrix()), - FigureBoneData::new(self.wolf_foot_rb.compute_base_matrix()), + FigureBoneData::new(self.foot_lf.compute_base_matrix()), + FigureBoneData::new(self.foot_rf.compute_base_matrix()), + FigureBoneData::new(self.foot_lb.compute_base_matrix()), + FigureBoneData::new(self.foot_rb.compute_base_matrix()), FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), @@ -72,19 +70,16 @@ impl Skeleton for QuadrupedMediumSkeleton { } fn interpolate(&mut self, target: &Self, dt: f32) { - self.wolf_head_upper - .interpolate(&target.wolf_head_upper, dt); - self.wolf_jaw.interpolate(&target.wolf_jaw, dt); - self.wolf_head_lower - .interpolate(&target.wolf_head_lower, dt); - self.wolf_tail.interpolate(&target.wolf_tail, dt); - self.wolf_torso_back - .interpolate(&target.wolf_torso_back, dt); - self.wolf_torso_mid.interpolate(&target.wolf_torso_mid, dt); - self.wolf_ears.interpolate(&target.wolf_ears, dt); - self.wolf_foot_lf.interpolate(&target.wolf_foot_lf, dt); - self.wolf_foot_rf.interpolate(&target.wolf_foot_rf, dt); - self.wolf_foot_lb.interpolate(&target.wolf_foot_lb, dt); - self.wolf_foot_rb.interpolate(&target.wolf_foot_rb, dt); + self.head_upper.interpolate(&target.head_upper, dt); + self.jaw.interpolate(&target.jaw, dt); + self.head_lower.interpolate(&target.head_lower, dt); + self.tail.interpolate(&target.tail, dt); + self.torso_back.interpolate(&target.torso_back, dt); + self.torso_mid.interpolate(&target.torso_mid, dt); + self.ears.interpolate(&target.ears, dt); + self.foot_lf.interpolate(&target.foot_lf, dt); + self.foot_rf.interpolate(&target.foot_rf, dt); + self.foot_lb.interpolate(&target.foot_lb, dt); + self.foot_rb.interpolate(&target.foot_rb, dt); } } diff --git a/voxygen/src/anim/quadruped_medium/run.rs b/voxygen/src/anim/quadruped_medium/run.rs index 5acc6d4cd8..6aea5b70b8 100644 --- a/voxygen/src/anim/quadruped_medium/run.rs +++ b/voxygen/src/anim/quadruped_medium/run.rs @@ -41,58 +41,57 @@ impl Animation for RunAnimation { * 0.125, ); - next.wolf_head_upper.offset = + next.head_upper.offset = Vec3::new(0.0, 9.5 + wave_quick_cos * 2.0, 15.0 + wave_med * 3.0) / 11.0; - next.wolf_head_upper.ori = - Quaternion::rotation_x(-0.12 + wave_quick_cos * 0.12 + wolf_look.y) - * Quaternion::rotation_z(wolf_look.x); - next.wolf_head_upper.scale = Vec3::one() / 10.88; + next.head_upper.ori = Quaternion::rotation_x(-0.12 + wave_quick_cos * 0.12 + wolf_look.y) + * Quaternion::rotation_z(wolf_look.x); + next.head_upper.scale = Vec3::one() / 10.88; - next.wolf_jaw.offset = Vec3::new(0.0, 4.5, 2.0 + wave_slow_cos * 1.0); - next.wolf_jaw.ori = Quaternion::rotation_x(wave_slow * 0.05); - next.wolf_jaw.scale = Vec3::one() * 1.01; + next.jaw.offset = Vec3::new(0.0, 4.5, 2.0 + wave_slow_cos * 1.0); + next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05); + next.jaw.scale = Vec3::one() * 1.01; - next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_med * 1.0); - next.wolf_head_lower.ori = Quaternion::rotation_z(0.0); - next.wolf_head_lower.scale = Vec3::one() * 0.98; + next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_med * 1.0); + next.head_lower.ori = Quaternion::rotation_z(0.0); + next.head_lower.scale = Vec3::one() * 0.98; - next.wolf_tail.offset = Vec3::new(0.0, -12.0, 10.0) / 11.0; - next.wolf_tail.ori = Quaternion::rotation_x(wave_quick * 0.18); - next.wolf_tail.scale = Vec3::one() / 11.0; + next.tail.offset = Vec3::new(0.0, -12.0, 10.0) / 11.0; + next.tail.ori = Quaternion::rotation_x(wave_quick * 0.18); + next.tail.scale = Vec3::one() / 11.0; - next.wolf_torso_back.offset = + next.torso_back.offset = Vec3::new(0.0, -9.5 + wave_quick_cos * 2.2, 13.0 + wave_med * 2.8) / 11.0; - next.wolf_torso_back.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.14); - next.wolf_torso_back.scale = Vec3::one() / 11.0; + next.torso_back.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.14); + next.torso_back.scale = Vec3::one() / 11.0; - next.wolf_torso_mid.offset = + next.torso_mid.offset = Vec3::new(0.0, 0.0 + wave_quick_cos * 2.2, 14.0 + wave_med * 3.2) / 11.0; - next.wolf_torso_mid.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.12); - next.wolf_torso_mid.scale = Vec3::one() / 10.5; + next.torso_mid.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.12); + next.torso_mid.scale = Vec3::one() / 10.5; - next.wolf_ears.offset = Vec3::new(0.0, 0.75 + wave * 0.4, 6.25); - next.wolf_ears.ori = Quaternion::rotation_x(wave * 0.2); - next.wolf_ears.scale = Vec3::one() * 1.05; + next.ears.offset = Vec3::new(0.0, 0.75 + wave * 0.4, 6.25); + next.ears.ori = Quaternion::rotation_x(wave * 0.2); + next.ears.scale = Vec3::one() * 1.05; - next.wolf_foot_lf.offset = + next.foot_lf.offset = Vec3::new(-5.0, 5.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0; - next.wolf_foot_lf.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8); - next.wolf_foot_lf.scale = Vec3::one() / 11.0; + next.foot_lf.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8); + next.foot_lf.scale = Vec3::one() / 11.0; - next.wolf_foot_rf.offset = + next.foot_rf.offset = Vec3::new(5.0, 5.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0; - next.wolf_foot_rf.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8); - next.wolf_foot_rf.scale = Vec3::one() / 11.0; + next.foot_rf.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8); + next.foot_rf.scale = Vec3::one() / 11.0; - next.wolf_foot_lb.offset = + next.foot_lb.offset = Vec3::new(-5.0, -10.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0; - next.wolf_foot_lb.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8); - next.wolf_foot_lb.scale = Vec3::one() / 11.0; + next.foot_lb.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8); + next.foot_lb.scale = Vec3::one() / 11.0; - next.wolf_foot_rb.offset = + next.foot_rb.offset = Vec3::new(5.0, -10.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0; - next.wolf_foot_rb.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8); - next.wolf_foot_rb.scale = Vec3::one() / 11.0; + next.foot_rb.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8); + next.foot_rb.scale = Vec3::one() / 11.0; next } diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 967c1314f5..0dd187b117 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -539,15 +539,6 @@ pub fn mesh_draw() -> Mesh { load_mesh("object.glider", Vec3::new(-26.0, -26.0, -5.0)) } -//pub fn mesh_right_equip(hand: Hand) -> Mesh { -// load_mesh( -// match hand { -// Hand::Default => "figure/body/hand", -// }, -// Vec3::new(-2.0, -2.5, -5.0), -// ) -//} - ///////// pub fn mesh_quadruped_small_head(head: quadruped_small::Head) -> Mesh { load_mesh( From 12f83cf2701e8b99b6824d2197e93ebaad6fb3cb Mon Sep 17 00:00:00 2001 From: jshipsey Date: Fri, 25 Oct 2019 22:20:38 -0400 Subject: [PATCH 10/10] rebase, small fixes --- voxygen/src/anim/quadruped_small/idle.rs | 36 +++++----- voxygen/src/anim/quadruped_small/jump.rs | 36 +++++----- voxygen/src/anim/quadruped_small/mod.rs | 48 +++++++------- voxygen/src/anim/quadruped_small/run.rs | 36 +++++----- voxygen/src/scene/figure/load.rs | 5 +- voxygen/src/scene/figure/mod.rs | 83 +++++++++++------------- 6 files changed, 117 insertions(+), 127 deletions(-) diff --git a/voxygen/src/anim/quadruped_small/idle.rs b/voxygen/src/anim/quadruped_small/idle.rs index 96f8754855..a8410db858 100644 --- a/voxygen/src/anim/quadruped_small/idle.rs +++ b/voxygen/src/anim/quadruped_small/idle.rs @@ -37,30 +37,30 @@ impl Animation for IdleAnimation { * 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) + next.head.offset = Vec3::new(0.0, -2.0, -1.5 + wave * 0.2) / 11.0; + next.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.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.chest.offset = Vec3::new(wave_slow * 0.05, -9.0, 1.5 + wave_slow_cos * 0.4) / 11.0; + next.chest.ori = Quaternion::rotation_y(wave_slow * 0.05); + next.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.leg_lf.offset = Vec3::new(-4.5, 2.0, 1.5) / 11.0; + next.leg_lf.ori = Quaternion::rotation_x(wave_slow * 0.08); + next.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.leg_rf.offset = Vec3::new(2.5, 2.0, 1.5) / 11.0; + next.leg_rf.ori = Quaternion::rotation_x(wave_slow_cos * 0.08); + next.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.leg_lb.offset = Vec3::new(-4.5, -3.0, 1.5) / 11.0; + next.leg_lb.ori = Quaternion::rotation_x(wave_slow_cos * 0.08); + next.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.leg_rb.offset = Vec3::new(2.5, -3.0, 1.5) / 11.0; + next.leg_rb.ori = Quaternion::rotation_x(wave_slow * 0.08); + next.leg_rb.scale = Vec3::one() / 11.0; next } diff --git a/voxygen/src/anim/quadruped_small/jump.rs b/voxygen/src/anim/quadruped_small/jump.rs index 62e287ef0e..11d38973b4 100644 --- a/voxygen/src/anim/quadruped_small/jump.rs +++ b/voxygen/src/anim/quadruped_small/jump.rs @@ -23,29 +23,29 @@ impl Animation for JumpAnimation { 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.head.offset = Vec3::new(0.0, 0.0, -1.5) / 11.0; + next.head.ori = Quaternion::rotation_x(wave_stop * 0.4); + next.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.chest.offset = Vec3::new(0.0, -9.0, 1.5) / 11.0; + next.chest.ori = Quaternion::rotation_x(0.0); + next.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.leg_lf.offset = Vec3::new(-4.5, 3.0, 1.5) / 11.0; + next.leg_lf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3); + next.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.leg_rf.offset = Vec3::new(2.5, 3.0, 1.5) / 11.0; + next.leg_rf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3); + next.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.leg_lb.offset = Vec3::new(-4.5, -4.0, 2.0) / 11.0; + next.leg_lb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3); + next.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.leg_rb.offset = Vec3::new(2.5, -4.0, 2.0) / 11.0; + next.leg_rb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3); + next.leg_rb.scale = Vec3::one() / 11.0; next } diff --git a/voxygen/src/anim/quadruped_small/mod.rs b/voxygen/src/anim/quadruped_small/mod.rs index 5f3c7e64b3..600bb9d2ba 100644 --- a/voxygen/src/anim/quadruped_small/mod.rs +++ b/voxygen/src/anim/quadruped_small/mod.rs @@ -12,23 +12,23 @@ use crate::render::FigureBoneData; #[derive(Clone)] pub struct QuadrupedSmallSkeleton { - pig_head: Bone, - pig_chest: Bone, - pig_leg_lf: Bone, - pig_leg_rf: Bone, - pig_leg_lb: Bone, - pig_leg_rb: Bone, + head: Bone, + chest: Bone, + leg_lf: Bone, + leg_rf: Bone, + leg_lb: Bone, + leg_rb: Bone, } impl QuadrupedSmallSkeleton { 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(), + head: Bone::default(), + chest: Bone::default(), + leg_lf: Bone::default(), + leg_rf: Bone::default(), + leg_lb: Bone::default(), + leg_rb: Bone::default(), } } } @@ -36,12 +36,12 @@ impl QuadrupedSmallSkeleton { impl Skeleton for QuadrupedSmallSkeleton { 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::new(self.head.compute_base_matrix()), + FigureBoneData::new(self.chest.compute_base_matrix()), + FigureBoneData::new(self.leg_lf.compute_base_matrix()), + FigureBoneData::new(self.leg_rf.compute_base_matrix()), + FigureBoneData::new(self.leg_lb.compute_base_matrix()), + FigureBoneData::new(self.leg_rb.compute_base_matrix()), FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), @@ -56,11 +56,11 @@ impl Skeleton for QuadrupedSmallSkeleton { } 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); + self.head.interpolate(&target.head, dt); + self.chest.interpolate(&target.chest, dt); + self.leg_lf.interpolate(&target.leg_lf, dt); + self.leg_rf.interpolate(&target.leg_rf, dt); + self.leg_lb.interpolate(&target.leg_lb, dt); + self.leg_rb.interpolate(&target.leg_rb, dt); } } diff --git a/voxygen/src/anim/quadruped_small/run.rs b/voxygen/src/anim/quadruped_small/run.rs index a6f9b877a7..c5af0a7af8 100644 --- a/voxygen/src/anim/quadruped_small/run.rs +++ b/voxygen/src/anim/quadruped_small/run.rs @@ -24,34 +24,34 @@ impl Animation for RunAnimation { let wave_quick_cos = (anim_time as f32 * 20.0).cos(); let wave_cos = (anim_time as f32 * 14.0).cos(); - next.pig_head.offset = Vec3::new(0.0, 0.0, -1.5 + wave * 1.5) / 11.0; - next.pig_head.ori = + next.head.offset = Vec3::new(0.0, 0.0, -1.5 + wave * 1.5) / 11.0; + next.head.ori = Quaternion::rotation_x(0.2 + wave * 0.05) * Quaternion::rotation_y(wave_cos * 0.03); - next.pig_head.scale = Vec3::one() / 10.5; + next.head.scale = Vec3::one() / 10.5; - next.pig_chest.offset = Vec3::new(0.0, -9.0, 1.5 + wave_cos * 1.2) / 11.0; - next.pig_chest.ori = Quaternion::rotation_x(wave * 0.1); - next.pig_chest.scale = Vec3::one() / 11.0; + next.chest.offset = Vec3::new(0.0, -9.0, 1.5 + wave_cos * 1.2) / 11.0; + next.chest.ori = Quaternion::rotation_x(wave * 0.1); + next.chest.scale = Vec3::one() / 11.0; - next.pig_leg_lf.offset = + next.leg_lf.offset = Vec3::new(-4.5, 2.0 + wave_quick * 0.8, 2.5 + wave_quick_cos * 1.5) / 11.0; - next.pig_leg_lf.ori = Quaternion::rotation_x(wave_quick * 0.3); - next.pig_leg_lf.scale = Vec3::one() / 11.0; + next.leg_lf.ori = Quaternion::rotation_x(wave_quick * 0.3); + next.leg_lf.scale = Vec3::one() / 11.0; - next.pig_leg_rf.offset = + next.leg_rf.offset = Vec3::new(2.5, 2.0 - wave_quick_cos * 0.8, 2.5 + wave_quick * 1.5) / 11.0; - next.pig_leg_rf.ori = Quaternion::rotation_x(wave_quick_cos * -0.3); - next.pig_leg_rf.scale = Vec3::one() / 11.0; + next.leg_rf.ori = Quaternion::rotation_x(wave_quick_cos * -0.3); + next.leg_rf.scale = Vec3::one() / 11.0; - next.pig_leg_lb.offset = + next.leg_lb.offset = Vec3::new(-4.5, -3.0 - wave_quick_cos * 0.8, 2.5 + wave_quick * 1.5) / 11.0; - next.pig_leg_lb.ori = Quaternion::rotation_x(wave_quick_cos * -0.3); - next.pig_leg_lb.scale = Vec3::one() / 11.0; + next.leg_lb.ori = Quaternion::rotation_x(wave_quick_cos * -0.3); + next.leg_lb.scale = Vec3::one() / 11.0; - next.pig_leg_rb.offset = + next.leg_rb.offset = Vec3::new(2.5, -3.0 + wave_quick * 0.8, 2.5 + wave_quick_cos * 1.5) / 11.0; - next.pig_leg_rb.ori = Quaternion::rotation_x(wave_quick * 0.3); - next.pig_leg_rb.scale = Vec3::one() / 11.0; + next.leg_rb.ori = Quaternion::rotation_x(wave_quick * 0.3); + next.leg_rb.scale = Vec3::one() / 11.0; next } diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 0dd187b117..18a0656ea4 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -11,10 +11,7 @@ use common::{ Belt, BodyType, Chest, EyeColor, Eyebrows, Foot, Hand, Pants, Race, Shoulder, Skin, }, item::Tool, - - object, quadruped_small, quadruped_medium, bird_medium, fish_medium, dragon, bird_small, fish_small, biped_large, Item, Itemkind - - + object, quadruped_medium, quadruped_small, Item, ItemKind, }, figure::{DynaUnionizer, MatSegment, Material, Segment}, }; diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 664d6ab937..028f15cc0f 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -6,8 +6,11 @@ pub use load::load_mesh; // TODO: Don't make this public. use crate::{ anim::{ - self, character::CharacterSkeleton, object::ObjectSkeleton, quadruped::QuadrupedSkeleton, - quadrupedmedium::QuadrupedMediumSkeleton, birdmedium::BirdMediumSkeleton, fishmedium::FishMediumSkeleton, dragon::DragonSkeleton, bird_small::BirdSmallSkeleton, fish_small::FishSmallSkeleton, biped_large::BipedLargeSkeleton, Animation, Skeleton, + self, biped_large::BipedLargeSkeleton, bird_medium::BirdMediumSkeleton, + bird_small::BirdSmallSkeleton, character::CharacterSkeleton, dragon::DragonSkeleton, + fish_medium::FishMediumSkeleton, fish_small::FishSmallSkeleton, object::ObjectSkeleton, + quadruped_medium::QuadrupedMediumSkeleton, quadruped_small::QuadrupedSmallSkeleton, + Animation, Skeleton, }, render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow}, scene::camera::{Camera, CameraMode}, @@ -30,7 +33,7 @@ const DAMAGE_FADE_COEFFICIENT: f64 = 5.0; pub struct FigureMgr { model_cache: FigureModelCache, character_states: HashMap>, - quadruped_states: HashMap>, + quadruped_small_states: HashMap>, quadruped_medium_states: HashMap>, bird_medium_states: HashMap>, fish_medium_states: HashMap>, @@ -46,7 +49,7 @@ impl FigureMgr { Self { model_cache: FigureModelCache::new(), character_states: HashMap::new(), - quadruped_states: HashMap::new(), + quadruped_small_states: HashMap::new(), quadruped_medium_states: HashMap::new(), bird_medium_states: HashMap::new(), fish_medium_states: HashMap::new(), @@ -99,8 +102,8 @@ impl FigureMgr { Body::Humanoid(_) => { self.character_states.remove(&entity); } - Body::Quadruped(_) => { - self.quadruped_states.remove(&entity); + Body::QuadrupedSmall(_) => { + self.quadruped_small_states.remove(&entity); } Body::QuadrupedMedium(_) => { self.quadruped_medium_states.remove(&entity); @@ -296,11 +299,13 @@ impl FigureMgr { action_animation_rate, ); } - Body::Quadruped(_) => { + Body::QuadrupedSmall(_) => { let state = self - .quadruped_states + .quadruped_small_states .entry(entity) - .or_insert_with(|| FigureState::new(renderer, QuadrupedSkeleton::new())); + .or_insert_with(|| { + FigureState::new(renderer, QuadrupedSmallSkeleton::new()) + }); let (character, last_character) = match (character, last_character) { (Some(c), Some(l)) => (c, l), @@ -312,22 +317,22 @@ impl FigureMgr { } let target_base = match character.movement { - Stand => anim::quadruped::IdleAnimation::update_skeleton( - &QuadrupedSkeleton::new(), + Stand => anim::quadruped_small::IdleAnimation::update_skeleton( + &QuadrupedSmallSkeleton::new(), time, state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Run => anim::quadruped::RunAnimation::update_skeleton( - &QuadrupedSkeleton::new(), + Run => anim::quadruped_small::RunAnimation::update_skeleton( + &QuadrupedSmallSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Jump => anim::quadruped::JumpAnimation::update_skeleton( - &QuadrupedSkeleton::new(), + Jump => anim::quadruped_small::JumpAnimation::update_skeleton( + &QuadrupedSmallSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, &mut movement_animation_rate, @@ -369,21 +374,21 @@ impl FigureMgr { } let target_base = match character.movement { - Stand => anim::quadrupedmedium::IdleAnimation::update_skeleton( + Stand => anim::quadruped_medium::IdleAnimation::update_skeleton( &QuadrupedMediumSkeleton::new(), time, state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Run => anim::quadrupedmedium::RunAnimation::update_skeleton( + Run => anim::quadruped_medium::RunAnimation::update_skeleton( &QuadrupedMediumSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Jump => anim::quadrupedmedium::JumpAnimation::update_skeleton( + Jump => anim::quadruped_medium::JumpAnimation::update_skeleton( &QuadrupedMediumSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, @@ -412,9 +417,7 @@ impl FigureMgr { let state = self .bird_medium_states .entry(entity) - .or_insert_with(|| { - FigureState::new(renderer, BirdMediumSkeleton::new()) - }); + .or_insert_with(|| FigureState::new(renderer, BirdMediumSkeleton::new())); let (character, last_character) = match (character, last_character) { (Some(c), Some(l)) => (c, l), @@ -426,21 +429,21 @@ impl FigureMgr { } let target_base = match character.movement { - Stand => anim::birdmedium::IdleAnimation::update_skeleton( + Stand => anim::bird_medium::IdleAnimation::update_skeleton( &BirdMediumSkeleton::new(), time, state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Run => anim::birdmedium::RunAnimation::update_skeleton( + Run => anim::bird_medium::RunAnimation::update_skeleton( &BirdMediumSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Jump => anim::birdmedium::JumpAnimation::update_skeleton( + Jump => anim::bird_medium::JumpAnimation::update_skeleton( &BirdMediumSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, @@ -469,9 +472,7 @@ impl FigureMgr { let state = self .fish_medium_states .entry(entity) - .or_insert_with(|| { - FigureState::new(renderer, FishMediumSkeleton::new()) - }); + .or_insert_with(|| FigureState::new(renderer, FishMediumSkeleton::new())); let (character, last_character) = match (character, last_character) { (Some(c), Some(l)) => (c, l), @@ -483,21 +484,21 @@ impl FigureMgr { } let target_base = match character.movement { - Stand => anim::fishmedium::IdleAnimation::update_skeleton( + Stand => anim::fish_medium::IdleAnimation::update_skeleton( &FishMediumSkeleton::new(), time, state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Run => anim::fishmedium::RunAnimation::update_skeleton( + Run => anim::fish_medium::RunAnimation::update_skeleton( &FishMediumSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, &mut movement_animation_rate, skeleton_attr, ), - Jump => anim::fishmedium::JumpAnimation::update_skeleton( + Jump => anim::fish_medium::JumpAnimation::update_skeleton( &FishMediumSkeleton::new(), (vel.0.magnitude(), time), state.movement_time, @@ -526,9 +527,7 @@ impl FigureMgr { let state = self .dragon_states .entry(entity) - .or_insert_with(|| { - FigureState::new(renderer, DragonSkeleton::new()) - }); + .or_insert_with(|| FigureState::new(renderer, DragonSkeleton::new())); let (character, last_character) = match (character, last_character) { (Some(c), Some(l)) => (c, l), @@ -583,9 +582,7 @@ impl FigureMgr { let state = self .bird_small_states .entry(entity) - .or_insert_with(|| { - FigureState::new(renderer, BirdSmallSkeleton::new()) - }); + .or_insert_with(|| FigureState::new(renderer, BirdSmallSkeleton::new())); let (character, last_character) = match (character, last_character) { (Some(c), Some(l)) => (c, l), @@ -640,9 +637,7 @@ impl FigureMgr { let state = self .fish_small_states .entry(entity) - .or_insert_with(|| { - FigureState::new(renderer,FishSmallSkeleton::new()) - }); + .or_insert_with(|| FigureState::new(renderer, FishSmallSkeleton::new())); let (character, last_character) = match (character, last_character) { (Some(c), Some(l)) => (c, l), @@ -697,9 +692,7 @@ impl FigureMgr { let state = self .biped_large_states .entry(entity) - .or_insert_with(|| { - FigureState::new(renderer, BipedLargeSkeleton::new()) - }); + .or_insert_with(|| FigureState::new(renderer, BipedLargeSkeleton::new())); let (character, last_character) = match (character, last_character) { (Some(c), Some(l)) => (c, l), @@ -775,7 +768,7 @@ impl FigureMgr { // Clear states that have dead entities. self.character_states .retain(|entity, _| ecs.entities().is_alive(*entity)); - self.quadruped_states + self.quadruped_small_states .retain(|entity, _| ecs.entities().is_alive(*entity)); self.quadruped_medium_states .retain(|entity, _| ecs.entities().is_alive(*entity)); @@ -840,8 +833,8 @@ impl FigureMgr { .character_states .get(&entity) .map(|state| (state.locals(), state.bone_consts())), - Body::Quadruped(_) => self - .quadruped_states + Body::QuadrupedSmall(_) => self + .quadruped_small_states .get(&entity) .map(|state| (state.locals(), state.bone_consts())), Body::QuadrupedMedium(_) => self