From 7f2276324e94a189253a9cffb277e529975b81b0 Mon Sep 17 00:00:00 2001 From: Snowram Date: Sat, 27 Feb 2021 23:21:03 +0100 Subject: [PATCH] Reduces the instances of f64 in anims --- voxygen/anim/src/biped_large/alpha.rs | 26 +- voxygen/anim/src/biped_large/beam.rs | 36 +- voxygen/anim/src/biped_large/beta.rs | 26 +- voxygen/anim/src/biped_large/charge.rs | 31 +- voxygen/anim/src/biped_large/dash.rs | 28 +- voxygen/anim/src/biped_large/equip.rs | 8 +- voxygen/anim/src/biped_large/idle.rs | 31 +- voxygen/anim/src/biped_large/jump.rs | 10 +- voxygen/anim/src/biped_large/leapmelee.rs | 12 +- voxygen/anim/src/biped_large/run.rs | 66 ++-- voxygen/anim/src/biped_large/shockwave.rs | 10 +- voxygen/anim/src/biped_large/shoot.rs | 49 ++- voxygen/anim/src/biped_large/spin.rs | 24 +- voxygen/anim/src/biped_large/spinmelee.rs | 28 +- voxygen/anim/src/biped_large/wield.rs | 69 ++-- voxygen/anim/src/biped_small/alpha.rs | 16 +- voxygen/anim/src/biped_small/dash.rs | 18 +- voxygen/anim/src/biped_small/idle.rs | 6 +- voxygen/anim/src/biped_small/run.rs | 56 ++- voxygen/anim/src/biped_small/shoot.rs | 22 +- voxygen/anim/src/biped_small/wield.rs | 10 +- voxygen/anim/src/bird_medium/feed.rs | 22 +- voxygen/anim/src/bird_medium/fly.rs | 14 +- voxygen/anim/src/bird_medium/idle.rs | 20 +- voxygen/anim/src/bird_medium/run.rs | 14 +- voxygen/anim/src/bird_small/idle.rs | 4 +- voxygen/anim/src/bird_small/jump.rs | 4 +- voxygen/anim/src/bird_small/run.rs | 4 +- voxygen/anim/src/character/alpha.rs | 22 +- voxygen/anim/src/character/beam.rs | 10 +- voxygen/anim/src/character/beta.rs | 10 +- voxygen/anim/src/character/block.rs | 4 +- voxygen/anim/src/character/chargeswing.rs | 25 +- voxygen/anim/src/character/climb.rs | 39 +- voxygen/anim/src/character/dance.rs | 37 +- voxygen/anim/src/character/dash.rs | 20 +- voxygen/anim/src/character/equip.rs | 8 +- voxygen/anim/src/character/glidewield.rs | 4 +- voxygen/anim/src/character/gliding.rs | 34 +- voxygen/anim/src/character/idle.rs | 18 +- voxygen/anim/src/character/jump.rs | 18 +- voxygen/anim/src/character/leapmelee.rs | 12 +- voxygen/anim/src/character/repeater.rs | 12 +- voxygen/anim/src/character/roll.rs | 10 +- voxygen/anim/src/character/run.rs | 60 ++- voxygen/anim/src/character/shockwave.rs | 10 +- voxygen/anim/src/character/shoot.rs | 24 +- voxygen/anim/src/character/sit.rs | 22 +- voxygen/anim/src/character/sneak.rs | 57 ++- voxygen/anim/src/character/spin.rs | 16 +- voxygen/anim/src/character/spinmelee.rs | 10 +- voxygen/anim/src/character/staggered.rs | 12 +- voxygen/anim/src/character/stand.rs | 18 +- voxygen/anim/src/character/stunned.rs | 12 +- voxygen/anim/src/character/swim.rs | 32 +- voxygen/anim/src/character/swimwield.rs | 51 +-- voxygen/anim/src/character/talk.rs | 10 +- voxygen/anim/src/character/wield.rs | 48 +-- voxygen/anim/src/dragon/fly.rs | 24 +- voxygen/anim/src/dragon/idle.rs | 22 +- voxygen/anim/src/dragon/run.rs | 41 +-- voxygen/anim/src/fish_medium/idle.rs | 8 +- voxygen/anim/src/fish_medium/swim.rs | 6 +- voxygen/anim/src/fish_small/idle.rs | 6 +- voxygen/anim/src/fish_small/swim.rs | 4 +- voxygen/anim/src/golem/alpha.rs | 12 +- voxygen/anim/src/golem/idle.rs | 20 +- voxygen/anim/src/golem/run.rs | 42 +-- voxygen/anim/src/golem/shockwave.rs | 10 +- voxygen/anim/src/golem/spinmelee.rs | 8 +- voxygen/anim/src/lib.rs | 6 +- voxygen/anim/src/object/beam.rs | 2 +- voxygen/anim/src/object/idle.rs | 4 +- voxygen/anim/src/object/shoot.rs | 8 +- voxygen/anim/src/quadruped_low/alpha.rs | 12 +- voxygen/anim/src/quadruped_low/beta.rs | 12 +- voxygen/anim/src/quadruped_low/breathe.rs | 12 +- voxygen/anim/src/quadruped_low/dash.rs | 22 +- voxygen/anim/src/quadruped_low/idle.rs | 22 +- voxygen/anim/src/quadruped_low/jump.rs | 4 +- voxygen/anim/src/quadruped_low/run.rs | 53 ++- voxygen/anim/src/quadruped_low/shoot.rs | 10 +- voxygen/anim/src/quadruped_low/stunned.rs | 16 +- voxygen/anim/src/quadruped_low/tailwhip.rs | 28 +- voxygen/anim/src/quadruped_medium/alpha.rs | 12 +- voxygen/anim/src/quadruped_medium/beta.rs | 12 +- voxygen/anim/src/quadruped_medium/dash.rs | 24 +- voxygen/anim/src/quadruped_medium/feed.rs | 29 +- voxygen/anim/src/quadruped_medium/hoof.rs | 16 +- voxygen/anim/src/quadruped_medium/idle.rs | 32 +- voxygen/anim/src/quadruped_medium/jump.rs | 4 +- .../anim/src/quadruped_medium/leapmelee.rs | 14 +- voxygen/anim/src/quadruped_medium/run.rs | 48 +-- voxygen/anim/src/quadruped_medium/stunned.rs | 16 +- voxygen/anim/src/quadruped_small/alpha.rs | 12 +- voxygen/anim/src/quadruped_small/feed.rs | 22 +- voxygen/anim/src/quadruped_small/idle.rs | 20 +- voxygen/anim/src/quadruped_small/jump.rs | 4 +- voxygen/anim/src/quadruped_small/run.rs | 18 +- voxygen/anim/src/quadruped_small/stunned.rs | 16 +- voxygen/anim/src/theropod/alpha.rs | 12 +- voxygen/anim/src/theropod/beta.rs | 12 +- voxygen/anim/src/theropod/idle.rs | 18 +- voxygen/anim/src/theropod/jump.rs | 4 +- voxygen/anim/src/theropod/run.rs | 25 +- voxygen/src/scene/figure/mod.rs | 348 +++++++++--------- voxygen/src/scene/simple.rs | 9 +- 107 files changed, 1079 insertions(+), 1391 deletions(-) diff --git a/voxygen/anim/src/biped_large/alpha.rs b/voxygen/anim/src/biped_large/alpha.rs index 3ccdc2c8ec..56669e6937 100644 --- a/voxygen/anim/src/biped_large/alpha.rs +++ b/voxygen/anim/src/biped_large/alpha.rs @@ -15,7 +15,7 @@ impl Animation for AlphaAnimation { Option, Option, Vec3, - f64, + f32, Option, f32, ); @@ -29,7 +29,7 @@ impl Animation for AlphaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -37,21 +37,19 @@ impl Animation for AlphaAnimation { let mut next = (*skeleton).clone(); let speed = Vec2::::from(velocity).magnitude(); - let lab = 0.65 * s_a.tempo; + let lab: f32 = 0.65 * s_a.tempo; let speednorm = (speed / 12.0).powf(0.4); - let foothoril = (acc_vel * lab as f32 + PI * 1.45).sin() * speednorm; - let foothorir = (acc_vel * lab as f32 + PI * (0.45)).sin() * speednorm; - let footrotl = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 1.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 1.4).sin()); + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()); - let footrotr = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 0.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 0.4).sin()); + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()); let (move1base, move2base, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; diff --git a/voxygen/anim/src/biped_large/beam.rs b/voxygen/anim/src/biped_large/beam.rs index 0c0d034666..ae31a4121c 100644 --- a/voxygen/anim/src/biped_large/beam.rs +++ b/voxygen/anim/src/biped_large/beam.rs @@ -11,7 +11,7 @@ impl Animation for BeamAnimation { type Dependency = ( Option, Option, - f64, + f32, Vec3, Option, f32, @@ -26,7 +26,7 @@ impl Animation for BeamAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _global_time, velocity, stage_section, acc_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -35,19 +35,17 @@ impl Animation for BeamAnimation { let speed = Vec2::::from(velocity).magnitude(); - let lab = 0.65 * s_a.tempo; + let lab: f32 = 0.65 * s_a.tempo; let speednorm = (speed / 12.0).powf(0.4); - let foothoril = (acc_vel * lab as f32 + PI * 1.45).sin() * speednorm; - let foothorir = (acc_vel * lab as f32 + PI * (0.45)).sin() * speednorm; - let footrotl = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 1.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 1.4).sin()) - * speednorm; + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()) + * speednorm; - let footrotr = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 0.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 0.4).sin()) - * speednorm; + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()) + * speednorm; next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); next.jaw.orientation = Quaternion::rotation_x(0.0); @@ -64,18 +62,18 @@ impl Animation for BeamAnimation { Some(ToolKind::StaffSimple) | Some(ToolKind::Sceptre) => { let (move1base, move2shake, _move2base, move3) = match stage_section { Some(StageSection::Buildup) => ( - ((anim_time as f32).powf(0.25)).min(1.0), - (anim_time as f32 * 10.0 + PI).sin(), - (anim_time as f32 * 10.0 + PI).sin(), + (anim_time.powf(0.25)).min(1.0), + (anim_time * 10.0 + PI).sin(), + (anim_time * 10.0 + PI).sin(), 0.0, ), Some(StageSection::Cast) => ( 1.0, - (anim_time as f32 * 10.0 + PI).sin(), - (anim_time as f32).powf(0.25), + (anim_time * 10.0 + PI).sin(), + anim_time.powf(0.25), 0.0, ), - Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32), + Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; diff --git a/voxygen/anim/src/biped_large/beta.rs b/voxygen/anim/src/biped_large/beta.rs index a517b7559b..e7755fb41d 100644 --- a/voxygen/anim/src/biped_large/beta.rs +++ b/voxygen/anim/src/biped_large/beta.rs @@ -15,7 +15,7 @@ impl Animation for BetaAnimation { Option, Option, Vec3, - f64, + f32, Option, f32, ); @@ -28,7 +28,7 @@ impl Animation for BetaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -36,21 +36,19 @@ impl Animation for BetaAnimation { let mut next = (*skeleton).clone(); let speed = Vec2::::from(velocity).magnitude(); - let lab = 0.65 * s_a.tempo; + let lab: f32 = 0.65 * s_a.tempo; let speednorm = (speed / 12.0).powf(0.4); - let foothoril = (acc_vel * lab as f32 + PI * 1.45).sin() * speednorm; - let foothorir = (acc_vel * lab as f32 + PI * (0.45)).sin() * speednorm; - let footrotl = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 1.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 1.4).sin()); + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()); - let footrotr = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 0.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 0.4).sin()); + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()); let (move1base, move2base, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(6)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(6)), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; diff --git a/voxygen/anim/src/biped_large/charge.rs b/voxygen/anim/src/biped_large/charge.rs index 8d5fc46a29..6982fcb1ca 100644 --- a/voxygen/anim/src/biped_large/charge.rs +++ b/voxygen/anim/src/biped_large/charge.rs @@ -13,7 +13,7 @@ impl Animation for ChargeAnimation { f32, Vec3, Vec3, - f64, + f32, ); type Skeleton = BipedLargeSkeleton; @@ -24,29 +24,24 @@ impl Animation for ChargeAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, velocity, orientation, last_ori, _global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 1.0; + let lab: f32 = 1.0; - let foot = (((5.0) / (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0).sin()); - let foote = (((5.0) - / (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 8.0 + 1.57).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0).sin()); - let stress = - (((5.0) / (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 20.0).cos()).powi(2))).sqrt()) - * ((anim_time as f32 * lab as f32 * 20.0).cos()); - let quick = (((5.0) / (3.5 + 1.5 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0).sin()); - let stop = ((anim_time as f32).powf(0.3)).min(1.2); - let stopa = ((anim_time as f32).powf(0.9)).min(5.0); + let foot = ((5.0 / (0.2 + 4.8 * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 8.0).sin()); + let foote = ((5.0 / (0.5 + 4.5 * ((anim_time * lab * 8.0 + 1.57).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 8.0).sin()); + let stress = ((5.0 / (0.5 + 4.5 * ((anim_time * lab * 20.0).cos()).powi(2))).sqrt()) + * ((anim_time * lab * 20.0).cos()); + let quick = ((5.0 / (3.5 + 1.5 * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 8.0).sin()); + let stop = (anim_time.powf(0.3)).min(1.2); + let stopa = (anim_time.powf(0.9)).min(5.0); let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); diff --git a/voxygen/anim/src/biped_large/dash.rs b/voxygen/anim/src/biped_large/dash.rs index 4de15fdb23..e9d65502f5 100644 --- a/voxygen/anim/src/biped_large/dash.rs +++ b/voxygen/anim/src/biped_large/dash.rs @@ -12,7 +12,7 @@ impl Animation for DashAnimation { Option, Option, Vec3, - f64, + f32, Option, f32, ); @@ -26,25 +26,23 @@ impl Animation for DashAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; let mut next = (*skeleton).clone(); - let lab = 0.65 * s_a.tempo; + let lab: f32 = 0.65 * s_a.tempo; let speed = Vec2::::from(velocity).magnitude(); let speednorm = (speed / 12.0).powf(0.4); - let foothoril = (acc_vel * lab as f32 + PI * 1.45).sin() * speednorm; - let foothorir = (acc_vel * lab as f32 + PI * (0.45)).sin() * speednorm; - let footrotl = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 1.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 1.4).sin()); + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()); - let footrotr = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 0.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 0.4).sin()); + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()); next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_x(0.0); @@ -55,10 +53,10 @@ impl Animation for DashAnimation { next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0); let (move1base, move2base, move3base, move4) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0), - Some(StageSection::Charge) => (1.0, ((anim_time as f32).powf(4.0)).min(1.0), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(4.0), 0.0), - Some(StageSection::Recover) => (1.1, 1.0, 1.0, (anim_time as f32).powf(4.0)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0), + Some(StageSection::Charge) => (1.0, (anim_time.powf(4.0)).min(1.0), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(4.0), 0.0), + Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time.powf(4.0)), _ => (0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - move4; diff --git a/voxygen/anim/src/biped_large/equip.rs b/voxygen/anim/src/biped_large/equip.rs index 8dbd2bac71..d31485ca5e 100644 --- a/voxygen/anim/src/biped_large/equip.rs +++ b/voxygen/anim/src/biped_large/equip.rs @@ -8,7 +8,7 @@ use std::f32::consts::PI; pub struct EquipAnimation; impl Animation for EquipAnimation { - type Dependency = (Option, Option, f32, f64); + type Dependency = (Option, Option, f32, f32); type Skeleton = BipedLargeSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,15 +19,15 @@ impl Animation for EquipAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _velocity, _global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; let mut next = (*skeleton).clone(); - let equip_slow = 1.0 + (anim_time as f32 * 12.0 + PI).cos(); - let equip_slowa = 1.0 + (anim_time as f32 * 12.0 + PI / 4.0).cos(); + let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos(); + let equip_slowa = 1.0 + (anim_time * 12.0 + PI / 4.0).cos(); next.hand_l.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(-1.57); next.hand_r.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57); next.control.position = Vec3::new(equip_slowa * -1.5, 0.0, equip_slow * 1.5); diff --git a/voxygen/anim/src/biped_large/idle.rs b/voxygen/anim/src/biped_large/idle.rs index ab32350116..5360b118c7 100644 --- a/voxygen/anim/src/biped_large/idle.rs +++ b/voxygen/anim/src/biped_large/idle.rs @@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = (Option, Option, f64); + type Dependency = (Option, Option, f32); type Skeleton = BipedLargeSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,29 +18,21 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 1.0; - let torso = (anim_time as f32 * lab as f32 + 1.5 * PI).sin() * 1.5; + let lab: f32 = 1.0; + let torso = (anim_time * lab + 1.5 * PI).sin() * 1.5; - let slower = (anim_time as f32 * 2.0 + PI).sin() * 1.5; - let slow = (anim_time as f32 * 7.0 + PI).sin() * 1.5; + let slower = (anim_time * 2.0 + PI).sin() * 1.5; + let slow = (anim_time * 7.0 + PI).sin() * 1.5; let look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); let breathe = if s_a.beast { @@ -49,11 +41,8 @@ impl Animation for IdleAnimation { let lenght = 1.5; let chop = 0.2; let chop_freq = 60.0; - intensity * (lenght * anim_time as f32).sin() - + 0.05 - * chop - * (anim_time as f32 * chop_freq).sin() - * (anim_time as f32 * lenght).cos() + intensity * (lenght * anim_time).sin() + + 0.05 * chop * (anim_time * chop_freq).sin() * (anim_time * lenght).cos() } else { 0.0 }; diff --git a/voxygen/anim/src/biped_large/jump.rs b/voxygen/anim/src/biped_large/jump.rs index 023db4fe62..dd5e0ebfa7 100644 --- a/voxygen/anim/src/biped_large/jump.rs +++ b/voxygen/anim/src/biped_large/jump.rs @@ -8,7 +8,7 @@ use std::f32::consts::PI; pub struct JumpAnimation; impl Animation for JumpAnimation { - type Dependency = (Option, Option, f64); + type Dependency = (Option, Option, f32); type Skeleton = BipedLargeSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,16 +18,16 @@ impl Animation for JumpAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 1.0; - let torso = (anim_time as f32 * lab as f32 + 1.5 * PI).sin(); + let lab: f32 = 1.0; + let torso = (anim_time * lab + 1.5 * PI).sin(); - let wave_slow = (anim_time as f32 * 0.8).sin(); + let wave_slow = (anim_time * 0.8).sin(); next.head.scale = Vec3::one() * 1.02; diff --git a/voxygen/anim/src/biped_large/leapmelee.rs b/voxygen/anim/src/biped_large/leapmelee.rs index 5e9255a4aa..e7eada8b2e 100644 --- a/voxygen/anim/src/biped_large/leapmelee.rs +++ b/voxygen/anim/src/biped_large/leapmelee.rs @@ -10,7 +10,7 @@ impl Animation for LeapAnimation { Option, Option, Vec3, - f64, + f32, Option, ); type Skeleton = BipedLargeSkeleton; @@ -23,7 +23,7 @@ impl Animation for LeapAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -31,10 +31,10 @@ impl Animation for LeapAnimation { let mut next = (*skeleton).clone(); let (movement1, movement2, movement3, movement4) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0, 0.0), - Some(StageSection::Movement) => (1.0, (anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0), + Some(StageSection::Movement) => (1.0, anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/biped_large/run.rs b/voxygen/anim/src/biped_large/run.rs index 0cb9948bc4..7b42745169 100644 --- a/voxygen/anim/src/biped_large/run.rs +++ b/voxygen/anim/src/biped_large/run.rs @@ -13,7 +13,7 @@ type RunAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, Vec3, f32, ); @@ -37,7 +37,7 @@ impl Animation for RunAnimation { avg_vel, acc_vel, ): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -47,20 +47,18 @@ impl Animation for RunAnimation { *rate = 1.0; - let lab = 0.65 * s_a.tempo; + let lab: f32 = 0.65 * s_a.tempo; let speednorm = (speed / 12.0).powf(0.6); let speednormlow = (speed / 12.0).powf(4.0); - let footvertl = (acc_vel * lab as f32 + PI * -0.2).sin() * speednorm; - let footvertr = (acc_vel * lab as f32 + PI * -1.2).sin() * speednorm; + let footvertl = (acc_vel * lab + PI * -0.2).sin() * speednorm; + let footvertr = (acc_vel * lab + PI * -1.2).sin() * speednorm; - let footrotl = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 1.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 1.4).sin()); + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()); - let footrotr = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 0.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 0.4).sin()); + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()); let amplitude = (speed / 21.0).max(0.25); let amplitude2 = (speed * 1.4 / 21.0).sqrt().max(0.6); @@ -68,20 +66,12 @@ impl Animation for RunAnimation { let speedmult = 1.0; let canceler = (speed / 21.0).sqrt(); - let short = (acc_vel * lab as f32 * speedmult).sin(); + let short = (acc_vel * lab * speedmult).sin(); // - let shortalt = (acc_vel * lab as f32 * speedmult + PI * 3.0 + 0.7).sin(); + let shortalt = (acc_vel * lab * speedmult + PI * 3.0 + 0.7).sin(); let look = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.25, ); let speedadjust = if speed < 5.0 { 0.0 } else { speed / 21.0 }; @@ -91,19 +81,19 @@ impl Animation for RunAnimation { let shift4 = speedadjust - PI * 3.0 / 4.0 + speedadjust * PI / 2.0; //FL - let foot1a = (acc_vel * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift1).sin(); - let foot1b = (acc_vel * lab as f32 * speedmult + 1.1 + canceler * 0.05 + shift1).sin(); + let foot1a = (acc_vel * lab * speedmult + 0.0 + canceler * 0.05 + shift1).sin(); + let foot1b = (acc_vel * lab * speedmult + 1.1 + canceler * 0.05 + shift1).sin(); //FR - let foot2a = (acc_vel * lab as f32 * speedmult + shift2).sin(); - let foot2b = (acc_vel * lab as f32 * speedmult + 1.1 + shift2).sin(); + let foot2a = (acc_vel * lab * speedmult + shift2).sin(); + let foot2b = (acc_vel * lab * speedmult + 1.1 + shift2).sin(); //BL - let foot3a = (acc_vel * lab as f32 * speedmult + shift3).sin(); - let foot3b = (acc_vel * lab as f32 * speedmult + 0.3 + shift3).sin(); + let foot3a = (acc_vel * lab * speedmult + shift3).sin(); + let foot3b = (acc_vel * lab * speedmult + 0.3 + shift3).sin(); //BR - let foot4a = (acc_vel * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift4).sin(); - let foot4b = (acc_vel * lab as f32 * speedmult + 1.57 + canceler * 0.05 + shift4).sin(); + let foot4a = (acc_vel * lab * speedmult + 0.0 + canceler * 0.05 + shift4).sin(); + let foot4b = (acc_vel * lab * speedmult + 1.57 + canceler * 0.05 + shift4).sin(); // - let slow = (acc_vel * lab as f32 * speedmult + PI).sin(); + let slow = (acc_vel * lab * speedmult + PI).sin(); let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); @@ -119,12 +109,12 @@ impl Animation for RunAnimation { 0.0 } * 1.3; - let foothoril = (acc_vel * lab as f32 + PI * 1.45).sin() * speednorm; - let foothorir = (acc_vel * lab as f32 + PI * (0.45)).sin() * speednorm; - let footstrafel = (acc_vel * lab as f32 + PI * 1.45).sin(); - let footstrafer = (acc_vel * lab as f32 + PI * (0.95)).sin(); - let footvertsl = (acc_vel * lab as f32).sin(); - let footvertsr = (acc_vel * lab as f32 + PI * 0.5).sin(); + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footstrafel = (acc_vel * lab + PI * 1.45).sin(); + let footstrafer = (acc_vel * lab + PI * (0.95)).sin(); + let footvertsl = (acc_vel * lab).sin(); + let footvertsr = (acc_vel * lab + PI * 0.5).sin(); let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x; let side = diff --git a/voxygen/anim/src/biped_large/shockwave.rs b/voxygen/anim/src/biped_large/shockwave.rs index efbb9f5a2c..07d8d6b76f 100644 --- a/voxygen/anim/src/biped_large/shockwave.rs +++ b/voxygen/anim/src/biped_large/shockwave.rs @@ -10,7 +10,7 @@ impl Animation for ShockwaveAnimation { type Dependency = ( Option, Option, - f64, + f32, f32, Option, ); @@ -24,7 +24,7 @@ impl Animation for ShockwaveAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, _global_time, velocity, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -32,9 +32,9 @@ impl Animation for ShockwaveAnimation { let mut next = (*skeleton).clone(); let (movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/biped_large/shoot.rs b/voxygen/anim/src/biped_large/shoot.rs index a4b5c94976..def34fd2b0 100644 --- a/voxygen/anim/src/biped_large/shoot.rs +++ b/voxygen/anim/src/biped_large/shoot.rs @@ -16,7 +16,7 @@ type ShootAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, Option, f32, ); @@ -40,7 +40,7 @@ impl Animation for ShootAnimation { stage_section, acc_vel, ): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -49,19 +49,17 @@ impl Animation for ShootAnimation { let mut next = (*skeleton).clone(); - let lab = 0.65 * s_a.tempo; + let lab: f32 = 0.65 * s_a.tempo; let speednorm = (speed / 12.0).powf(0.4); - let foothoril = (acc_vel * lab as f32 + PI * 1.45).sin() * speednorm; - let foothorir = (acc_vel * lab as f32 + PI * (0.45)).sin() * speednorm; - let footrotl = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 1.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 1.4).sin()) - * speednorm; + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()) + * speednorm; - let footrotr = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 0.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 0.4).sin()) - * speednorm; + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()) + * speednorm; next.shoulder_l.position = Vec3::new( -s_a.shoulder.0, @@ -92,14 +90,11 @@ impl Animation for ShootAnimation { match active_tool_kind { Some(ToolKind::StaffSimple) | Some(ToolKind::Sceptre) => { let (move1base, move1shake, move2base, move3) = match stage_section { - Some(StageSection::Buildup) => ( - anim_time as f32, - (anim_time as f32 * 10.0 + PI).sin(), - 0.0, - 0.0, - ), - Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => { + (anim_time, (anim_time * 10.0 + PI).sin(), 0.0, 0.0) + }, + Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; @@ -146,9 +141,9 @@ impl Animation for ShootAnimation { }, Some(ToolKind::BowSimple) => { let (move1base, move2base, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; @@ -191,9 +186,9 @@ impl Animation for ShootAnimation { }, Some(ToolKind::Unique(UniqueKind::WendigoMagic)) => { let (move1base, _move2base, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; diff --git a/voxygen/anim/src/biped_large/spin.rs b/voxygen/anim/src/biped_large/spin.rs index 7d9f15007f..873e816707 100644 --- a/voxygen/anim/src/biped_large/spin.rs +++ b/voxygen/anim/src/biped_large/spin.rs @@ -11,7 +11,7 @@ impl Animation for SpinAnimation { type Dependency = ( Option, Option, - f64, + f32, Option, ); type Skeleton = BipedLargeSkeleton; @@ -23,31 +23,29 @@ impl Animation for SpinAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; let mut next = (*skeleton).clone(); - let lab = 1.0; + let lab: f32 = 1.0; let (movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(1.8), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powf(1.8), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; - let foot = (((5.0) - / (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 10.32).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 10.32).sin()); + let foot = ((5.0 / (1.1 + 3.9 * ((anim_time * lab * 10.32).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 10.32).sin()); - let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin(); + let decel = (anim_time * 16.0 * lab).min(PI / 2.0).sin(); - let spin = (anim_time as f32 * 2.8 * lab as f32).sin(); - let spinhalf = (anim_time as f32 * 1.4 * lab as f32).sin(); + let spin = (anim_time * 2.8 * lab).sin(); + let spinhalf = (anim_time * 1.4 * lab).sin(); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); diff --git a/voxygen/anim/src/biped_large/spinmelee.rs b/voxygen/anim/src/biped_large/spinmelee.rs index 7e549e9b4f..c86c788b83 100644 --- a/voxygen/anim/src/biped_large/spinmelee.rs +++ b/voxygen/anim/src/biped_large/spinmelee.rs @@ -12,7 +12,7 @@ impl Animation for SpinMeleeAnimation { Option, Option, Vec3, - f64, + f32, Option, ); type Skeleton = BipedLargeSkeleton; @@ -25,41 +25,41 @@ impl Animation for SpinMeleeAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; - let lab = 1.0; + let lab: f32 = 1.0; let (_movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; let speed = Vec2::::from(velocity).magnitude(); let mut next = (*skeleton).clone(); //torso movement let xshift = if velocity.z.abs() < 0.1 { - ((anim_time as f32 - 1.1) * lab as f32 * 3.0).sin() + ((anim_time - 1.1) * lab * 3.0).sin() } else { 0.0 }; let yshift = if velocity.z.abs() < 0.1 { - ((anim_time as f32 - 1.1) * lab as f32 * 3.0 + PI / 2.0).sin() + ((anim_time - 1.1) * lab * 3.0 + PI / 2.0).sin() } else { 0.0 }; let spin = if anim_time < 1.1 && velocity.z.abs() < 0.1 { - 0.5 * ((anim_time as f32).powi(2)) + 0.5 * (anim_time.powi(2)) } else { - lab as f32 * anim_time as f32 * 0.9 + lab * anim_time * 0.9 }; //feet - let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin(); - let quick = (anim_time as f32 * lab as f32 * 8.0).sin(); + let slowersmooth = (anim_time * lab * 4.0).sin(); + let quick = (anim_time * lab * 8.0).sin(); match active_tool_kind { Some(ToolKind::Sword) => { @@ -111,8 +111,8 @@ impl Animation for SpinMeleeAnimation { * Quaternion::rotation_x(0.7) * Quaternion::rotation_y(0.0); next.torso.position = Vec3::new( - -xshift * (anim_time as f32).min(0.6), - -yshift * (anim_time as f32).min(0.6), + -xshift * anim_time.min(0.6), + -yshift * anim_time.min(0.6), 0.0, ); next.torso.orientation = Quaternion::rotation_z(spin * -16.0) diff --git a/voxygen/anim/src/biped_large/wield.rs b/voxygen/anim/src/biped_large/wield.rs index b7bf517c64..36a818c39b 100644 --- a/voxygen/anim/src/biped_large/wield.rs +++ b/voxygen/anim/src/biped_large/wield.rs @@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct WieldAnimation; impl Animation for WieldAnimation { - type Dependency = (Option, Option, Vec3, f64, f32); + type Dependency = (Option, Option, Vec3, f32, f32); type Skeleton = BipedLargeSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,52 +18,34 @@ impl Animation for WieldAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, velocity, global_time, acc_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let speed = Vec2::::from(velocity).magnitude(); - let lab = 0.65 * s_a.tempo; //.65 - let torso = (anim_time as f32 * lab as f32 + 1.5 * PI).sin(); + let lab: f32 = 0.65 * s_a.tempo; //.65 + let torso = (anim_time * lab + 1.5 * PI).sin(); let speednorm = (speed / 12.0).powf(0.4); - let foothoril = (acc_vel * lab as f32 + PI * 1.45).sin() * speednorm; - let foothorir = (acc_vel * lab as f32 + PI * (0.45)).sin() * speednorm; - let footrotl = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 1.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 1.4).sin()); + let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 1.4).sin()); - let footrotr = - (((1.0) / (0.5 + (0.5) * ((acc_vel * lab as f32 + PI * 0.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 0.4).sin()); - let slower = (anim_time as f32 * 1.0 + PI).sin(); - let slow = (anim_time as f32 * 3.5 + PI).sin(); + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.4).sin()); + let slower = (anim_time * 1.0 + PI).sin(); + let slow = (anim_time * 3.5 + PI).sin(); let tailmove = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 0.25, - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(1337.0) - .sin() - * 0.125, + (global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.25, + (global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.125, ); let look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); let breathe = if s_a.beast { @@ -72,23 +54,20 @@ impl Animation for WieldAnimation { let lenght = 1.5; let chop = 0.2; let chop_freq = 60.0; - intensity * (lenght * anim_time as f32).sin() - + 0.05 - * chop - * (anim_time as f32 * chop_freq).sin() - * (anim_time as f32 * lenght).cos() + intensity * (lenght * anim_time).sin() + + 0.05 * chop * (anim_time * chop_freq).sin() * (anim_time * lenght).cos() } else { 0.0 }; - let footvertl = (anim_time as f32 * 16.0 * lab as f32).sin(); - let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).sin(); - let handhoril = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin(); - let handhorir = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin(); + let footvertl = (anim_time * 16.0 * lab).sin(); + let footvertr = (anim_time * 16.0 * lab + PI).sin(); + let handhoril = (anim_time * 16.0 * lab + PI * 1.4).sin(); + let handhorir = (anim_time * 16.0 * lab + PI * 0.4).sin(); - let short = (acc_vel * lab as f32).sin() * speednorm; + let short = (acc_vel * lab).sin() * speednorm; - let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin(); + let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin(); if s_a.beast { next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); diff --git a/voxygen/anim/src/biped_small/alpha.rs b/voxygen/anim/src/biped_small/alpha.rs index a642217e63..8139aef2e4 100644 --- a/voxygen/anim/src/biped_small/alpha.rs +++ b/voxygen/anim/src/biped_small/alpha.rs @@ -11,11 +11,11 @@ type AlphaAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, Vec3, f32, Option, - f64, + f32, ); impl Animation for AlphaAnimation { @@ -39,23 +39,23 @@ impl Animation for AlphaAnimation { stage_section, _timer, ): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let speed = Vec2::::from(velocity).magnitude(); - let fast = (anim_time as f32 * 10.0).sin(); - let fastalt = (anim_time as f32 * 10.0 + PI / 2.0).sin(); + let fast = (anim_time * 10.0).sin(); + let fastalt = (anim_time * 10.0 + PI / 2.0).sin(); let speednorm = speed / 9.4; let speednormcancel = 1.0 - speednorm; let anim_time = anim_time.min(1.0); let (move1base, move2base, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; diff --git a/voxygen/anim/src/biped_small/dash.rs b/voxygen/anim/src/biped_small/dash.rs index c3e325b9d8..5d28232b1d 100644 --- a/voxygen/anim/src/biped_small/dash.rs +++ b/voxygen/anim/src/biped_small/dash.rs @@ -11,11 +11,11 @@ type DashAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, Vec3, f32, Option, - f64, + f32, ); impl Animation for DashAnimation { @@ -39,24 +39,24 @@ impl Animation for DashAnimation { stage_section, _timer, ): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let speed = Vec2::::from(velocity).magnitude(); - let fast = (anim_time as f32 * 10.0).sin(); - let fastalt = (anim_time as f32 * 10.0 + PI / 2.0).sin(); + let fast = (anim_time * 10.0).sin(); + let fastalt = (anim_time * 10.0 + PI / 2.0).sin(); let speednorm = speed / 9.4; let speednormcancel = 1.0 - speednorm; let (move1base, move2base, move3, move4) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0, 0.0), - Some(StageSection::Charge) => (1.0, (anim_time as f32).powi(4), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powi(4), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0), + Some(StageSection::Charge) => (1.0, anim_time.powi(4), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, 1.0, anim_time.powi(4), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - move4; diff --git a/voxygen/anim/src/biped_small/idle.rs b/voxygen/anim/src/biped_small/idle.rs index 740114c55c..e179483db4 100644 --- a/voxygen/anim/src/biped_small/idle.rs +++ b/voxygen/anim/src/biped_small/idle.rs @@ -5,7 +5,7 @@ use super::{ pub struct IdleAnimation; -type IdleAnimationDependency = (Vec3, Vec3, Vec3, f64, Vec3); +type IdleAnimationDependency = (Vec3, Vec3, Vec3, f32, Vec3); impl Animation for IdleAnimation { type Dependency = IdleAnimationDependency; @@ -19,12 +19,12 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 4.0).sin(); + let slow = (anim_time * 4.0).sin(); next.foot_l.scale = Vec3::one() * s_a.scaler / 11.0; next.foot_r.scale = Vec3::one() * s_a.scaler / 11.0; diff --git a/voxygen/anim/src/biped_small/run.rs b/voxygen/anim/src/biped_small/run.rs index c6110aece5..a131a2adbb 100644 --- a/voxygen/anim/src/biped_small/run.rs +++ b/voxygen/anim/src/biped_small/run.rs @@ -6,7 +6,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct RunAnimation; -type RunAnimationDependency = (Vec3, Vec3, Vec3, f64, Vec3, f32); +type RunAnimationDependency = (Vec3, Vec3, Vec3, f32, Vec3, f32); impl Animation for RunAnimation { type Dependency = RunAnimationDependency; @@ -20,7 +20,7 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, orientation, last_ori, global_time, _avg_vel, acc_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -29,34 +29,32 @@ impl Animation for RunAnimation { *rate = 1.0; let speednorm = (speed / 9.4).powf(0.4); - let lab = 1.0; + let lab: f32 = 1.0; - let footrotl = (((5.0) - / (0.5 + (5.5) * ((acc_vel * 1.4 * lab as f32 + PI * 1.4).sin()).powi(2))) - .sqrt()) - * ((acc_vel * 1.4 * lab as f32 + PI * 1.4).sin()); + let footrotl = ((5.0 / (0.5 + (5.5) * ((acc_vel * 1.4 * lab + PI * 1.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 1.4 * lab + PI * 1.4).sin()); - let footrotr = (((5.0) - / (0.5 + (5.5) * ((acc_vel * 1.4 * lab as f32 + PI * 0.4).sin()).powi(2))) - .sqrt()) - * ((acc_vel * 1.4 * lab as f32 + PI * 0.4).sin()); + let footrotr = ((5.0 / (0.5 + (5.5) * ((acc_vel * 1.4 * lab + PI * 0.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 1.4 * lab + PI * 0.4).sin()); - let shortalter = (acc_vel * lab as f32 * 1.4 + PI / -2.0).sin(); + let shortalter = (acc_vel * lab * 1.4 + PI / -2.0).sin(); - let foothoril = (acc_vel * 1.4 * lab as f32 + PI * 1.45).sin(); - let foothorir = (acc_vel * 1.4 * lab as f32 + PI * (0.45)).sin(); - let footstrafel = (acc_vel * 1.4 * lab as f32 + PI * 1.45).sin(); - let footstrafer = (acc_vel * 1.4 * lab as f32 + PI * (0.95)).sin(); + let foothoril = (acc_vel * 1.4 * lab + PI * 1.45).sin(); + let foothorir = (acc_vel * 1.4 * lab + PI * (0.45)).sin(); + let footstrafel = (acc_vel * 1.4 * lab + PI * 1.45).sin(); + let footstrafer = (acc_vel * 1.4 * lab + PI * (0.95)).sin(); - let footvertl = (acc_vel * 1.4 * lab as f32).sin(); - let footvertr = (acc_vel * 1.4 * lab as f32 + PI).sin(); - let footvertsl = (acc_vel * 1.4 * lab as f32).sin(); - let footvertsr = (acc_vel * 1.4 * lab as f32 + PI * 0.5).sin(); + let footvertl = (acc_vel * 1.4 * lab).sin(); + let footvertr = (acc_vel * 1.4 * lab + PI).sin(); + let footvertsl = (acc_vel * 1.4 * lab).sin(); + let footvertsr = (acc_vel * 1.4 * lab + PI * 0.5).sin(); - let shortalt = (acc_vel * lab as f32 * 1.4 + PI / 2.0).sin(); + let shortalt = (acc_vel * lab * 1.4 + PI / 2.0).sin(); - let short = (((5.0) / (1.5 + 3.5 * ((acc_vel * lab as f32 * 1.4).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 * 1.4).sin()); + let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.4).sin()).powi(2))).sqrt()) + * ((acc_vel * lab * 1.4).sin()); let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x; let side = @@ -77,16 +75,8 @@ impl Animation for RunAnimation { } * 1.3; let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 18.0) - .floor() - .mul(7331.0) - .sin() - * 0.2, - ((global_time + anim_time) as f32 / 18.0) - .floor() - .mul(1137.0) - .sin() - * 0.1, + (global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2, + (global_time + anim_time / 18.0).floor().mul(1137.0).sin() * 0.1, ); next.chest.scale = Vec3::one() * s_a.scaler / 11.0; next.foot_l.scale = Vec3::one() * s_a.scaler / 11.0; diff --git a/voxygen/anim/src/biped_small/shoot.rs b/voxygen/anim/src/biped_small/shoot.rs index 20a96336d8..361f35dddd 100644 --- a/voxygen/anim/src/biped_small/shoot.rs +++ b/voxygen/anim/src/biped_small/shoot.rs @@ -12,11 +12,11 @@ type ShootAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, Vec3, f32, Option, - f64, + f32, ); impl Animation for ShootAnimation { @@ -41,15 +41,15 @@ impl Animation for ShootAnimation { stage_section, _timer, ): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let speed = Vec2::::from(velocity).magnitude(); - let fast = (anim_time as f32 * 10.0).sin(); - let fastalt = (anim_time as f32 * 10.0 + PI / 2.0).sin(); + let fast = (anim_time * 10.0).sin(); + let fastalt = (anim_time * 10.0 + PI / 2.0).sin(); let speednorm = speed / 9.4; let speednormcancel = 1.0 - speednorm; @@ -82,9 +82,9 @@ impl Animation for ShootAnimation { match active_tool_kind { Some(ToolKind::Bow) => { let (move1base, move2base, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; @@ -113,9 +113,9 @@ impl Animation for ShootAnimation { }, Some(ToolKind::Staff) | Some(ToolKind::StaffSimple) => { let (move1base, _move2base, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; diff --git a/voxygen/anim/src/biped_small/wield.rs b/voxygen/anim/src/biped_small/wield.rs index 28a02adb50..73b6c4eeba 100644 --- a/voxygen/anim/src/biped_small/wield.rs +++ b/voxygen/anim/src/biped_small/wield.rs @@ -12,7 +12,7 @@ type WieldAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, Vec3, f32, ); @@ -29,7 +29,7 @@ impl Animation for WieldAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, velocity, _orientation, _last_ori, _global_time, _avg_vel, acc_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -37,9 +37,9 @@ impl Animation for WieldAnimation { let speed = Vec2::::from(velocity).magnitude(); let fastacc = (acc_vel * 2.0).sin(); - let fast = (anim_time as f32 * 10.0).sin(); - let fastalt = (anim_time as f32 * 10.0 + PI / 2.0).sin(); - let slow = (anim_time as f32 * 2.0).sin(); + let fast = (anim_time * 10.0).sin(); + let fastalt = (anim_time * 10.0 + PI / 2.0).sin(); + let slow = (anim_time * 2.0).sin(); let speednorm = speed / 9.4; let speednormcancel = 1.0 - speednorm; diff --git a/voxygen/anim/src/bird_medium/feed.rs b/voxygen/anim/src/bird_medium/feed.rs index c448018281..608c8f7ea2 100644 --- a/voxygen/anim/src/bird_medium/feed.rs +++ b/voxygen/anim/src/bird_medium/feed.rs @@ -7,7 +7,7 @@ use std::ops::Mul; pub struct FeedAnimation; impl Animation for FeedAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = BirdMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,28 +18,20 @@ impl Animation for FeedAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let wave_slow = (anim_time as f32 * 4.5).sin(); - let wave = (anim_time as f32 * 8.0).sin(); + let wave_slow = (anim_time * 4.5).sin(); + let wave = (anim_time * 8.0).sin(); - let wave_slow_cos = (anim_time as f32 * 4.5).cos(); + let wave_slow_cos = (anim_time * 4.5).cos(); let duck_head_look = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); next.head.position = Vec3::new(0.0, s_a.head.0 + 1.0, -2.0 + s_a.head.1); diff --git a/voxygen/anim/src/bird_medium/fly.rs b/voxygen/anim/src/bird_medium/fly.rs index 270f032320..49ade48a95 100644 --- a/voxygen/anim/src/bird_medium/fly.rs +++ b/voxygen/anim/src/bird_medium/fly.rs @@ -7,7 +7,7 @@ use std::f32::consts::PI; pub struct FlyAnimation; impl Animation for FlyAnimation { - type Dependency = (f32, f64); + type Dependency = (f32, f32); type Skeleton = BirdMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,18 +17,18 @@ impl Animation for FlyAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 12.0; //14.0 + let lab: f32 = 12.0; //14.0 - let footl = (anim_time as f32 * lab as f32 + PI).sin(); - let footr = (anim_time as f32 * lab as f32).sin(); - let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin(); - let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin(); + let footl = (anim_time * lab + PI).sin(); + let footr = (anim_time * lab).sin(); + let center = (anim_time * lab + PI / 2.0).sin(); + let centeroffset = (anim_time * lab + PI * 1.5).sin(); next.torso.scale = Vec3::one() / 11.0; next.wing_l.scale = Vec3::one() * 1.05; diff --git a/voxygen/anim/src/bird_medium/idle.rs b/voxygen/anim/src/bird_medium/idle.rs index b33ee10dc3..2acc5ceaa8 100644 --- a/voxygen/anim/src/bird_medium/idle.rs +++ b/voxygen/anim/src/bird_medium/idle.rs @@ -7,7 +7,7 @@ use std::ops::Mul; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = BirdMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,26 +18,18 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let wave_slow = (anim_time as f32 * 4.5).sin(); - let wave_slow_cos = (anim_time as f32 * 4.5).cos(); + let wave_slow = (anim_time * 4.5).sin(); + let wave_slow_cos = (anim_time * 4.5).cos(); let duck_head_look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); next.torso.scale = Vec3::one() / 11.0; diff --git a/voxygen/anim/src/bird_medium/run.rs b/voxygen/anim/src/bird_medium/run.rs index 65d24b88e1..fbde0b410d 100644 --- a/voxygen/anim/src/bird_medium/run.rs +++ b/voxygen/anim/src/bird_medium/run.rs @@ -7,7 +7,7 @@ use std::f32::consts::PI; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, f64); + type Dependency = (f32, f32); type Skeleton = BirdMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,18 +17,18 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, _global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 16.0; //14.0 + let lab: f32 = 16.0; //14.0 - let footl = (anim_time as f32 * lab as f32 + PI).sin(); - let footr = (anim_time as f32 * lab as f32).sin(); - let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin(); - let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin(); + let footl = (anim_time * lab + PI).sin(); + let footr = (anim_time * lab).sin(); + let center = (anim_time * lab + PI / 2.0).sin(); + let centeroffset = (anim_time * lab + PI * 1.5).sin(); next.torso.scale = Vec3::one() / 11.0; next.wing_l.scale = Vec3::one() * 1.05; diff --git a/voxygen/anim/src/bird_small/idle.rs b/voxygen/anim/src/bird_small/idle.rs index 94b540d9e9..c87c59a1a8 100644 --- a/voxygen/anim/src/bird_small/idle.rs +++ b/voxygen/anim/src/bird_small/idle.rs @@ -5,7 +5,7 @@ use super::super::vek::*; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = BirdSmallSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, _skeleton_attr: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/bird_small/jump.rs b/voxygen/anim/src/bird_small/jump.rs index 671d838d67..5a940935ce 100644 --- a/voxygen/anim/src/bird_small/jump.rs +++ b/voxygen/anim/src/bird_small/jump.rs @@ -5,7 +5,7 @@ use super::super::vek::*; pub struct JumpAnimation; impl Animation for JumpAnimation { - type Dependency = (f32, f64); + type Dependency = (f32, f32); type Skeleton = BirdSmallSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for JumpAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, _skeleton_attr: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/bird_small/run.rs b/voxygen/anim/src/bird_small/run.rs index 80c06aa5e8..67b01ad7af 100644 --- a/voxygen/anim/src/bird_small/run.rs +++ b/voxygen/anim/src/bird_small/run.rs @@ -5,7 +5,7 @@ use super::super::vek::*; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, f64); + type Dependency = (f32, f32); type Skeleton = BirdSmallSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, _global_time): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, _skeleton_attr: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/character/alpha.rs b/voxygen/anim/src/character/alpha.rs index fe776d6c1d..cd4e6d2874 100644 --- a/voxygen/anim/src/character/alpha.rs +++ b/voxygen/anim/src/character/alpha.rs @@ -12,7 +12,7 @@ impl Animation for AlphaAnimation { Option, Option, f32, - f64, + f32, Option, ); type Skeleton = CharacterSkeleton; @@ -25,7 +25,7 @@ impl Animation for AlphaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -33,9 +33,9 @@ impl Animation for AlphaAnimation { let mut next = (*skeleton).clone(); let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; @@ -89,9 +89,9 @@ impl Animation for AlphaAnimation { Vec3::new(0. + move2 * 2.0, s_a.head.0 + move2 * 2.0, s_a.head.1); let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; next.control.position = Vec3::new( @@ -118,9 +118,9 @@ impl Animation for AlphaAnimation { }, Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) => { let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; next.main.position = Vec3::new(0.0, 0.0, 0.0); diff --git a/voxygen/anim/src/character/beam.rs b/voxygen/anim/src/character/beam.rs index 14a1904f5f..e19a0c40ee 100644 --- a/voxygen/anim/src/character/beam.rs +++ b/voxygen/anim/src/character/beam.rs @@ -11,7 +11,7 @@ impl Animation for BeamAnimation { type Dependency = ( Option, Option, - f64, + f32, f32, Option, ); @@ -25,7 +25,7 @@ impl Animation for BeamAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _global_time, velocity, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -33,9 +33,9 @@ impl Animation for BeamAnimation { let mut next = (*skeleton).clone(); let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Cast) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Cast) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/character/beta.rs b/voxygen/anim/src/character/beta.rs index ba42293d1f..bacbaa88ee 100644 --- a/voxygen/anim/src/character/beta.rs +++ b/voxygen/anim/src/character/beta.rs @@ -11,7 +11,7 @@ impl Animation for BetaAnimation { Option, Option, f32, - f64, + f32, Option, ); type Skeleton = CharacterSkeleton; @@ -23,7 +23,7 @@ impl Animation for BetaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -31,9 +31,9 @@ impl Animation for BetaAnimation { let mut next = (*skeleton).clone(); let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/character/block.rs b/voxygen/anim/src/character/block.rs index c36fcb8e71..c4ceb474ca 100644 --- a/voxygen/anim/src/character/block.rs +++ b/voxygen/anim/src/character/block.rs @@ -7,7 +7,7 @@ use common::comp::item::ToolKind; pub struct BlockAnimation; impl Animation for BlockAnimation { - type Dependency = (Option, Option, f64); + type Dependency = (Option, Option, f32); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,7 +17,7 @@ impl Animation for BlockAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, _global_time): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/character/chargeswing.rs b/voxygen/anim/src/character/chargeswing.rs index 995213e70e..ce805fe05a 100644 --- a/voxygen/anim/src/character/chargeswing.rs +++ b/voxygen/anim/src/character/chargeswing.rs @@ -10,7 +10,7 @@ impl Animation for ChargeswingAnimation { Option, Option, Vec3, - f64, + f32, Option, ); type Skeleton = CharacterSkeleton; @@ -23,36 +23,29 @@ impl Animation for ChargeswingAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; let mut next = (*skeleton).clone(); - let lab = 1.0; + let lab: f32 = 1.0; - let short = (((5.0) / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0).sin()); + let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 8.0).sin()); // end spin stuff let (move1base, move2base, move3, tension, test) = match stage_section { Some(StageSection::Charge) => ( - (anim_time as f32).min(1.0), + anim_time.min(1.0), 0.0, 0.0, - (anim_time as f32 * 18.0 * lab as f32).sin(), + (anim_time * 18.0 * lab).sin(), 0.0, ), - Some(StageSection::Swing) => ( - 1.0, - (anim_time as f32).powf(0.25), - 0.0, - 0.0, - (anim_time as f32).powi(4), - ), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4), 0.0, 1.0), + Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0, 0.0, anim_time.powi(4)), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 0.0, 1.0), _ => (0.0, 0.0, 0.0, 0.0, 0.0), }; let move1 = move1base * (1.0 - move3); diff --git a/voxygen/anim/src/character/climb.rs b/voxygen/anim/src/character/climb.rs index c8c476d137..1f2b439f11 100644 --- a/voxygen/anim/src/character/climb.rs +++ b/voxygen/anim/src/character/climb.rs @@ -13,7 +13,7 @@ impl Animation for ClimbAnimation { Option, Vec3, Vec3, - f64, + f32, ); type Skeleton = CharacterSkeleton; @@ -24,7 +24,7 @@ impl Animation for ClimbAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, velocity, _orientation, global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -32,31 +32,20 @@ impl Animation for ClimbAnimation { let lateral = Vec2::::from(velocity).magnitude(); let speed = velocity.z; *rate = speed; - let constant = 1.0; - let smooth = (anim_time as f32 * constant as f32 * 1.5).sin(); - let smootha = (anim_time as f32 * constant as f32 * 1.5 + PI / 2.0).sin(); - let drop = (anim_time as f32 * constant as f32 * 4.0 + PI / 2.0).sin(); - let dropa = (anim_time as f32 * constant as f32 * 4.0).sin(); + let constant: f32 = 1.0; + let smooth = (anim_time * constant * 1.5).sin(); + let smootha = (anim_time * constant * 1.5 + PI / 2.0).sin(); + let drop = (anim_time * constant * 4.0 + PI / 2.0).sin(); + let dropa = (anim_time * constant * 4.0).sin(); - let quick = (((5.0) - / (0.6 + 4.0 * ((anim_time as f32 * constant as f32 * 1.5).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * constant as f32 * 1.5).sin()); - let quicka = (((5.0) - / (0.6 + 4.0 * ((anim_time as f32 * constant as f32 * 1.5 + PI / 2.0).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * constant as f32 * 1.5 + PI / 2.0).sin()); + let quick = ((5.0 / (0.6 + 4.0 * ((anim_time * constant * 1.5).sin()).powi(2))).sqrt()) + * ((anim_time * constant * 1.5).sin()); + let quicka = + ((5.0 / (0.6 + 4.0 * ((anim_time * constant * 1.5 + PI / 2.0).sin()).powi(2))).sqrt()) + * ((anim_time * constant * 1.5 + PI / 2.0).sin()); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 0.3, - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(1337.0) - .sin() - * 0.15, + (global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.3, + (global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.15, ); let stagnant = if speed > -0.7 { 1.0 } else { 0.0 }; //sets static position when there is no movement diff --git a/voxygen/anim/src/character/dance.rs b/voxygen/anim/src/character/dance.rs index 592be56398..2b37170947 100644 --- a/voxygen/anim/src/character/dance.rs +++ b/voxygen/anim/src/character/dance.rs @@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct DanceAnimation; impl Animation for DanceAnimation { - type Dependency = (Option, Option, f64); + type Dependency = (Option, Option, f32); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,7 +18,7 @@ impl Animation for DanceAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -26,33 +26,22 @@ impl Animation for DanceAnimation { *rate = 1.0; - let lab = 1.0; - let short = (((5.0) / (3.0 + 2.0 * ((anim_time as f32 * lab as f32 * 6.0).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 6.0).sin()); - let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin(); - let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin(); + let lab: f32 = 1.0; + let short = ((5.0 / (3.0 + 2.0 * ((anim_time * lab * 6.0).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 6.0).sin()); + let noisea = (anim_time * 11.0 + PI / 6.0).sin(); + let noiseb = (anim_time * 19.0 + PI / 4.0).sin(); - let shorte = (anim_time as f32 * lab as f32 * 6.0).sin(); + let shorte = (anim_time * lab * 6.0).sin(); - let shortealt = (anim_time as f32 * lab as f32 * 6.0 + PI / 2.0).sin(); + let shortealt = (anim_time * lab * 6.0 + PI / 2.0).sin(); - let foot = (((5.0) - / (1.0 + (4.0) * ((anim_time as f32 * lab as f32 * 8.0).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0).sin()); + let foot = ((5.0 / (1.0 + (4.0) * ((anim_time * lab * 8.0).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 8.0).sin()); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 6.0) - .floor() - .mul(7331.0) - .sin() - * 0.3, - ((global_time + anim_time) as f32 / 6.0) - .floor() - .mul(1337.0) - .sin() - * 0.15, + (global_time + anim_time / 6.0).floor().mul(7331.0).sin() * 0.3, + (global_time + anim_time / 6.0).floor().mul(1337.0).sin() * 0.15, ); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); diff --git a/voxygen/anim/src/character/dash.rs b/voxygen/anim/src/character/dash.rs index 7b5f1d3e19..c9cd66eb85 100644 --- a/voxygen/anim/src/character/dash.rs +++ b/voxygen/anim/src/character/dash.rs @@ -11,7 +11,7 @@ impl Animation for DashAnimation { type Dependency = ( Option, Option, - f64, + f32, Option, ); type Skeleton = CharacterSkeleton; @@ -24,7 +24,7 @@ impl Animation for DashAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -32,19 +32,19 @@ impl Animation for DashAnimation { let mut next = (*skeleton).clone(); let (movement1, movement2, movement3, movement4) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0), - Some(StageSection::Charge) => (1.0, anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.01), 0.0), - Some(StageSection::Recover) => (1.1, 1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0), + Some(StageSection::Charge) => (1.0, anim_time, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.01), 0.0), + Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0, 0.0), }; fn slow(x: f32) -> f32 { - (((5.0) / (1.1 + 3.9 * ((x * 12.4).sin()).powi(2))).sqrt()) * ((x * 12.4).sin()) + ((5.0 / (1.1 + 3.9 * ((x * 12.4).sin()).powi(2))).sqrt()) * ((x * 12.4).sin()) } fn short(x: f32) -> f32 { - (((5.0) / (1.5 + 3.5 * ((x * 5.0).sin()).powi(2))).sqrt()) * ((x * 5.0).sin()) + ((5.0 / (1.5 + 3.5 * ((x * 5.0).sin()).powi(2))).sqrt()) * ((x * 5.0).sin()) } fn shortalt(x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() } @@ -104,8 +104,8 @@ impl Animation for DashAnimation { _ => {}, } - next.lantern.orientation = Quaternion::rotation_x(slow(anim_time as f32) * -0.7 + 0.4) - * Quaternion::rotation_y(slow(anim_time as f32) * 0.4); + next.lantern.orientation = Quaternion::rotation_x(slow(anim_time) * -0.7 + 0.4) + * Quaternion::rotation_y(slow(anim_time) * 0.4); next } diff --git a/voxygen/anim/src/character/equip.rs b/voxygen/anim/src/character/equip.rs index c9b1f37460..0e21032289 100644 --- a/voxygen/anim/src/character/equip.rs +++ b/voxygen/anim/src/character/equip.rs @@ -8,7 +8,7 @@ use std::f32::consts::PI; pub struct EquipAnimation; impl Animation for EquipAnimation { - type Dependency = (Option, Option, f32, f64); + type Dependency = (Option, Option, f32, f32); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,14 +19,14 @@ impl Animation for EquipAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _velocity, _global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; let mut next = (*skeleton).clone(); - let equip_slow = 1.0 + (anim_time as f32 * 12.0 + PI).cos(); - let equip_slowa = 1.0 + (anim_time as f32 * 12.0 + PI / 4.0).cos(); + let equip_slow = 1.0 + (anim_time * 12.0 + PI).cos(); + let equip_slowa = 1.0 + (anim_time * 12.0 + PI / 4.0).cos(); next.hand_l.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57); next.hand_r.orientation = Quaternion::rotation_y(-2.3) * Quaternion::rotation_z(1.57); next.control.position = Vec3::new(equip_slowa * -1.5, 0.0, equip_slow * 1.5); diff --git a/voxygen/anim/src/character/glidewield.rs b/voxygen/anim/src/character/glidewield.rs index 6f269088cf..cc8dd616db 100644 --- a/voxygen/anim/src/character/glidewield.rs +++ b/voxygen/anim/src/character/glidewield.rs @@ -12,7 +12,7 @@ type GlideWieldAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, ); impl Animation for GlideWieldAnimation { @@ -27,7 +27,7 @@ impl Animation for GlideWieldAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, velocity, _orientation, _last_ori, _global_time): Self::Dependency, - _anim_time: f64, + _anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/character/gliding.rs b/voxygen/anim/src/character/gliding.rs index c3461630a7..5eb7900bbf 100644 --- a/voxygen/anim/src/character/gliding.rs +++ b/voxygen/anim/src/character/gliding.rs @@ -13,7 +13,7 @@ type GlidingAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, ); impl Animation for GlidingAnimation { @@ -28,7 +28,7 @@ impl Animation for GlidingAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -36,24 +36,16 @@ impl Animation for GlidingAnimation { let speed = Vec2::::from(velocity).magnitude(); - let quick = (anim_time as f32 * 7.0).sin(); - let quicka = (anim_time as f32 * 7.0 + PI / 2.0).sin(); - let wave_stop = (anim_time as f32 * 1.5).min(PI / 2.0).sin(); - let slow = (anim_time as f32 * 3.0).sin(); - let slowb = (anim_time as f32 * 3.0 + PI).sin(); - let slowa = (anim_time as f32 * 3.0 + PI / 2.0).sin(); + let quick = (anim_time * 7.0).sin(); + let quicka = (anim_time * 7.0 + PI / 2.0).sin(); + let wave_stop = (anim_time * 1.5).min(PI / 2.0).sin(); + let slow = (anim_time * 3.0).sin(); + let slowb = (anim_time * 3.0 + PI).sin(); + let slowa = (anim_time * 3.0 + PI / 2.0).sin(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 4.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 4.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 4.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 4.0).floor().mul(1337.0).sin() * 0.25, ); let ori: Vec2 = Vec2::from(orientation); @@ -70,11 +62,7 @@ impl Animation for GlidingAnimation { 0.0 }; - let tiltcancel = if anim_time > 1.0 { - 1.0 - } else { - anim_time as f32 - }; + let tiltcancel = if anim_time > 1.0 { 1.0 } else { anim_time }; next.head.position = Vec3::new(0.0, s_a.head.0 + 1.0, s_a.head.1); next.head.orientation = Quaternion::rotation_x(0.35 - slow * 0.10 + head_look.y) diff --git a/voxygen/anim/src/character/idle.rs b/voxygen/anim/src/character/idle.rs index df357c49d2..8b44c52a23 100644 --- a/voxygen/anim/src/character/idle.rs +++ b/voxygen/anim/src/character/idle.rs @@ -13,7 +13,7 @@ impl Animation for IdleAnimation { Option, Option, (Option, Option), - f64, + f32, ); type Skeleton = CharacterSkeleton; @@ -24,24 +24,16 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, second_tool_kind, hands, global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 1.0).sin(); + let slow = (anim_time * 1.0).sin(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 12.0) - .floor() - .mul(7331.0) - .sin() - * 0.1, - ((global_time + anim_time) as f32 / 12.0) - .floor() - .mul(1337.0) - .sin() - * 0.05, + (global_time + anim_time / 12.0).floor().mul(7331.0).sin() * 0.1, + (global_time + anim_time / 12.0).floor().mul(1337.0).sin() * 0.05, ); next.head.scale = Vec3::one() * s_a.head_scale; next.chest.scale = Vec3::one() * 1.01; diff --git a/voxygen/anim/src/character/jump.rs b/voxygen/anim/src/character/jump.rs index c4c1ae9c08..e606262f10 100644 --- a/voxygen/anim/src/character/jump.rs +++ b/voxygen/anim/src/character/jump.rs @@ -15,7 +15,7 @@ impl Animation for JumpAnimation { Vec3, Vec3, Vec3, - f64, + f32, ); type Skeleton = CharacterSkeleton; @@ -27,20 +27,18 @@ impl Animation for JumpAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, second_tool_kind, hands, velocity, orientation, last_ori, global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 7.0).sin(); + let slow = (anim_time * 7.0).sin(); - let random = ((((2.0 - * ((global_time as f32 - anim_time as f32) - - ((global_time as f32 - anim_time as f32).round()))) - .abs()) - * 10.0) - .round()) - / 10.0; + let random = + ((((2.0 * ((global_time - anim_time) - ((global_time - anim_time).round()))).abs()) + * 10.0) + .round()) + / 10.0; let switch = if random > 0.5 { 1.0 } else { -1.0 }; diff --git a/voxygen/anim/src/character/leapmelee.rs b/voxygen/anim/src/character/leapmelee.rs index 0a45c738b3..02d59719e5 100644 --- a/voxygen/anim/src/character/leapmelee.rs +++ b/voxygen/anim/src/character/leapmelee.rs @@ -11,7 +11,7 @@ impl Animation for LeapAnimation { Option, Option, Vec3, - f64, + f32, Option, ); type Skeleton = CharacterSkeleton; @@ -24,7 +24,7 @@ impl Animation for LeapAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -32,10 +32,10 @@ impl Animation for LeapAnimation { let mut next = (*skeleton).clone(); let (move1, move2, move3, move4) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0, 0.0), - Some(StageSection::Movement) => (1.0, (anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0), + Some(StageSection::Movement) => (1.0, anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/character/repeater.rs b/voxygen/anim/src/character/repeater.rs index 75583139ac..54958df49c 100644 --- a/voxygen/anim/src/character/repeater.rs +++ b/voxygen/anim/src/character/repeater.rs @@ -10,7 +10,7 @@ impl Animation for RepeaterAnimation { Option, Option, Vec3, - f64, + f32, Option, ); type Skeleton = CharacterSkeleton; @@ -23,7 +23,7 @@ impl Animation for RepeaterAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -31,10 +31,10 @@ impl Animation for RepeaterAnimation { let mut next = (*skeleton).clone(); let (move1, move2, move3, _move4) = match stage_section { - Some(StageSection::Movement) => (anim_time as f32, 0.0, 0.0, 0.0), - Some(StageSection::Buildup) => (1.0, anim_time as f32, 0.0, 0.0), - Some(StageSection::Shoot) => (1.0, 1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time as f32), + Some(StageSection::Movement) => (anim_time, 0.0, 0.0, 0.0), + Some(StageSection::Buildup) => (1.0, anim_time, 0.0, 0.0), + Some(StageSection::Shoot) => (1.0, 1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/character/roll.rs b/voxygen/anim/src/character/roll.rs index c002c98065..bd3b5f095f 100644 --- a/voxygen/anim/src/character/roll.rs +++ b/voxygen/anim/src/character/roll.rs @@ -12,7 +12,7 @@ type RollAnimationDependency = ( Option, Vec3, Vec3, - f64, + f32, Option, ); @@ -28,7 +28,7 @@ impl Animation for RollAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, orientation, last_ori, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -50,9 +50,9 @@ impl Animation for RollAnimation { }; let (movement1base, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(2.0), 0.0, 0.0), - Some(StageSection::Movement) => (1.0, (anim_time as f32).powf(0.75), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(0.75)), + Some(StageSection::Buildup) => (anim_time.powf(2.0), 0.0, 0.0), + Some(StageSection::Movement) => (1.0, anim_time.powf(0.75), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(0.75)), _ => (0.0, 0.0, 0.0), }; let movement1 = movement1base * (1.0 - movement3); diff --git a/voxygen/anim/src/character/run.rs b/voxygen/anim/src/character/run.rs index 3c6621976d..3a4e350db2 100644 --- a/voxygen/anim/src/character/run.rs +++ b/voxygen/anim/src/character/run.rs @@ -14,7 +14,7 @@ type RunAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, Vec3, f32, ); @@ -41,7 +41,7 @@ impl Animation for RunAnimation { avg_vel, acc_vel, ): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -52,40 +52,38 @@ impl Animation for RunAnimation { let impact = (avg_vel.z).max(-8.0); let speednorm = (speed / 9.4).powf(0.6); - let lab = 1.0; + let lab: f32 = 1.0; - let footrotl = (((1.0) - / (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin()).powi(2))) - .sqrt()) - * ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin()); + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * 1.6 * lab + PI * 1.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 1.6 * lab + PI * 1.4).sin()); - let footrotr = (((1.0) - / (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin()).powi(2))) - .sqrt()) - * ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin()); + let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * 1.6 * lab + PI * 0.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 1.6 * lab + PI * 0.4).sin()); let noisea = (acc_vel * 11.0 + PI / 6.0).sin(); let noiseb = (acc_vel * 19.0 + PI / 4.0).sin(); - let shorte = (((1.0) / (0.8 + 0.2 * ((acc_vel * lab as f32 * 1.6).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 * 1.6).sin()); + let shorte = ((1.0 / (0.8 + 0.2 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt()) + * ((acc_vel * lab * 1.6).sin()); - let shortalter = (acc_vel * lab as f32 * 1.6 + PI / -2.0).sin(); + let shortalter = (acc_vel * lab * 1.6 + PI / -2.0).sin(); - let foothoril = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin(); - let foothorir = (acc_vel * 1.6 * lab as f32 + PI * (0.45)).sin(); - let footstrafel = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin(); - let footstrafer = (acc_vel * 1.6 * lab as f32 + PI * (0.95)).sin(); + let foothoril = (acc_vel * 1.6 * lab + PI * 1.45).sin(); + let foothorir = (acc_vel * 1.6 * lab + PI * (0.45)).sin(); + let footstrafel = (acc_vel * 1.6 * lab + PI * 1.45).sin(); + let footstrafer = (acc_vel * 1.6 * lab + PI * (0.95)).sin(); - let footvertl = (acc_vel * 1.6 * lab as f32).sin(); - let footvertr = (acc_vel * 1.6 * lab as f32 + PI).sin(); - let footvertsl = (acc_vel * 1.6 * lab as f32).sin(); - let footvertsr = (acc_vel * 1.6 * lab as f32 + PI * 0.5).sin(); + let footvertl = (acc_vel * 1.6 * lab).sin(); + let footvertr = (acc_vel * 1.6 * lab + PI).sin(); + let footvertsl = (acc_vel * 1.6 * lab).sin(); + let footvertsr = (acc_vel * 1.6 * lab + PI * 0.5).sin(); - let shortalt = (acc_vel * lab as f32 * 1.6 + PI / 2.0).sin(); + let shortalt = (acc_vel * lab * 1.6 + PI / 2.0).sin(); - let short = (((5.0) / (1.5 + 3.5 * ((acc_vel * lab as f32 * 1.6).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 * 1.6).sin()); + let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt()) + * ((acc_vel * lab * 1.6).sin()); let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x; let side = @@ -107,16 +105,8 @@ impl Animation for RunAnimation { //println!("speednorm {} ",side); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 18.0) - .floor() - .mul(7331.0) - .sin() - * 0.2, - ((global_time + anim_time) as f32 / 18.0) - .floor() - .mul(1337.0) - .sin() - * 0.1, + (global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2, + (global_time + anim_time / 18.0).floor().mul(1337.0).sin() * 0.1, ); next.head.position = Vec3::new(0.0, 1.0 * speednorm + s_a.head.0, s_a.head.1 + short * 0.1); diff --git a/voxygen/anim/src/character/shockwave.rs b/voxygen/anim/src/character/shockwave.rs index e8dd676d3b..04171b4e12 100644 --- a/voxygen/anim/src/character/shockwave.rs +++ b/voxygen/anim/src/character/shockwave.rs @@ -13,7 +13,7 @@ impl Animation for ShockwaveAnimation { type Dependency = ( Option, Option, - f64, + f32, f32, Option, ); @@ -27,7 +27,7 @@ impl Animation for ShockwaveAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, _global_time, velocity, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -35,9 +35,9 @@ impl Animation for ShockwaveAnimation { let mut next = (*skeleton).clone(); let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/character/shoot.rs b/voxygen/anim/src/character/shoot.rs index a145878291..ff2e7af377 100644 --- a/voxygen/anim/src/character/shoot.rs +++ b/voxygen/anim/src/character/shoot.rs @@ -14,7 +14,7 @@ type ShootAnimationDependency = ( Vec3, Vec3, Dir, - f64, + f32, Option, ); impl Animation for ShootAnimation { @@ -38,7 +38,7 @@ impl Animation for ShootAnimation { _global_time, stage_section, ): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -47,7 +47,7 @@ impl Animation for ShootAnimation { let mut next = (*skeleton).clone(); - let lab = 1.0; + let lab: f32 = 1.0; let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); let tilt = if ::vek::Vec2::new(ori, last_ori) @@ -64,13 +64,13 @@ impl Animation for ShootAnimation { match active_tool_kind { Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Shoot) => (1.0, (anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Shoot) => (1.0, anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; - let xmove = (move1 as f32 * 6.0 * lab as f32 + PI).sin(); - let ymove = (move1 as f32 * 6.0 * lab as f32 + PI * (0.5)).sin(); + let xmove = (move1 * 6.0 * lab + PI).sin(); + let ymove = (move1 * 6.0 * lab + PI * (0.5)).sin(); next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3); @@ -118,9 +118,9 @@ impl Animation for ShootAnimation { }, Some(ToolKind::Bow) => { let (_move1, move2, _move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Shoot) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Shoot) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; next.main.position = Vec3::new(0.0, 0.0, 0.0); @@ -151,7 +151,7 @@ impl Animation for ShootAnimation { next.head.position = Vec3::new(0.0 - 2.0, s_a.head.0, s_a.head.1); next.head.orientation = Quaternion::rotation_x(look_dir.z * 0.7) - * Quaternion::rotation_z(tilt * -2.5 - 0.5 + (move2 as f32 * -0.2).sin()); + * Quaternion::rotation_z(tilt * -2.5 - 0.5 + (move2 * -0.2).sin()); next.chest.orientation = Quaternion::rotation_z(0.8 + move2 * 0.2); next.belt.orientation = Quaternion::rotation_z(move2 * 0.3); next.shorts.orientation = Quaternion::rotation_z(move2 * 0.5); diff --git a/voxygen/anim/src/character/sit.rs b/voxygen/anim/src/character/sit.rs index c75baa98bd..74cd609d60 100644 --- a/voxygen/anim/src/character/sit.rs +++ b/voxygen/anim/src/character/sit.rs @@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct SitAnimation; impl Animation for SitAnimation { - type Dependency = (Option, Option, f64); + type Dependency = (Option, Option, f32); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,27 +18,19 @@ impl Animation for SitAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 1.0).sin(); - let slowa = (anim_time as f32 * 1.0 + PI / 2.0).sin(); - let stop = (anim_time as f32 * 3.0).min(PI / 2.0).sin(); + let slow = (anim_time * 1.0).sin(); + let slowa = (anim_time * 1.0 + PI / 2.0).sin(); + let stop = (anim_time * 3.0).min(PI / 2.0).sin(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 18.0) - .floor() - .mul(7331.0) - .sin() - * 0.25, - ((global_time + anim_time) as f32 / 18.0) - .floor() - .mul(1337.0) - .sin() - * 0.125, + (global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.25, + (global_time + anim_time / 18.0).floor().mul(1337.0).sin() * 0.125, ); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * 0.1 + stop * -0.8); next.head.orientation = Quaternion::rotation_z(head_look.x + slow * 0.2 - slow * 0.1) diff --git a/voxygen/anim/src/character/sneak.rs b/voxygen/anim/src/character/sneak.rs index e5e67cacf0..ca0a41d99e 100644 --- a/voxygen/anim/src/character/sneak.rs +++ b/voxygen/anim/src/character/sneak.rs @@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct SneakAnimation; impl Animation for SneakAnimation { - type Dependency = (Option, Vec3, Vec3, Vec3, f64); + type Dependency = (Option, Vec3, Vec3, Vec3, f32); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,56 +19,45 @@ impl Animation for SneakAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let speed = Vec2::::from(velocity).magnitude(); *rate = 1.0; - let slow = (anim_time as f32 * 3.0).sin(); - let breathe = ((anim_time as f32 * 0.5).sin()).abs(); + let slow = (anim_time * 3.0).sin(); + let breathe = ((anim_time * 0.5).sin()).abs(); let walkintensity = if speed > 5.0 { 1.0 } else { 0.45 }; let lower = if speed > 5.0 { 0.0 } else { 1.0 }; let _snapfoot = if speed > 5.0 { 1.1 } else { 2.0 }; - let lab = 1.0; - let foothoril = (anim_time as f32 * 7.0 * lab as f32 + PI * 1.45).sin(); - let foothorir = (anim_time as f32 * 7.0 * lab as f32 + PI * (0.45)).sin(); + let lab: f32 = 1.0; + let foothoril = (anim_time * 7.0 * lab + PI * 1.45).sin(); + let foothorir = (anim_time * 7.0 * lab + PI * (0.45)).sin(); - let footvertl = (anim_time as f32 * 7.0 * lab as f32).sin(); - let footvertr = (anim_time as f32 * 7.0 * lab as f32 + PI).sin(); + let footvertl = (anim_time * 7.0 * lab).sin(); + let footvertr = (anim_time * 7.0 * lab + PI).sin(); - let footrotl = (((5.0) - / (2.5 + (2.5) * ((anim_time as f32 * 7.0 * lab as f32 + PI * 1.4).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 7.0 * lab as f32 + PI * 1.4).sin()); + let footrotl = ((5.0 / (2.5 + (2.5) * ((anim_time * 7.0 * lab + PI * 1.4).sin()).powi(2))) + .sqrt()) + * ((anim_time * 7.0 * lab + PI * 1.4).sin()); - let footrotr = (((5.0) - / (1.0 + (4.0) * ((anim_time as f32 * 7.0 * lab as f32 + PI * 0.4).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 7.0 * lab as f32 + PI * 0.4).sin()); + let footrotr = ((5.0 / (1.0 + (4.0) * ((anim_time * 7.0 * lab + PI * 0.4).sin()).powi(2))) + .sqrt()) + * ((anim_time * 7.0 * lab + PI * 0.4).sin()); - let short = (anim_time as f32 * lab as f32 * 7.0).sin(); - let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin(); - let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin(); + let short = (anim_time * lab * 7.0).sin(); + let noisea = (anim_time * 11.0 + PI / 6.0).sin(); + let noiseb = (anim_time * 19.0 + PI / 4.0).sin(); - let shorte = - (((5.0) / (4.0 + 1.0 * ((anim_time as f32 * lab as f32 * 7.0).sin()).powi(2))).sqrt()) - * ((anim_time as f32 * lab as f32 * 7.0).sin()); + let shorte = ((5.0 / (4.0 + 1.0 * ((anim_time * lab * 7.0).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 7.0).sin()); - let shortalt = (anim_time as f32 * lab as f32 * 7.0 + PI / 2.0).sin(); + let shortalt = (anim_time * lab * 7.0 + PI / 2.0).sin(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 18.0) - .floor() - .mul(7331.0) - .sin() - * 0.2, - ((global_time + anim_time) as f32 / 18.0) - .floor() - .mul(1337.0) - .sin() - * 0.1, + (global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2, + (global_time + anim_time / 18.0).floor().mul(1337.0).sin() * 0.1, ); let orientation: Vec2 = Vec2::from(orientation); diff --git a/voxygen/anim/src/character/spin.rs b/voxygen/anim/src/character/spin.rs index fcbe305d22..e6e802e90f 100644 --- a/voxygen/anim/src/character/spin.rs +++ b/voxygen/anim/src/character/spin.rs @@ -12,7 +12,7 @@ impl Animation for SpinAnimation { Option, Option, Vec3, - f64, + f32, Option, ); type Skeleton = CharacterSkeleton; @@ -24,7 +24,7 @@ impl Animation for SpinAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -32,9 +32,9 @@ impl Animation for SpinAnimation { let mut next = (*skeleton).clone(); let (movement1base, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; @@ -101,9 +101,9 @@ impl Animation for SpinAnimation { Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); let (movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/character/spinmelee.rs b/voxygen/anim/src/character/spinmelee.rs index cba5ca8a50..f0ee2fd7ad 100644 --- a/voxygen/anim/src/character/spinmelee.rs +++ b/voxygen/anim/src/character/spinmelee.rs @@ -12,7 +12,7 @@ impl Animation for SpinMeleeAnimation { Option, Option, Vec3, - f64, + f32, Option, ); type Skeleton = CharacterSkeleton; @@ -25,15 +25,15 @@ impl Animation for SpinMeleeAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; let (move1, move2, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)), _ => (0.0, 0.0, 0.0), }; let mut next = (*skeleton).clone(); diff --git a/voxygen/anim/src/character/staggered.rs b/voxygen/anim/src/character/staggered.rs index 6d0295411d..9785bf6eee 100644 --- a/voxygen/anim/src/character/staggered.rs +++ b/voxygen/anim/src/character/staggered.rs @@ -11,9 +11,9 @@ impl Animation for StaggeredAnimation { Option, Option, f32, - f64, + f32, Option, - f64, + f32, bool, ); type Skeleton = CharacterSkeleton; @@ -34,7 +34,7 @@ impl Animation for StaggeredAnimation { timer, wield_status, ): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -42,14 +42,14 @@ impl Animation for StaggeredAnimation { let mut next = (*skeleton).clone(); let (movement1base, movement2) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, (anim_time as f32).powf(4.0)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, anim_time.powf(4.0)), _ => (0.0, 0.0), }; let pullback = 1.0 - movement2; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = movement1base * pullback * mirror; let movement1abs = movement1base * pullback; diff --git a/voxygen/anim/src/character/stand.rs b/voxygen/anim/src/character/stand.rs index 1ec77e6f04..0cb8c118ad 100644 --- a/voxygen/anim/src/character/stand.rs +++ b/voxygen/anim/src/character/stand.rs @@ -13,7 +13,7 @@ impl Animation for StandAnimation { Option, Option, (Option, Option), - f64, + f32, Vec3, ); type Skeleton = CharacterSkeleton; @@ -25,25 +25,17 @@ impl Animation for StandAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, second_tool_kind, hands, global_time, avg_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 1.0).sin(); + let slow = (anim_time * 1.0).sin(); let impact = (avg_vel.z).max(-15.0); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 12.0) - .floor() - .mul(7331.0) - .sin() - * 0.3, - ((global_time + anim_time) as f32 / 12.0) - .floor() - .mul(1337.0) - .sin() - * 0.15, + (global_time + anim_time / 12.0).floor().mul(7331.0).sin() * 0.3, + (global_time + anim_time / 12.0).floor().mul(1337.0).sin() * 0.15, ); next.head.scale = Vec3::one() * s_a.head_scale; next.chest.scale = Vec3::one() * 1.01; diff --git a/voxygen/anim/src/character/stunned.rs b/voxygen/anim/src/character/stunned.rs index 3bafc78c13..accfeb5cae 100644 --- a/voxygen/anim/src/character/stunned.rs +++ b/voxygen/anim/src/character/stunned.rs @@ -11,9 +11,9 @@ impl Animation for StunnedAnimation { Option, Option, f32, - f64, + f32, Option, - f64, + f32, bool, ); type Skeleton = CharacterSkeleton; @@ -34,7 +34,7 @@ impl Animation for StunnedAnimation { timer, wield_status, ): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -42,14 +42,14 @@ impl Animation for StunnedAnimation { let mut next = (*skeleton).clone(); let (movement1base, movement2) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, (anim_time as f32).powf(4.0)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, anim_time.powf(4.0)), _ => (0.0, 0.0), }; let pullback = 1.0 - movement2; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = movement1base * pullback * mirror; let movement1abs = movement1base * pullback; diff --git a/voxygen/anim/src/character/swim.rs b/voxygen/anim/src/character/swim.rs index 26878b9436..6025923673 100644 --- a/voxygen/anim/src/character/swim.rs +++ b/voxygen/anim/src/character/swim.rs @@ -14,7 +14,7 @@ type SwimAnimationDependency = ( Vec3, Vec3, Vec3, - f64, + f32, Vec3, ); @@ -39,7 +39,7 @@ impl Animation for SwimAnimation { global_time, avg_vel, ): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -53,31 +53,29 @@ impl Animation for SwimAnimation { let tempo = if speed > 0.5 { 1.5 } else { 0.7 }; let intensity = if speed > 0.5 { 1.0 } else { 0.3 }; - let lab = 1.0 * tempo; + let lab: f32 = 1.0 * tempo; - let short = (anim_time as f32 * lab as f32 * 6.0 + PI * 0.9).sin(); + let short = (anim_time * lab * 6.0 + PI * 0.9).sin(); - let foot = (anim_time as f32 * lab as f32 * 6.0 + PI * -0.1).sin(); + let foot = (anim_time * lab * 6.0 + PI * -0.1).sin(); - let footrotl = (((1.0) - / (0.2 + (0.8) * ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin()); + let footrotl = ((1.0 / (0.2 + (0.8) * ((anim_time * 6.0 * lab + PI * 1.4).sin()).powi(2))) + .sqrt()) + * ((anim_time * 6.0 * lab + PI * 1.4).sin()); - let footrotr = (((1.0) - / (0.2 + (0.8) * ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin()); + let footrotr = ((1.0 / (0.2 + (0.8) * ((anim_time * 6.0 * lab + PI * 0.4).sin()).powi(2))) + .sqrt()) + * ((anim_time * 6.0 * lab + PI * 0.4).sin()); - let foothoril = (anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin(); - let foothorir = (anim_time as f32 * 6.0 * lab as f32 + PI * (0.4)).sin(); + let foothoril = (anim_time * 6.0 * lab + PI * 1.4).sin(); + let foothorir = (anim_time * 6.0 * lab + PI * (0.4)).sin(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 4.0 * (1.0 / tempo)) + (global_time + anim_time / 4.0 * (1.0 / tempo)) .floor() .mul(7331.0) .sin() * 0.2, - ((global_time + anim_time) as f32 / 4.0 * (1.0 / tempo)) + (global_time + anim_time / 4.0 * (1.0 / tempo)) .floor() .mul(1337.0) .sin() diff --git a/voxygen/anim/src/character/swimwield.rs b/voxygen/anim/src/character/swimwield.rs index 217563de5d..4e37227259 100644 --- a/voxygen/anim/src/character/swimwield.rs +++ b/voxygen/anim/src/character/swimwield.rs @@ -8,7 +8,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct SwimWieldAnimation; impl Animation for SwimWieldAnimation { - type Dependency = (Option, Option, f32, f64); + type Dependency = (Option, Option, f32, f32); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,49 +19,38 @@ impl Animation for SwimWieldAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (active_tool_kind, _second_tool_kind, velocity, global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); *rate = 1.0; - let lab = 1.0; + let lab: f32 = 1.0; let speed = Vec3::::from(velocity).magnitude(); *rate = 1.0; let intensity = if speed > 0.5 { 1.0 } else { 0.3 }; - let footrotl = (((1.0) - / (0.2 + (0.8) * ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 6.0 * lab as f32 + PI * 1.4).sin()); + let footrotl = ((1.0 / (0.2 + (0.8) * ((anim_time * 6.0 * lab + PI * 1.4).sin()).powi(2))) + .sqrt()) + * ((anim_time * 6.0 * lab + PI * 1.4).sin()); - let footrotr = (((1.0) - / (0.2 + (0.8) * ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 6.0 * lab as f32 + PI * 0.4).sin()); + let footrotr = ((1.0 / (0.2 + (0.8) * ((anim_time * 6.0 * lab + PI * 0.4).sin()).powi(2))) + .sqrt()) + * ((anim_time * 6.0 * lab + PI * 0.4).sin()); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 3.0) - .floor() - .mul(7331.0) - .sin() - * 0.2, - ((global_time + anim_time) as f32 / 3.0) - .floor() - .mul(1337.0) - .sin() - * 0.1, + (global_time + anim_time / 3.0).floor().mul(7331.0).sin() * 0.2, + (global_time + anim_time / 3.0).floor().mul(1337.0).sin() * 0.1, ); - let slowalt = (anim_time as f32 * 6.0 + PI).cos(); - let u_slow = (anim_time as f32 * 1.0 + PI).sin(); - let foothoril = (anim_time as f32 * 6.0 * lab as f32 + PI * 1.45).sin(); - let foothorir = (anim_time as f32 * 6.0 * lab as f32 + PI * (0.45)).sin(); - let u_slowalt = (anim_time as f32 * 3.0 + PI).cos(); - let short = - (((5.0) / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powi(2))).sqrt()) - * ((anim_time as f32 * lab as f32 * 16.0).sin()); - let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin(); - let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin(); + let slowalt = (anim_time * 6.0 + PI).cos(); + let u_slow = (anim_time * 1.0 + PI).sin(); + let foothoril = (anim_time * 6.0 * lab + PI * 1.45).sin(); + let foothorir = (anim_time * 6.0 * lab + PI * (0.45)).sin(); + let u_slowalt = (anim_time * 3.0 + PI).cos(); + let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 16.0).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 16.0).sin()); + let noisea = (anim_time * 11.0 + PI / 6.0).sin(); + let noiseb = (anim_time * 19.0 + PI / 4.0).sin(); next.foot_l.position = Vec3::new( -s_a.foot.0, diff --git a/voxygen/anim/src/character/talk.rs b/voxygen/anim/src/character/talk.rs index b49bc1214b..3383a68a69 100644 --- a/voxygen/anim/src/character/talk.rs +++ b/voxygen/anim/src/character/talk.rs @@ -8,7 +8,7 @@ use std::f32::consts::PI; pub struct TalkAnimation; impl Animation for TalkAnimation { - type Dependency = (Option, Option, f32, f64, Dir); + type Dependency = (Option, Option, f32, f32, Dir); type Skeleton = CharacterSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,16 +19,16 @@ impl Animation for TalkAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, _velocity, _global_time, look_dir): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; let mut next = (*skeleton).clone(); - let slowa = (anim_time as f32 * 6.0).sin(); - let slowb = (anim_time as f32 * 4.0 + PI / 2.0).sin(); - let slowc = (anim_time as f32 * 12.0 + PI / 2.0).sin(); + let slowa = (anim_time * 6.0).sin(); + let slowb = (anim_time * 4.0 + PI / 2.0).sin(); + let slowc = (anim_time * 12.0 + PI / 2.0).sin(); next.head.orientation = Quaternion::rotation_x(slowc * 0.035 + look_dir.z * 0.7); next.hand_l.position = Vec3::new( diff --git a/voxygen/anim/src/character/wield.rs b/voxygen/anim/src/character/wield.rs index 63f08a1656..4f46574d75 100644 --- a/voxygen/anim/src/character/wield.rs +++ b/voxygen/anim/src/character/wield.rs @@ -14,7 +14,7 @@ type WieldAnimationDependency = ( Vec3, Dir, Vec3, - f64, + f32, ); impl Animation for WieldAnimation { type Dependency = WieldAnimationDependency; @@ -36,48 +36,38 @@ impl Animation for WieldAnimation { velocity, global_time, ): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; - let lab = 1.0; + let lab: f32 = 1.0; let speed = Vec2::::from(velocity).magnitude(); let mut next = (*skeleton).clone(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 3.0) - .floor() - .mul(7331.0) - .sin() - * 0.2, - ((global_time + anim_time) as f32 / 3.0) - .floor() - .mul(1337.0) - .sin() - * 0.1, + (global_time + anim_time / 3.0).floor().mul(7331.0).sin() * 0.2, + (global_time + anim_time / 3.0).floor().mul(1337.0).sin() * 0.1, ); - let foothoril = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.45).sin(); + let foothoril = (anim_time * 16.0 * lab + PI * 1.45).sin(); - let beltstatic = (anim_time as f32 * 10.0 * lab as f32 + PI / 2.0).sin(); - let footvertlstatic = (anim_time as f32 * 10.0 * lab as f32).sin(); - let footvertrstatic = (anim_time as f32 * 10.0 * lab as f32 + PI).sin(); - let footrotl = (((1.0) - / (0.5 + (0.5) * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()); + let beltstatic = (anim_time * 10.0 * lab + PI / 2.0).sin(); + let footvertlstatic = (anim_time * 10.0 * lab).sin(); + let footvertrstatic = (anim_time * 10.0 * lab + PI).sin(); + let footrotl = + ((1.0 / (0.5 + (0.5) * ((anim_time * 16.0 * lab + PI * 1.4).sin()).powi(2))).sqrt()) + * ((anim_time * 16.0 * lab + PI * 1.4).sin()); - let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin(); + let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin(); - let slowalt = (anim_time as f32 * 6.0 + PI).cos(); - let u_slow = (anim_time as f32 * 2.5 + PI).sin(); - let slow = (anim_time as f32 * 5.0 + PI).sin(); + let slowalt = (anim_time * 6.0 + PI).cos(); + let u_slow = (anim_time * 2.5 + PI).sin(); + let slow = (anim_time * 5.0 + PI).sin(); - let u_slowalt = (anim_time as f32 * 3.0 + PI).cos(); - let short = - (((5.0) / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powi(2))).sqrt()) - * ((anim_time as f32 * lab as f32 * 16.0).sin()); + let u_slowalt = (anim_time * 3.0 + PI).cos(); + let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 16.0).sin()).powi(2))).sqrt()) + * ((anim_time * lab * 16.0).sin()); let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x; let side = velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x; let strafe = -((1.0 / (direction).abs() - 1.0).min(1.0)).copysign(side); diff --git a/voxygen/anim/src/dragon/fly.rs b/voxygen/anim/src/dragon/fly.rs index 78840debc8..3d4670386f 100644 --- a/voxygen/anim/src/dragon/fly.rs +++ b/voxygen/anim/src/dragon/fly.rs @@ -7,7 +7,7 @@ use std::f32::consts::PI; pub struct FlyAnimation; impl Animation for FlyAnimation { - type Dependency = (f32, f64); + type Dependency = (f32, f32); type Skeleton = DragonSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,26 +17,26 @@ impl Animation for FlyAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 12.0; + let lab: f32 = 12.0; - let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); - let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos(); - let wave_slow = (anim_time as f32 * 3.5 + PI).sin(); + let wave_ultra_slow = (anim_time * 1.0 + PI).sin(); + let wave_ultra_slow_cos = (anim_time * 3.0 + PI).cos(); + let wave_slow = (anim_time * 3.5 + PI).sin(); - let wingl = (anim_time as f32 * 2.0 + PI).sin(); - let wingr = (anim_time as f32 * 2.0).sin(); + let wingl = (anim_time * 2.0 + PI).sin(); + let wingr = (anim_time * 2.0).sin(); - let footl = (anim_time as f32 * lab as f32 + PI).sin(); - let footr = (anim_time as f32 * lab as f32).sin(); + let footl = (anim_time * lab + PI).sin(); + let footr = (anim_time * lab).sin(); - let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin(); - let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin(); + let center = (anim_time * lab + PI / 2.0).sin(); + let centeroffset = (anim_time * lab + PI * 1.5).sin(); next.head_upper.scale = Vec3::one() * 1.05; next.head_lower.scale = Vec3::one() * 1.05; diff --git a/voxygen/anim/src/dragon/idle.rs b/voxygen/anim/src/dragon/idle.rs index 02c67f14c8..3d80739a0d 100644 --- a/voxygen/anim/src/dragon/idle.rs +++ b/voxygen/anim/src/dragon/idle.rs @@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = DragonSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,27 +17,19 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let ultra_slow = (anim_time as f32 * 1.0).sin(); - let slow = (anim_time as f32 * 2.5).sin(); - let slowalt = (anim_time as f32 * 2.5 + PI / 2.0).sin(); + let ultra_slow = (anim_time * 1.0).sin(); + let slow = (anim_time * 2.5).sin(); + let slowalt = (anim_time * 2.5 + PI / 2.0).sin(); let dragon_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, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); next.head_upper.scale = Vec3::one() * 1.05; diff --git a/voxygen/anim/src/dragon/run.rs b/voxygen/anim/src/dragon/run.rs index 2bb1f02a83..a3846f3bbc 100644 --- a/voxygen/anim/src/dragon/run.rs +++ b/voxygen/anim/src/dragon/run.rs @@ -7,7 +7,7 @@ use std::f32::consts::PI; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, Vec3, Vec3, f64, Vec3); + type Dependency = (f32, Vec3, Vec3, f32, Vec3); type Skeleton = DragonSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,22 +17,21 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, orientation, last_ori, _global_time, avg_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 0.6; //6 + let lab: f32 = 0.6; //6 - let short = (((1.0) - / (0.72 + 0.28 * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.0).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.0).sin()); + let short = ((1.0 / (0.72 + 0.28 * ((anim_time * 16.0 * lab + PI * 1.0).sin()).powi(2))) + .sqrt()) + * ((anim_time * 16.0 * lab + PI * 1.0).sin()); // - let shortalt = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.5).sin(); + let shortalt = (anim_time * 16.0 * lab + PI * 0.5).sin(); // let ori: Vec2 = Vec2::from(orientation); @@ -50,23 +49,23 @@ impl Animation for RunAnimation { } * 1.3; let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()); - let lab = 14; + let lab: f32 = 14.0; - let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos(); - let wave_slow = (anim_time as f32 * 4.5).sin(); + let wave_ultra_slow_cos = (anim_time * 3.0 + PI).cos(); + let wave_slow = (anim_time * 4.5).sin(); - let vertlf = (anim_time as f32 * lab as f32 + PI * 1.8).sin().max(0.15); - let vertrfoffset = (anim_time as f32 * lab as f32 + PI * 0.80).sin().max(0.15); - let vertlboffset = (anim_time as f32 * lab as f32).sin().max(0.15); - let vertrb = (anim_time as f32 * lab as f32 + PI).sin().max(0.15); + let vertlf = (anim_time * lab + PI * 1.8).sin().max(0.15); + let vertrfoffset = (anim_time * lab + PI * 0.80).sin().max(0.15); + let vertlboffset = (anim_time * lab).sin().max(0.15); + let vertrb = (anim_time * lab + PI).sin().max(0.15); - let horilf = (anim_time as f32 * lab as f32 + PI * 1.2).sin(); - let horirfoffset = (anim_time as f32 * lab as f32 + PI * 0.20).sin(); - let horilboffset = (anim_time as f32 * lab as f32 + PI * 1.4).sin(); - let horirb = (anim_time as f32 * lab as f32 + PI * 0.4).sin(); + let horilf = (anim_time * lab + PI * 1.2).sin(); + let horirfoffset = (anim_time * lab + PI * 0.20).sin(); + let horilboffset = (anim_time * lab + PI * 1.4).sin(); + let horirb = (anim_time * lab + PI * 0.4).sin(); - let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin(); - let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin(); + let center = (anim_time * lab + PI / 2.0).sin(); + let centeroffset = (anim_time * lab + PI * 1.5).sin(); next.head_lower.scale = Vec3::one() * 1.02; next.jaw.scale = Vec3::one() * 1.05; diff --git a/voxygen/anim/src/fish_medium/idle.rs b/voxygen/anim/src/fish_medium/idle.rs index 1086a8e285..4ea180416e 100644 --- a/voxygen/anim/src/fish_medium/idle.rs +++ b/voxygen/anim/src/fish_medium/idle.rs @@ -6,7 +6,7 @@ use std::f32::consts::PI; pub struct IdleAnimation; -type IdleAnimationDependency = (Vec3, Vec3, Vec3, f64, Vec3); +type IdleAnimationDependency = (Vec3, Vec3, Vec3, f32, Vec3); impl Animation for IdleAnimation { type Dependency = IdleAnimationDependency; @@ -20,14 +20,14 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 3.5 + PI).sin(); - let slowalt = (anim_time as f32 * 3.5 + PI + 0.2).sin(); + let slow = (anim_time * 3.5 + PI).sin(); + let slowalt = (anim_time * 3.5 + PI + 0.2).sin(); next.chest_front.scale = Vec3::one() / 11.0; diff --git a/voxygen/anim/src/fish_medium/swim.rs b/voxygen/anim/src/fish_medium/swim.rs index 791bc5c26c..02b3539fc1 100644 --- a/voxygen/anim/src/fish_medium/swim.rs +++ b/voxygen/anim/src/fish_medium/swim.rs @@ -6,7 +6,7 @@ use std::f32::consts::PI; pub struct SwimAnimation; -type SwimAnimationDependency = (Vec3, Vec3, Vec3, f64, Vec3, f32); +type SwimAnimationDependency = (Vec3, Vec3, Vec3, f32, Vec3, f32); impl Animation for SwimAnimation { type Dependency = SwimAnimationDependency; @@ -20,13 +20,13 @@ impl Animation for SwimAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slowalt = (acc_vel as f32 * s_a.tempo / 1.5 + PI + 0.2).sin(); + let slowalt = (acc_vel * s_a.tempo / 1.5 + PI + 0.2).sin(); let fast = (acc_vel * s_a.tempo + PI).sin(); let fastalt = (acc_vel * s_a.tempo + PI + 0.2).sin(); diff --git a/voxygen/anim/src/fish_small/idle.rs b/voxygen/anim/src/fish_small/idle.rs index c027c68165..0f28fc9b9d 100644 --- a/voxygen/anim/src/fish_small/idle.rs +++ b/voxygen/anim/src/fish_small/idle.rs @@ -6,7 +6,7 @@ use std::f32::consts::PI; pub struct IdleAnimation; -type IdleAnimationDependency = (Vec3, Vec3, Vec3, f64, Vec3); +type IdleAnimationDependency = (Vec3, Vec3, Vec3, f32, Vec3); impl Animation for IdleAnimation { type Dependency = IdleAnimationDependency; @@ -20,13 +20,13 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 3.5 + PI).sin(); + let slow = (anim_time * 3.5 + PI).sin(); next.chest.scale = Vec3::one() / 13.0; diff --git a/voxygen/anim/src/fish_small/swim.rs b/voxygen/anim/src/fish_small/swim.rs index fcc378d67a..c0d0c1e30b 100644 --- a/voxygen/anim/src/fish_small/swim.rs +++ b/voxygen/anim/src/fish_small/swim.rs @@ -6,7 +6,7 @@ use std::f32::consts::PI; pub struct SwimAnimation; -type SwimAnimationDependency = (Vec3, Vec3, Vec3, f64, Vec3, f32); +type SwimAnimationDependency = (Vec3, Vec3, Vec3, f32, Vec3, f32); impl Animation for SwimAnimation { type Dependency = SwimAnimationDependency; @@ -20,7 +20,7 @@ impl Animation for SwimAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/golem/alpha.rs b/voxygen/anim/src/golem/alpha.rs index 8f58c6f779..4a722e744d 100644 --- a/voxygen/anim/src/golem/alpha.rs +++ b/voxygen/anim/src/golem/alpha.rs @@ -7,7 +7,7 @@ use common::states::utils::StageSection; pub struct AlphaAnimation; impl Animation for AlphaAnimation { - type Dependency = (Option, f64, f64); + type Dependency = (Option, f32, f32); type Skeleton = GolemSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,23 +18,23 @@ impl Animation for AlphaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (stage_section, global_time, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (move1base, move2base, move3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - move3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let move1 = move1base * pullback; let move2 = move2base * pullback; diff --git a/voxygen/anim/src/golem/idle.rs b/voxygen/anim/src/golem/idle.rs index 98d2d82ce3..2b139c96a2 100644 --- a/voxygen/anim/src/golem/idle.rs +++ b/voxygen/anim/src/golem/idle.rs @@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = GolemSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,26 +18,18 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 1.0; - let breathe = (anim_time as f32 * lab as f32 + 1.5 * PI).sin(); + let lab: f32 = 1.0; + let breathe = (anim_time * lab + 1.5 * PI).sin(); let look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); next.head.scale = Vec3::one() * 1.02; next.jaw.scale = Vec3::one() * 1.02; diff --git a/voxygen/anim/src/golem/run.rs b/voxygen/anim/src/golem/run.rs index 7365851001..a1c7813362 100644 --- a/voxygen/anim/src/golem/run.rs +++ b/voxygen/anim/src/golem/run.rs @@ -7,7 +7,7 @@ use std::f32::consts::PI; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (Vec3, Vec3, Vec3, f64, f32); + type Dependency = (Vec3, Vec3, Vec3, f32, f32); type Skeleton = GolemSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,42 +18,38 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, orientation, last_ori, _global_time, acc_vel): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let speed = Vec2::::from(velocity).magnitude(); - let lab = 0.45 * s_a.tempo; + let lab: f32 = 0.45 * s_a.tempo; let speednorm = (speed / 7.0).powf(0.6); - let foothoril = (((1.0) - / (0.4 + (0.6) * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()).powi(2))) - .sqrt()) - * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()) + let foothoril = ((1.0 / (0.4 + (0.6) * ((acc_vel * 2.0 * lab + PI * 1.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 2.0 * lab + PI * 1.4).sin()) * speednorm; - let foothorir = (((1.0) - / (0.4 + (0.6) * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()).powi(2))) - .sqrt()) - * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()) + let foothorir = ((1.0 / (0.4 + (0.6) * ((acc_vel * 2.0 * lab + PI * 0.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 2.0 * lab + PI * 0.4).sin()) * speednorm; - let footvertl = (acc_vel * 2.0 * lab as f32).sin() * speednorm; - let footvertr = (acc_vel * 2.0 * lab as f32 + PI).sin() * speednorm; + let footvertl = (acc_vel * 2.0 * lab).sin() * speednorm; + let footvertr = (acc_vel * 2.0 * lab + PI).sin() * speednorm; - let footrotl = (((1.0) - / (0.5 + (0.5) * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()).powi(2))) - .sqrt()) - * ((acc_vel * 2.0 * lab as f32 + PI * 1.4).sin()) + let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * 2.0 * lab + PI * 1.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 2.0 * lab + PI * 1.4).sin()) * speednorm; - let footrotr = (((1.0) - / (0.2 + (0.8) * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()).powi(2))) - .sqrt()) - * ((acc_vel * 2.0 * lab as f32 + PI * 0.4).sin()) + let footrotr = ((1.0 / (0.2 + (0.8) * ((acc_vel * 2.0 * lab + PI * 0.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 2.0 * lab + PI * 0.4).sin()) * speednorm; - let short = (acc_vel * lab as f32 * 2.0).sin() * speednorm; - let shortalt = (acc_vel * lab as f32 * 2.0 + PI / 2.0).sin() * speednorm; + let short = (acc_vel * lab * 2.0).sin() * speednorm; + let shortalt = (acc_vel * lab * 2.0 + PI / 2.0).sin() * speednorm; let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); let tilt = if ::vek::Vec2::new(ori, last_ori) diff --git a/voxygen/anim/src/golem/shockwave.rs b/voxygen/anim/src/golem/shockwave.rs index 5f5ef09bee..9b40a15c85 100644 --- a/voxygen/anim/src/golem/shockwave.rs +++ b/voxygen/anim/src/golem/shockwave.rs @@ -8,7 +8,7 @@ use std::f32::consts::PI; pub struct ShockwaveAnimation; impl Animation for ShockwaveAnimation { - type Dependency = (Option, f32, f64); + type Dependency = (Option, f32, f32); type Skeleton = GolemSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,16 +19,16 @@ impl Animation for ShockwaveAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (stage_section, velocity, _global_time): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (move1base, move2base, move3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(2.0)), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(2.0)), _ => (0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/golem/spinmelee.rs b/voxygen/anim/src/golem/spinmelee.rs index 9d283a2edb..9dd87b305d 100644 --- a/voxygen/anim/src/golem/spinmelee.rs +++ b/voxygen/anim/src/golem/spinmelee.rs @@ -19,16 +19,16 @@ impl Animation for SpinMeleeAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, stage_section: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)), _ => (0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/lib.rs b/voxygen/anim/src/lib.rs index 4e6a9cbbc8..4988954a6f 100644 --- a/voxygen/anim/src/lib.rs +++ b/voxygen/anim/src/lib.rs @@ -136,7 +136,7 @@ pub trait Animation { fn update_skeleton_inner( _skeleton: &Self::Skeleton, _dependency: Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, _skeleton_attr: &<::Skeleton as Skeleton>::Attr, ) -> Self::Skeleton; @@ -146,7 +146,7 @@ pub trait Animation { fn update_skeleton( skeleton: &Self::Skeleton, dependency: Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, skeleton_attr: &<::Skeleton as Skeleton>::Attr, ) -> Self::Skeleton { @@ -163,7 +163,7 @@ pub trait Animation { fn( &Self::Skeleton, Self::Dependency, - f64, + f32, &mut f32, &::Attr, ) -> Self::Skeleton, diff --git a/voxygen/anim/src/object/beam.rs b/voxygen/anim/src/object/beam.rs index 56386e154b..92a1eca9d5 100644 --- a/voxygen/anim/src/object/beam.rs +++ b/voxygen/anim/src/object/beam.rs @@ -26,7 +26,7 @@ impl Animation for BeamAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, _stage_section, _body): Self::Dependency, - _anim_time: f64, + _anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/object/idle.rs b/voxygen/anim/src/object/idle.rs index f69f801fc2..95e96112b7 100644 --- a/voxygen/anim/src/object/idle.rs +++ b/voxygen/anim/src/object/idle.rs @@ -7,7 +7,7 @@ use common::comp::item::ToolKind; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = (Option, Option, f64); + type Dependency = (Option, Option, f32); type Skeleton = ObjectSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,7 +18,7 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, _global_time): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/object/shoot.rs b/voxygen/anim/src/object/shoot.rs index d2d558e948..04dc211259 100644 --- a/voxygen/anim/src/object/shoot.rs +++ b/voxygen/anim/src/object/shoot.rs @@ -26,7 +26,7 @@ impl Animation for ShootAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_active_tool_kind, _second_tool_kind, stage_section, body): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -35,9 +35,9 @@ impl Animation for ShootAnimation { let mut next = (*skeleton).clone(); let (movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/quadruped_low/alpha.rs b/voxygen/anim/src/quadruped_low/alpha.rs index 68b98b2304..e60efa6091 100644 --- a/voxygen/anim/src/quadruped_low/alpha.rs +++ b/voxygen/anim/src/quadruped_low/alpha.rs @@ -8,7 +8,7 @@ use common::states::utils::StageSection; pub struct AlphaAnimation; impl Animation for AlphaAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,22 +18,22 @@ impl Animation for AlphaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let twitch3 = (mirror * movement3 * 9.0).sin(); let movement1 = mirror * movement1base * pullback; let movement2 = mirror * movement2base * pullback; diff --git a/voxygen/anim/src/quadruped_low/beta.rs b/voxygen/anim/src/quadruped_low/beta.rs index 43dd5ffd56..1b8bf831a9 100644 --- a/voxygen/anim/src/quadruped_low/beta.rs +++ b/voxygen/anim/src/quadruped_low/beta.rs @@ -8,7 +8,7 @@ use common::states::utils::StageSection; pub struct BetaAnimation; impl Animation for BetaAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,22 +18,22 @@ impl Animation for BetaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let twitch3 = (mirror * movement3 * 9.0).sin(); let movement1 = mirror * movement1base * pullback; let movement2 = mirror * movement2base * pullback; diff --git a/voxygen/anim/src/quadruped_low/breathe.rs b/voxygen/anim/src/quadruped_low/breathe.rs index 82a55d7659..3840db8b3c 100644 --- a/voxygen/anim/src/quadruped_low/breathe.rs +++ b/voxygen/anim/src/quadruped_low/breathe.rs @@ -9,7 +9,7 @@ use std::f32::consts::PI; pub struct BreatheAnimation; impl Animation for BreatheAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,7 +19,7 @@ impl Animation for BreatheAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -27,15 +27,15 @@ impl Animation for BreatheAnimation { let speed = (Vec2::::from(velocity).magnitude()).min(24.0); let (movement1base, _movement2base, movement3, twitch) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0, 0.0), - Some(StageSection::Cast) => (1.0, (anim_time as f32).min(1.0), 0.0, anim_time as f32), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32, 1.0), + Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0), + Some(StageSection::Cast) => (1.0, anim_time.min(1.0), 0.0, anim_time), + Some(StageSection::Recover) => (1.0, 1.0, anim_time, 1.0), _ => (0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let twitch2 = mirror * (twitch * 20.0).sin() * pullback; let twitch2alt = mirror * (twitch * 20.0 + PI / 2.0).sin() * pullback; diff --git a/voxygen/anim/src/quadruped_low/dash.rs b/voxygen/anim/src/quadruped_low/dash.rs index 836de317ac..255500cbe0 100644 --- a/voxygen/anim/src/quadruped_low/dash.rs +++ b/voxygen/anim/src/quadruped_low/dash.rs @@ -9,7 +9,7 @@ use std::f32::consts::PI; pub struct DashAnimation; impl Animation for DashAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,23 +19,23 @@ impl Animation for DashAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, chargemovementbase, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0, 0.0), + Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0), Some(StageSection::Charge) => (1.0, 1.0, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powi(4), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32), + Some(StageSection::Swing) => (1.0, 1.0, anim_time.powi(4), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let twitch1 = (mirror * movement1base * 9.5).sin(); let twitch1fast = (mirror * movement1base * 25.0).sin(); //let twitch3 = (mirror * movement3 * 4.0).sin(); @@ -43,14 +43,12 @@ impl Animation for DashAnimation { //let movement2 = mirror * movement2base * pullback; let movement1abs = movement1base * pullback; let movement2abs = movement2base * pullback; - let short = (((1.0) - / (0.72 + 0.28 * ((anim_time as f32 * 16.0_f32 + PI * 0.25).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 16.0_f32 + PI * 0.25).sin()) + let short = ((1.0 / (0.72 + 0.28 * ((anim_time * 16.0_f32 + PI * 0.25).sin()).powi(2))) + .sqrt()) + * ((anim_time * 16.0_f32 + PI * 0.25).sin()) * chargemovementbase * pullback; - let shortalt = - (anim_time as f32 * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback; + let shortalt = (anim_time * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback; next.head_upper.orientation = Quaternion::rotation_x(movement1abs * 0.4 + movement2abs * 0.3) diff --git a/voxygen/anim/src/quadruped_low/idle.rs b/voxygen/anim/src/quadruped_low/idle.rs index fc35b3dde2..fc3331b6ea 100644 --- a/voxygen/anim/src/quadruped_low/idle.rs +++ b/voxygen/anim/src/quadruped_low/idle.rs @@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,27 +17,19 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slower = (anim_time as f32 * 1.25).sin(); - let slow = (anim_time as f32 * 2.5).sin(); - let slowalt = (anim_time as f32 * 2.5 + PI / 2.0).sin(); + let slower = (anim_time * 1.25).sin(); + let slow = (anim_time * 2.5).sin(); + let slowalt = (anim_time * 2.5 + PI / 2.0).sin(); let dragon_look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.2, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.1, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.2, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.1, ); next.jaw.scale = Vec3::one() * 0.98; next.chest.scale = Vec3::one() * s_a.scaler / 11.0; diff --git a/voxygen/anim/src/quadruped_low/jump.rs b/voxygen/anim/src/quadruped_low/jump.rs index ee1d101619..b4b9914adb 100644 --- a/voxygen/anim/src/quadruped_low/jump.rs +++ b/voxygen/anim/src/quadruped_low/jump.rs @@ -6,7 +6,7 @@ use super::{ pub struct JumpAnimation; impl Animation for JumpAnimation { - type Dependency = (f32, f64); + type Dependency = (f32, f32); type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +16,7 @@ impl Animation for JumpAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/quadruped_low/run.rs b/voxygen/anim/src/quadruped_low/run.rs index 2942df30f7..1b239cd7e8 100644 --- a/voxygen/anim/src/quadruped_low/run.rs +++ b/voxygen/anim/src/quadruped_low/run.rs @@ -7,7 +7,7 @@ use std::f32::consts::PI; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, Vec3, Vec3, f64, Vec3, f32); + type Dependency = (f32, Vec3, Vec3, f32, Vec3, f32); type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,7 +17,7 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -26,39 +26,38 @@ impl Animation for RunAnimation { let speednorm = (speed / 15.0).powf(0.25); - let lab = 0.8 * s_a.tempo; + let lab: f32 = 0.8 * s_a.tempo; let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()).max(-0.7) * speednorm; - let short = (((1.0) / (0.72 + 0.28 * ((acc_vel * lab as f32 + PI * 0.25).sin()).powi(2))) - .sqrt()) - * ((acc_vel * lab as f32 + PI * 0.25).sin()) + let short = ((1.0 / (0.72 + 0.28 * ((acc_vel * lab + PI * 0.25).sin()).powi(2))).sqrt()) + * ((acc_vel * lab + PI * 0.25).sin()) * speednorm; - let shortalt = (acc_vel * lab as f32 + PI * 0.25).sin(); + let shortalt = (acc_vel * lab + PI * 0.25).sin(); - let foothoril = - (((1.0) / (0.4 + (0.6) * ((acc_vel * lab as f32 + PI * 1.45).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 1.45).sin()) - * speednorm; - let footvertl = (acc_vel * lab as f32 + PI * 0.0).sin() * speednorm; + let foothoril = ((1.0 / (0.4 + (0.6) * ((acc_vel * lab + PI * 1.45).sin()).powi(2))) + .sqrt()) + * ((acc_vel * lab + PI * 1.45).sin()) + * speednorm; + let footvertl = (acc_vel * lab + PI * 0.0).sin() * speednorm; - let foothorir = - (((1.0) / (0.4 + (0.6) * ((acc_vel * lab as f32 + PI * 0.45).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 0.45).sin()) - * speednorm; - let footvertr = (acc_vel * lab as f32 + PI).sin() * speednorm; + let foothorir = ((1.0 / (0.4 + (0.6) * ((acc_vel * lab + PI * 0.45).sin()).powi(2))) + .sqrt()) + * ((acc_vel * lab + PI * 0.45).sin()) + * speednorm; + let footvertr = (acc_vel * lab + PI).sin() * speednorm; //back feet - let foothorilb = - (((1.0) / (0.4 + (0.6) * ((acc_vel * lab as f32 + PI * 1.05).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 1.05).sin()) - * speednorm; - let footvertlb = (acc_vel * lab as f32 + PI * (-0.4)).sin() * speednorm; + let foothorilb = ((1.0 / (0.4 + (0.6) * ((acc_vel * lab + PI * 1.05).sin()).powi(2))) + .sqrt()) + * ((acc_vel * lab + PI * 1.05).sin()) + * speednorm; + let footvertlb = (acc_vel * lab + PI * (-0.4)).sin() * speednorm; - let foothorirb = - (((1.0) / (0.4 + (0.6) * ((acc_vel * lab as f32 + PI * 0.05).sin()).powi(2))).sqrt()) - * ((acc_vel * lab as f32 + PI * 0.05).sin()) - * speednorm; - let footvertrb = (acc_vel * lab as f32 + PI * 0.6).sin() * speednorm; + let foothorirb = ((1.0 / (0.4 + (0.6) * ((acc_vel * lab + PI * 0.05).sin()).powi(2))) + .sqrt()) + * ((acc_vel * lab + PI * 0.05).sin()) + * speednorm; + let footvertrb = (acc_vel * lab + PI * 0.6).sin() * speednorm; let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); diff --git a/voxygen/anim/src/quadruped_low/shoot.rs b/voxygen/anim/src/quadruped_low/shoot.rs index f9f7850386..4d0ea35ff0 100644 --- a/voxygen/anim/src/quadruped_low/shoot.rs +++ b/voxygen/anim/src/quadruped_low/shoot.rs @@ -7,7 +7,7 @@ use common::states::utils::StageSection; pub struct ShootAnimation; impl Animation for ShootAnimation { - type Dependency = (f32, f64, Option); + type Dependency = (f32, f32, Option); type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,16 +17,16 @@ impl Animation for ShootAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, _global_time, stage_section): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1, movement2, movement3) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; diff --git a/voxygen/anim/src/quadruped_low/stunned.rs b/voxygen/anim/src/quadruped_low/stunned.rs index 86794cef52..6218f7cc42 100644 --- a/voxygen/anim/src/quadruped_low/stunned.rs +++ b/voxygen/anim/src/quadruped_low/stunned.rs @@ -8,7 +8,7 @@ use common::states::utils::StageSection; pub struct StunnedAnimation; impl Animation for StunnedAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,25 +18,23 @@ impl Animation for StunnedAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, movement2, twitch) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Recover) => ( - 1.0, - (anim_time as f32).powf(3.0), - ((1.0 - anim_time as f32) * 7.0).sin(), - ), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Recover) => { + (1.0, anim_time.powf(3.0), ((1.0 - anim_time) * 7.0).sin()) + }, _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement2; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = mirror * movement1base * pullback; let movement1abs = movement1base * pullback; diff --git a/voxygen/anim/src/quadruped_low/tailwhip.rs b/voxygen/anim/src/quadruped_low/tailwhip.rs index c242defe31..f691af7150 100644 --- a/voxygen/anim/src/quadruped_low/tailwhip.rs +++ b/voxygen/anim/src/quadruped_low/tailwhip.rs @@ -7,7 +7,7 @@ use common::states::utils::StageSection; pub struct TailwhipAnimation; impl Animation for TailwhipAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedLowSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,34 +17,26 @@ impl Animation for TailwhipAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, movement2base, movement3, twitch1, twitch2) = match stage_section { - Some(StageSection::Charge) => ( - (anim_time as f32).min(1.2), - 0.0, - 0.0, - (anim_time as f32 * 15.0).sin(), - 0.0, - ), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0, 1.0, 0.0), - Some(StageSection::Recover) => ( - 1.0, - 1.0, - (anim_time as f32).powi(6), - 1.0, - (anim_time as f32 * 7.0).sin(), - ), + Some(StageSection::Charge) => { + (anim_time.min(1.2), 0.0, 0.0, (anim_time * 15.0).sin(), 0.0) + }, + Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0, 1.0, 0.0), + Some(StageSection::Recover) => { + (1.0, 1.0, anim_time.powi(6), 1.0, (anim_time * 7.0).sin()) + }, _ => (0.0, 0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = mirror * movement1base * pullback; let movement2 = mirror * movement2base * pullback; let movement1abs = movement1base * pullback; diff --git a/voxygen/anim/src/quadruped_medium/alpha.rs b/voxygen/anim/src/quadruped_medium/alpha.rs index cc8a0bf855..dfc9395c2d 100644 --- a/voxygen/anim/src/quadruped_medium/alpha.rs +++ b/voxygen/anim/src/quadruped_medium/alpha.rs @@ -7,7 +7,7 @@ use common::states::utils::StageSection; pub struct AlphaAnimation; impl Animation for AlphaAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,7 +17,7 @@ impl Animation for AlphaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -25,15 +25,15 @@ impl Animation for AlphaAnimation { let speed = (Vec2::::from(velocity).magnitude()).min(24.0); let (movement1base, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = movement1base * mirror * pullback; let movement1abs = movement1base * pullback; let movement2 = movement2base * mirror * pullback; diff --git a/voxygen/anim/src/quadruped_medium/beta.rs b/voxygen/anim/src/quadruped_medium/beta.rs index 81009ac985..09b5a817c5 100644 --- a/voxygen/anim/src/quadruped_medium/beta.rs +++ b/voxygen/anim/src/quadruped_medium/beta.rs @@ -7,7 +7,7 @@ use common::states::utils::StageSection; pub struct BetaAnimation; impl Animation for BetaAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,7 +17,7 @@ impl Animation for BetaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -25,15 +25,15 @@ impl Animation for BetaAnimation { let speed = (Vec2::::from(velocity).magnitude()).min(24.0); let (movement1base, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).sqrt(), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.sqrt(), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = movement1base * mirror * pullback; let movement1abs = movement1base * pullback; let movement2 = movement2base * mirror * pullback; diff --git a/voxygen/anim/src/quadruped_medium/dash.rs b/voxygen/anim/src/quadruped_medium/dash.rs index b467e5a766..10027b6292 100644 --- a/voxygen/anim/src/quadruped_medium/dash.rs +++ b/voxygen/anim/src/quadruped_medium/dash.rs @@ -9,7 +9,7 @@ use std::f32::consts::PI; pub struct DashAnimation; impl Animation for DashAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -19,7 +19,7 @@ impl Animation for DashAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -27,18 +27,16 @@ impl Animation for DashAnimation { let (movement1base, chargemovementbase, movement2base, movement3, legtell) = match stage_section { - Some(StageSection::Buildup) => { - ((anim_time as f32).sqrt(), 0.0, 0.0, 0.0, (anim_time as f32)) - }, + Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0, 0.0, anim_time), Some(StageSection::Charge) => (1.0, 1.0, 0.0, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powi(4), 0.0, 1.0), - Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32, 1.0), + Some(StageSection::Swing) => (1.0, 1.0, anim_time.powi(4), 0.0, 1.0), + Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time, 1.0), _ => (0.0, 0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let twitch1 = (mirror * movement1base * 9.5).sin(); let twitch1fast = (mirror * movement1base * 25.0).sin(); //let twitch3 = (mirror * movement3 * 4.0).sin(); @@ -48,14 +46,12 @@ impl Animation for DashAnimation { let movement2abs = movement2base * pullback; let legtwitch = (legtell * 6.0).sin() * pullback; let legswing = legtell * pullback; - let short = (((1.0) - / (0.72 + 0.28 * ((anim_time as f32 * 16.0_f32 + PI * 0.25).sin()).powi(2))) - .sqrt()) - * ((anim_time as f32 * 16.0_f32 + PI * 0.25).sin()) + let short = ((1.0 / (0.72 + 0.28 * ((anim_time * 16.0_f32 + PI * 0.25).sin()).powi(2))) + .sqrt()) + * ((anim_time * 16.0_f32 + PI * 0.25).sin()) * chargemovementbase * pullback; - let shortalt = - (anim_time as f32 * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback; + let shortalt = (anim_time * 16.0_f32 + PI * 0.25).sin() * chargemovementbase * pullback; next.head.orientation = Quaternion::rotation_x(movement1abs * -0.2 + movement2abs * 0.8) * Quaternion::rotation_z(short * -0.06 + twitch1 * 0.2); diff --git a/voxygen/anim/src/quadruped_medium/feed.rs b/voxygen/anim/src/quadruped_medium/feed.rs index eb0f1f1ef8..410b4c109c 100644 --- a/voxygen/anim/src/quadruped_medium/feed.rs +++ b/voxygen/anim/src/quadruped_medium/feed.rs @@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct FeedAnimation; impl Animation for FeedAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,29 +17,21 @@ impl Animation for FeedAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slower = (anim_time as f32 * 1.0 + PI).sin(); - let slow = (anim_time as f32 * 3.5 + PI).sin(); - let fast = (anim_time as f32 * 5.0).sin(); - let faster = (anim_time as f32 * 14.0).sin(); + let slower = (anim_time * 1.0 + PI).sin(); + let slow = (anim_time * 3.5 + PI).sin(); + let fast = (anim_time * 5.0).sin(); + let faster = (anim_time * 14.0).sin(); - let transition = (((anim_time as f32).powf(2.0)).min(1.0)) * s_a.feed.1; + let transition = ((anim_time.powf(2.0)).min(1.0)) * s_a.feed.1; let look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); if s_a.feed.0 { @@ -69,8 +61,7 @@ impl Animation for FeedAnimation { next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2 + 0.5); - next.jaw.orientation = - Quaternion::rotation_x(slow * 0.05 * (anim_time as f32).min(1.0) - 0.08); + next.jaw.orientation = Quaternion::rotation_x(slow * 0.05 * anim_time.min(1.0) - 0.08); } next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); diff --git a/voxygen/anim/src/quadruped_medium/hoof.rs b/voxygen/anim/src/quadruped_medium/hoof.rs index 20338b07f2..1aa8f53b7f 100644 --- a/voxygen/anim/src/quadruped_medium/hoof.rs +++ b/voxygen/anim/src/quadruped_medium/hoof.rs @@ -8,7 +8,7 @@ use std::f32::consts::PI; pub struct HoofAnimation; impl Animation for HoofAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,7 +18,7 @@ impl Animation for HoofAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -26,22 +26,20 @@ impl Animation for HoofAnimation { let speed = (Vec2::::from(velocity).magnitude()).min(24.0); let (movement1base, movement2base, movement3, twitch) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0), - Some(StageSection::Swing) => { - (1.0, (anim_time as f32).powf(0.25), 0.0, anim_time as f32) - }, - Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powi(4), 1.0), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0, anim_time), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 1.0), _ => (0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = movement1base * mirror * pullback; let movement2 = movement2base * mirror * pullback; let movement1abs = movement1base * pullback; let movement2abs = movement2base * pullback; - let twitchleft = (twitch as f32 * 16.0).sin() * pullback * mirror; + let twitchleft = (twitch * 16.0).sin() * pullback * mirror; let twitchright = (twitch * 8.0 + PI / 2.0).sin() * pullback * mirror; next.head.orientation = Quaternion::rotation_x(movement1abs * -0.6 + movement2abs * 0.6) diff --git a/voxygen/anim/src/quadruped_medium/idle.rs b/voxygen/anim/src/quadruped_medium/idle.rs index 54cafabc67..194be1578c 100644 --- a/voxygen/anim/src/quadruped_medium/idle.rs +++ b/voxygen/anim/src/quadruped_medium/idle.rs @@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,38 +17,22 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slower = (anim_time as f32 * 1.0 + PI).sin(); - let slow = (anim_time as f32 * 3.5 + PI).sin(); + let slower = (anim_time * 1.0 + PI).sin(); + let slow = (anim_time * 3.5 + PI).sin(); let look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); let tailmove = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 0.25, - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(1337.0) - .sin() - * 0.125, + (global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.25, + (global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.125, ); next.neck.scale = Vec3::one() * 1.02; diff --git a/voxygen/anim/src/quadruped_medium/jump.rs b/voxygen/anim/src/quadruped_medium/jump.rs index fc7127b274..50753cf3a6 100644 --- a/voxygen/anim/src/quadruped_medium/jump.rs +++ b/voxygen/anim/src/quadruped_medium/jump.rs @@ -6,7 +6,7 @@ use super::{ pub struct JumpAnimation; impl Animation for JumpAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +16,7 @@ impl Animation for JumpAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, _global_time: Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/quadruped_medium/leapmelee.rs b/voxygen/anim/src/quadruped_medium/leapmelee.rs index 91888d00d2..f89950c6c6 100644 --- a/voxygen/anim/src/quadruped_medium/leapmelee.rs +++ b/voxygen/anim/src/quadruped_medium/leapmelee.rs @@ -7,7 +7,7 @@ use common::states::utils::StageSection; pub struct LeapMeleeAnimation; impl Animation for LeapMeleeAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,7 +17,7 @@ impl Animation for LeapMeleeAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -25,16 +25,16 @@ impl Animation for LeapMeleeAnimation { //let speed = (Vec2::::from(velocity).magnitude()).min(24.0); let (movement1base, movement2base, movement3base, movement4) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0), - Some(StageSection::Movement) => (1.0, anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (0.0, 1.0, 1.0, (anim_time as f32).powi(4)), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0), + Some(StageSection::Movement) => (1.0, anim_time, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, 1.0, anim_time, 0.0), + Some(StageSection::Recover) => (0.0, 1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - movement4; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1abs = movement1base * pullback; let movement2abs = movement2base * pullback; let movement3abs = movement3base * pullback; diff --git a/voxygen/anim/src/quadruped_medium/run.rs b/voxygen/anim/src/quadruped_medium/run.rs index 827099f754..7d7b117e15 100644 --- a/voxygen/anim/src/quadruped_medium/run.rs +++ b/voxygen/anim/src/quadruped_medium/run.rs @@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, Vec3, Vec3, f64, Vec3, f32); + type Dependency = (f32, Vec3, Vec3, f32, Vec3, f32); type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,41 +17,31 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, orientation, last_ori, global_time, avg_vel, acc_vel): Self::Dependency, - anim_time: f64, + anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let speed = (Vec2::::from(velocity).magnitude()).min(24.0); *rate = 1.0; - let lab = 0.72; + let lab: f32 = 0.72; let amplitude = (speed / 24.0).powf(0.6); let amplitude2 = (speed / 24.0).powf(0.6); let amplitude3 = (speed / 24.0).powf(0.6); let speedmult = s_a.tempo; let canceler = (speed / 24.0).powf(0.6); - let short = (((1.0) + let short = ((1.0 / (0.72 - + 0.28 - * ((acc_vel * (1.0) * lab as f32 * speedmult + PI * -0.15 - 0.5).sin()) - .powi(2))) + + 0.28 * ((acc_vel * (1.0) * lab * speedmult + PI * -0.15 - 0.5).sin()).powi(2))) .sqrt()) - * ((acc_vel * (1.0) * lab as f32 * speedmult + PI * -0.15 - 0.5).sin()); + * ((acc_vel * (1.0) * lab * speedmult + PI * -0.15 - 0.5).sin()); // - let shortalt = (acc_vel * (1.0) * lab as f32 * speedmult + PI * 3.0 / 8.0 - 0.5).sin(); + let shortalt = (acc_vel * (1.0) * lab * speedmult + PI * 3.0 / 8.0 - 0.5).sin(); let look = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.25, ); let speedadjust = if speed < 5.0 { 0.0 } else { speed / 24.0 }; @@ -61,21 +51,17 @@ impl Animation for RunAnimation { let shift4 = speedadjust - PI * 3.0 / 4.0 + speedadjust * PI / 2.0; //FL - let foot1a = - (acc_vel * (1.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift1).sin(); //1.5 - let foot1b = - (acc_vel * (1.0) * lab as f32 * speedmult + 1.1 + canceler * 0.05 + shift1).sin(); //1.9 + let foot1a = (acc_vel * (1.0) * lab * speedmult + 0.0 + canceler * 0.05 + shift1).sin(); //1.5 + let foot1b = (acc_vel * (1.0) * lab * speedmult + 1.1 + canceler * 0.05 + shift1).sin(); //1.9 //FR - let foot2a = (acc_vel * (1.0) * lab as f32 * speedmult + shift2).sin(); //1.0 - let foot2b = (acc_vel * (1.0) * lab as f32 * speedmult + 1.1 + shift2).sin(); //1.0 + let foot2a = (acc_vel * (1.0) * lab * speedmult + shift2).sin(); //1.0 + let foot2b = (acc_vel * (1.0) * lab * speedmult + 1.1 + shift2).sin(); //1.0 //BL - let foot3a = (acc_vel * (1.0) * lab as f32 * speedmult + shift3).sin(); //0.0 - let foot3b = (acc_vel * (1.0) * lab as f32 * speedmult + 1.57 + shift3).sin(); //0.4 + let foot3a = (acc_vel * (1.0) * lab * speedmult + shift3).sin(); //0.0 + let foot3b = (acc_vel * (1.0) * lab * speedmult + 1.57 + shift3).sin(); //0.4 //BR - let foot4a = - (acc_vel * (1.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift4).sin(); //0.3 - let foot4b = - (acc_vel * (1.0) * lab as f32 * speedmult + 1.57 + canceler * 0.05 + shift4).sin(); //0.7 + let foot4a = (acc_vel * (1.0) * lab * speedmult + 0.0 + canceler * 0.05 + shift4).sin(); //0.3 + let foot4b = (acc_vel * (1.0) * lab * speedmult + 1.57 + canceler * 0.05 + shift4).sin(); //0.7 // let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); diff --git a/voxygen/anim/src/quadruped_medium/stunned.rs b/voxygen/anim/src/quadruped_medium/stunned.rs index 22dff2f904..33e60ee0b5 100644 --- a/voxygen/anim/src/quadruped_medium/stunned.rs +++ b/voxygen/anim/src/quadruped_medium/stunned.rs @@ -7,7 +7,7 @@ use common::states::utils::StageSection; pub struct StunnedAnimation; impl Animation for StunnedAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedMediumSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,25 +17,23 @@ impl Animation for StunnedAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, movement2, twitch) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Recover) => ( - 1.0, - (anim_time as f32).powf(3.0), - ((1.0 - anim_time as f32) * 7.0).sin(), - ), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Recover) => { + (1.0, anim_time.powf(3.0), ((1.0 - anim_time) * 7.0).sin()) + }, _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement2; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = movement1base * mirror * pullback; let movement1abs = movement1base * pullback; diff --git a/voxygen/anim/src/quadruped_small/alpha.rs b/voxygen/anim/src/quadruped_small/alpha.rs index 37f03c3f1b..d2de36e5b7 100644 --- a/voxygen/anim/src/quadruped_small/alpha.rs +++ b/voxygen/anim/src/quadruped_small/alpha.rs @@ -8,7 +8,7 @@ use common::states::utils::StageSection; pub struct AlphaAnimation; impl Animation for AlphaAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedSmallSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,22 +18,22 @@ impl Animation for AlphaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).sqrt(), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time.sqrt(), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = mirror * movement1base * pullback; let movement2 = mirror * movement2base * pullback; let movement1abs = movement1base * pullback; diff --git a/voxygen/anim/src/quadruped_small/feed.rs b/voxygen/anim/src/quadruped_small/feed.rs index f9dc97fd20..74ef3e5acd 100644 --- a/voxygen/anim/src/quadruped_small/feed.rs +++ b/voxygen/anim/src/quadruped_small/feed.rs @@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct FeedAnimation; impl Animation for FeedAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = QuadrupedSmallSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,28 +17,20 @@ impl Animation for FeedAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 5.0).sin(); - let quick = (anim_time as f32 * 14.0).sin(); + let slow = (anim_time * 5.0).sin(); + let quick = (anim_time * 14.0).sin(); - let slow_alt = (anim_time as f32 * 3.5 + PI).sin(); + let slow_alt = (anim_time * 3.5 + PI).sin(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(7331.0) - .sin() - * 1.0, - ((global_time + anim_time) as f32 / 2.0) - .floor() - .mul(1337.0) - .sin() - * 0.5, + (global_time + anim_time / 2.0).floor().mul(7331.0).sin() * 1.0, + (global_time + anim_time / 2.0).floor().mul(1337.0).sin() * 0.5, ); next.chest.scale = Vec3::one() / 11.0 * s_a.scaler; diff --git a/voxygen/anim/src/quadruped_small/idle.rs b/voxygen/anim/src/quadruped_small/idle.rs index f20c4debb6..046d7065ae 100644 --- a/voxygen/anim/src/quadruped_small/idle.rs +++ b/voxygen/anim/src/quadruped_small/idle.rs @@ -7,7 +7,7 @@ use std::{f32::consts::PI, ops::Mul}; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = QuadrupedSmallSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,27 +17,19 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 3.5).sin(); + let slow = (anim_time * 3.5).sin(); - let slow_alt = (anim_time as f32 * 3.5 + PI / 2.0).sin(); + let slow_alt = (anim_time * 3.5 + PI / 2.0).sin(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * 0.2); diff --git a/voxygen/anim/src/quadruped_small/jump.rs b/voxygen/anim/src/quadruped_small/jump.rs index 4af9adadb1..465d75ac65 100644 --- a/voxygen/anim/src/quadruped_small/jump.rs +++ b/voxygen/anim/src/quadruped_small/jump.rs @@ -6,7 +6,7 @@ use super::{ pub struct JumpAnimation; impl Animation for JumpAnimation { - type Dependency = (f32, f64); + type Dependency = (f32, f32); type Skeleton = QuadrupedSmallSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +16,7 @@ impl Animation for JumpAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, _global_time): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/quadruped_small/run.rs b/voxygen/anim/src/quadruped_small/run.rs index e76a81e557..85ff64aef3 100644 --- a/voxygen/anim/src/quadruped_small/run.rs +++ b/voxygen/anim/src/quadruped_small/run.rs @@ -7,7 +7,7 @@ use std::f32::consts::PI; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, Vec3, Vec3, f64, Vec3, f32); + type Dependency = (f32, Vec3, Vec3, f32, Vec3, f32); type Skeleton = QuadrupedSmallSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,25 +17,25 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let lab = 0.8; //6 + let lab: f32 = 0.8; //6 let speed = (Vec2::::from(velocity).magnitude()).min(12.0); let speednorm = (speed / 12.0).powf(0.4); let speedmult = s_a.tempo; - let short = (acc_vel * lab as f32 * speedmult + PI * 1.0).sin() * speednorm; - let shortalt = (acc_vel * lab as f32 * speedmult + PI * 0.5).sin() * speednorm; + let short = (acc_vel * lab * speedmult + PI * 1.0).sin() * speednorm; + let shortalt = (acc_vel * lab * speedmult + PI * 0.5).sin() * speednorm; - let footvert = (acc_vel * lab as f32 * speedmult + PI * 0.0).sin() * speednorm; - let footvertt = (acc_vel * lab as f32 * speedmult + PI * 0.4).sin() * speednorm; + let footvert = (acc_vel * lab * speedmult + PI * 0.0).sin() * speednorm; + let footvertt = (acc_vel * lab * speedmult + PI * 0.4).sin() * speednorm; - let footvertf = (acc_vel * lab as f32 * speedmult + PI * 0.3).sin() * speednorm; - let footverttf = (acc_vel * lab as f32 * speedmult + PI * 0.7).sin() * speednorm; + let footvertf = (acc_vel * lab * speedmult + PI * 0.3).sin() * speednorm; + let footverttf = (acc_vel * lab * speedmult + PI * 0.7).sin() * speednorm; let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); diff --git a/voxygen/anim/src/quadruped_small/stunned.rs b/voxygen/anim/src/quadruped_small/stunned.rs index a449436991..d99c23dab2 100644 --- a/voxygen/anim/src/quadruped_small/stunned.rs +++ b/voxygen/anim/src/quadruped_small/stunned.rs @@ -8,7 +8,7 @@ use common::states::utils::StageSection; pub struct StunnedAnimation; impl Animation for StunnedAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = QuadrupedSmallSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,25 +18,23 @@ impl Animation for StunnedAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, movement2, twitch) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), - Some(StageSection::Recover) => ( - 1.0, - (anim_time as f32).powf(3.0), - ((1.0 - anim_time as f32) * 10.0).sin(), - ), + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Recover) => { + (1.0, anim_time.powf(3.0), ((1.0 - anim_time) * 10.0).sin()) + }, _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement2; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = mirror * movement1base * pullback; let movement1abs = movement1base * pullback; next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); diff --git a/voxygen/anim/src/theropod/alpha.rs b/voxygen/anim/src/theropod/alpha.rs index 88d69ca6f3..ef2fb77811 100644 --- a/voxygen/anim/src/theropod/alpha.rs +++ b/voxygen/anim/src/theropod/alpha.rs @@ -8,7 +8,7 @@ use common::states::utils::StageSection; pub struct AlphaAnimation; impl Animation for AlphaAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = TheropodSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,22 +18,22 @@ impl Animation for AlphaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powi(2), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time.powi(2), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = mirror * movement1base * pullback; let movement2 = mirror * movement2base * pullback; let movement1abs = movement1base * pullback; diff --git a/voxygen/anim/src/theropod/beta.rs b/voxygen/anim/src/theropod/beta.rs index c1a523fd7f..bdcfebfc57 100644 --- a/voxygen/anim/src/theropod/beta.rs +++ b/voxygen/anim/src/theropod/beta.rs @@ -8,7 +8,7 @@ use common::states::utils::StageSection; pub struct BetaAnimation; impl Animation for BetaAnimation { - type Dependency = (f32, f64, Option, f64); + type Dependency = (f32, f32, Option, f32); type Skeleton = TheropodSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -18,22 +18,22 @@ impl Animation for BetaAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, global_time, stage_section, timer): Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, _s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let (movement1base, movement2base, movement3) = match stage_section { - Some(StageSection::Buildup) => ((anim_time as f32).powi(2), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, (anim_time as f32).powi(4), 0.0), - Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + Some(StageSection::Buildup) => (anim_time.powi(2), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; let subtract = global_time - timer; let check = subtract - subtract.trunc(); - let mirror = (check - 0.5).signum() as f32; + let mirror = (check - 0.5).signum(); let movement1 = mirror * movement1base * pullback; let movement2 = mirror * movement2base * pullback; let movement1abs = movement1base * pullback; diff --git a/voxygen/anim/src/theropod/idle.rs b/voxygen/anim/src/theropod/idle.rs index bcb1622858..8980af32e6 100644 --- a/voxygen/anim/src/theropod/idle.rs +++ b/voxygen/anim/src/theropod/idle.rs @@ -6,7 +6,7 @@ use std::ops::Mul; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = f64; + type Dependency = f32; type Skeleton = TheropodSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,24 +16,16 @@ impl Animation for IdleAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, global_time: Self::Dependency, - anim_time: f64, + anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let breathe = (anim_time as f32 * 0.8).sin(); + let breathe = (anim_time * 0.8).sin(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(7331.0) - .sin() - * 0.5, - ((global_time + anim_time) as f32 / 8.0) - .floor() - .mul(1337.0) - .sin() - * 0.25, + (global_time + anim_time / 8.0).floor().mul(7331.0).sin() * 0.5, + (global_time + anim_time / 8.0).floor().mul(1337.0).sin() * 0.25, ); next.head.scale = Vec3::one() * 1.02; diff --git a/voxygen/anim/src/theropod/jump.rs b/voxygen/anim/src/theropod/jump.rs index cd37180b7b..fae7303037 100644 --- a/voxygen/anim/src/theropod/jump.rs +++ b/voxygen/anim/src/theropod/jump.rs @@ -5,7 +5,7 @@ use super::super::vek::*; pub struct JumpAnimation; impl Animation for JumpAnimation { - type Dependency = (f32, Vec3, Vec3, f64, Vec3); + type Dependency = (f32, Vec3, Vec3, f32, Vec3); type Skeleton = TheropodSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for JumpAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency, - _anim_time: f64, + _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { diff --git a/voxygen/anim/src/theropod/run.rs b/voxygen/anim/src/theropod/run.rs index c70e1a2511..260f7313d0 100644 --- a/voxygen/anim/src/theropod/run.rs +++ b/voxygen/anim/src/theropod/run.rs @@ -6,7 +6,7 @@ use std::f32::consts::PI; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (Vec3, Vec3, Vec3, f64, Vec3, f32); + type Dependency = (Vec3, Vec3, Vec3, f32, Vec3, f32); type Skeleton = TheropodSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -16,7 +16,7 @@ impl Animation for RunAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, (velocity, orientation, last_ori, _global_time, avg_vel, acc_vel): Self::Dependency, - _anim_time: f64, + _anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { @@ -28,27 +28,24 @@ impl Animation for RunAnimation { let speednorm = (speed / 13.0).powf(0.25); let speedmult = 1.0; - let lab = 0.6; //6 + let lab: f32 = 0.6; //6 - let short = (((1.0) + let short = ((1.0 / (0.72 - + 0.28 - * ((acc_vel * 1.0 * lab as f32 * speedmult + PI * -0.15 - 0.5).sin()) - .powi(2))) + + 0.28 * ((acc_vel * 1.0 * lab * speedmult + PI * -0.15 - 0.5).sin()).powi(2))) .sqrt()) - * ((acc_vel * 1.0 * lab as f32 * speedmult + PI * -0.15 - 0.5).sin()) + * ((acc_vel * 1.0 * lab * speedmult + PI * -0.15 - 0.5).sin()) * speednorm; // - let shortalt = - (acc_vel * 1.0 * lab as f32 * speedmult + PI * 3.0 / 8.0 - 0.5).sin() * speednorm; + let shortalt = (acc_vel * 1.0 * lab * speedmult + PI * 3.0 / 8.0 - 0.5).sin() * speednorm; //FL - let foot1a = (acc_vel * 1.0 * lab as f32 * speedmult + 0.0 + PI).sin() * speednorm; //1.5 - let foot1b = (acc_vel * 1.0 * lab as f32 * speedmult + 1.57 + PI).sin() * speednorm; //1.9 + let foot1a = (acc_vel * 1.0 * lab * speedmult + 0.0 + PI).sin() * speednorm; //1.5 + let foot1b = (acc_vel * 1.0 * lab * speedmult + 1.57 + PI).sin() * speednorm; //1.9 //FR - let foot2a = (acc_vel * 1.0 * lab as f32 * speedmult).sin() * speednorm; //1.2 - let foot2b = (acc_vel * 1.0 * lab as f32 * speedmult + 1.57).sin() * speednorm; //1.6 + let foot2a = (acc_vel * 1.0 * lab * speedmult).sin() * speednorm; //1.2 + let foot2b = (acc_vel * 1.0 * lab * speedmult + 1.57).sin() * speednorm; //1.6 let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); let tilt = if ::vek::Vec2::new(ori, last_ori) diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 96c1dabbf8..3ccbdf2a04 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -482,7 +482,7 @@ impl FigureMgr { ) -> anim::vek::Aabb { span!(_guard, "maintain", "FigureManager::maintain"); let state = scene_data.state; - let time = state.get_time(); + let time = state.get_time() as f32; let tick = scene_data.tick; let ecs = state.ecs(); let view_distance = scene_data.view_distance; @@ -838,17 +838,17 @@ impl FigureMgr { }; let target_bones = match &character { CharacterState::Roll(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Movement => { - stage_time / s.static_data.movement_duration.as_secs_f64() + stage_time / s.static_data.movement_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -884,14 +884,14 @@ impl FigureMgr { ) }, CharacterState::ChargedRanged(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -916,14 +916,14 @@ impl FigureMgr { ) }, CharacterState::BasicRanged(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -948,17 +948,17 @@ impl FigureMgr { ) }, CharacterState::ChargedMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Charge => { - stage_time / s.static_data.charge_duration.as_secs_f64() + stage_time / s.static_data.charge_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -978,20 +978,20 @@ impl FigureMgr { ) }, CharacterState::RepeaterRanged(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Movement => { - stage_time / s.static_data.movement_duration.as_secs_f64() + stage_time / s.static_data.movement_duration.as_secs_f32() }, StageSection::Shoot => { - stage_time / s.static_data.shoot_duration.as_secs_f64() + stage_time / s.static_data.shoot_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -1042,19 +1042,19 @@ impl FigureMgr { ) }, CharacterState::DashMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Charge => { - stage_time / s.static_data.charge_duration.as_secs_f64() + stage_time / s.static_data.charge_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -1072,16 +1072,16 @@ impl FigureMgr { ) }, CharacterState::Shockwave(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -1102,22 +1102,22 @@ impl FigureMgr { CharacterState::LeapMelee(s) => { let stage_progress = match active_tool_kind { Some(ToolKind::Axe | ToolKind::Hammer) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); match s.stage_section { StageSection::Buildup => { stage_time - / s.static_data.buildup_duration.as_secs_f64() + / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Movement => { stage_time - / s.static_data.movement_duration.as_secs_f64() + / s.static_data.movement_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { stage_time - / s.static_data.recover_duration.as_secs_f64() + / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, } @@ -1142,18 +1142,18 @@ impl FigureMgr { CharacterState::SpinMelee(s) => { let stage_progress = match active_tool_kind { Some(ToolKind::Axe | ToolKind::Sword) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); match s.stage_section { StageSection::Buildup => { stage_time - / s.static_data.buildup_duration.as_secs_f64() + / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { stage_time - / s.static_data.recover_duration.as_secs_f64() + / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, } @@ -1176,14 +1176,14 @@ impl FigureMgr { ) }, CharacterState::Stunned(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let wield_status = s.was_wielded; let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -1227,14 +1227,14 @@ impl FigureMgr { } }, CharacterState::BasicBeam(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, - StageSection::Cast => s.timer.as_secs_f64(), + StageSection::Cast => s.timer.as_secs_f32(), StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -1254,25 +1254,25 @@ impl FigureMgr { }, CharacterState::ComboMelee(s) => { let stage_index = (s.stage - 1) as usize; - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.stage_data[stage_index] .base_buildup_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Swing => { stage_time / s.static_data.stage_data[stage_index] .base_swing_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Recover => { stage_time / s.static_data.stage_data[stage_index] .base_recover_duration - .as_secs_f64() + .as_secs_f32() }, _ => 0.0, }; @@ -1564,25 +1564,25 @@ impl FigureMgr { let target_bones = match &character { CharacterState::ComboMelee(s) => { let stage_index = (s.stage - 1) as usize; - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.stage_data[stage_index] .base_buildup_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Swing => { stage_time / s.static_data.stage_data[stage_index] .base_swing_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Recover => { stage_time / s.static_data.stage_data[stage_index] .base_recover_duration - .as_secs_f64() + .as_secs_f32() }, _ => 0.0, }; @@ -1602,13 +1602,13 @@ impl FigureMgr { } }, CharacterState::Stunned(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -1775,17 +1775,17 @@ impl FigureMgr { }; let target_bones = match &character { CharacterState::BasicMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -1804,17 +1804,17 @@ impl FigureMgr { ) }, CharacterState::DashMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Charge => stage_time, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -1832,19 +1832,19 @@ impl FigureMgr { ) }, CharacterState::LeapMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Movement => { - stage_time / s.static_data.movement_duration.as_secs_f64() + stage_time / s.static_data.movement_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -1863,25 +1863,25 @@ impl FigureMgr { }, CharacterState::ComboMelee(s) => { let stage_index = (s.stage - 1) as usize; - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.stage_data[stage_index] .base_buildup_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Swing => { stage_time / s.static_data.stage_data[stage_index] .base_swing_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Recover => { stage_time / s.static_data.stage_data[stage_index] .base_recover_duration - .as_secs_f64() + .as_secs_f32() }, _ => 0.0, }; @@ -1925,13 +1925,13 @@ impl FigureMgr { } }, CharacterState::Stunned(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -2094,14 +2094,14 @@ impl FigureMgr { }; let target_bones = match &character { CharacterState::BasicRanged(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -2115,17 +2115,17 @@ impl FigureMgr { ) }, CharacterState::BasicMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -2145,17 +2145,17 @@ impl FigureMgr { }, CharacterState::ChargedMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Charge => { - stage_time / s.static_data.charge_duration.as_secs_f64() + stage_time / s.static_data.charge_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -2174,13 +2174,13 @@ impl FigureMgr { ) }, CharacterState::Stunned(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -2219,25 +2219,25 @@ impl FigureMgr { }, CharacterState::ComboMelee(s) => { let stage_index = (s.stage - 1) as usize; - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.stage_data[stage_index] .base_buildup_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Swing => { stage_time / s.static_data.stage_data[stage_index] .base_swing_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Recover => { stage_time / s.static_data.stage_data[stage_index] .base_recover_duration - .as_secs_f64() + .as_secs_f32() }, _ => 0.0, }; @@ -2281,14 +2281,14 @@ impl FigureMgr { } }, CharacterState::BasicBeam(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, - StageSection::Cast => s.timer.as_secs_f64(), + StageSection::Cast => s.timer.as_secs_f32(), StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -2306,17 +2306,17 @@ impl FigureMgr { ) }, CharacterState::DashMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Charge => stage_time, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -2673,19 +2673,19 @@ impl FigureMgr { ) }, CharacterState::DashMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Charge => { - stage_time / s.static_data.charge_duration.as_secs_f64() + stage_time / s.static_data.charge_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -2707,14 +2707,14 @@ impl FigureMgr { ) }, CharacterState::ChargedRanged(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -2738,14 +2738,14 @@ impl FigureMgr { ) }, CharacterState::BasicRanged(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -2770,25 +2770,25 @@ impl FigureMgr { }, CharacterState::ComboMelee(s) => { let stage_index = (s.stage - 1) as usize; - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.stage_data[stage_index] .base_buildup_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Swing => { stage_time / s.static_data.stage_data[stage_index] .base_swing_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Recover => { stage_time / s.static_data.stage_data[stage_index] .base_recover_duration - .as_secs_f64() + .as_secs_f32() }, _ => 0.0, }; @@ -3021,25 +3021,25 @@ impl FigureMgr { let target_bones = match &character { CharacterState::ComboMelee(s) => { let stage_index = (s.stage - 1) as usize; - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.stage_data[stage_index] .base_buildup_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Swing => { stage_time / s.static_data.stage_data[stage_index] .base_swing_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Recover => { stage_time / s.static_data.stage_data[stage_index] .base_recover_duration - .as_secs_f64() + .as_secs_f32() }, _ => 0.0, }; @@ -3374,14 +3374,14 @@ impl FigureMgr { ) }, CharacterState::BasicRanged(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -3406,14 +3406,14 @@ impl FigureMgr { ) }, CharacterState::ChargedRanged(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -3438,19 +3438,19 @@ impl FigureMgr { ) }, CharacterState::DashMelee(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Charge => { - stage_time / s.static_data.charge_duration.as_secs_f64() + stage_time / s.static_data.charge_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -3471,25 +3471,25 @@ impl FigureMgr { }, CharacterState::ComboMelee(s) => { let stage_index = (s.stage - 1) as usize; - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.stage_data[stage_index] .base_buildup_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Swing => { stage_time / s.static_data.stage_data[stage_index] .base_swing_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Recover => { stage_time / s.static_data.stage_data[stage_index] .base_recover_duration - .as_secs_f64() + .as_secs_f32() }, _ => 0.0, }; @@ -3541,18 +3541,18 @@ impl FigureMgr { CharacterState::SpinMelee(s) => { let stage_progress = match active_tool_kind { Some(ToolKind::Sword) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); match s.stage_section { StageSection::Buildup => { stage_time - / s.static_data.buildup_duration.as_secs_f64() + / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { stage_time - / s.static_data.recover_duration.as_secs_f64() + / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, } @@ -3577,22 +3577,22 @@ impl FigureMgr { CharacterState::LeapMelee(s) => { let stage_progress = match active_tool_kind { Some(ToolKind::Axe | ToolKind::Hammer) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); match s.stage_section { StageSection::Buildup => { stage_time - / s.static_data.buildup_duration.as_secs_f64() + / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Movement => { stage_time - / s.static_data.movement_duration.as_secs_f64() + / s.static_data.movement_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { stage_time - / s.static_data.recover_duration.as_secs_f64() + / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, } @@ -3615,16 +3615,16 @@ impl FigureMgr { ) }, CharacterState::Shockwave(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -3643,14 +3643,14 @@ impl FigureMgr { ) }, CharacterState::BasicBeam(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, - StageSection::Cast => s.timer.as_secs_f64(), + StageSection::Cast => s.timer.as_secs_f32(), StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -3771,25 +3771,25 @@ impl FigureMgr { let target_bones = match &character { CharacterState::ComboMelee(s) => { let stage_index = (s.stage - 1) as usize; - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { stage_time / s.static_data.stage_data[stage_index] .base_buildup_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Swing => { stage_time / s.static_data.stage_data[stage_index] .base_swing_duration - .as_secs_f64() + .as_secs_f32() }, StageSection::Recover => { stage_time / s.static_data.stage_data[stage_index] .base_recover_duration - .as_secs_f64() + .as_secs_f32() }, _ => 0.0, }; @@ -3803,16 +3803,16 @@ impl FigureMgr { ) }, CharacterState::Shockwave(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -3826,16 +3826,16 @@ impl FigureMgr { }, CharacterState::SpinMelee(s) => { let stage_progress = { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f64() + stage_time / s.static_data.swing_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, } @@ -3923,14 +3923,14 @@ impl FigureMgr { let target_bones = match &character { CharacterState::BasicRanged(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, @@ -3949,14 +3949,14 @@ impl FigureMgr { ) }, CharacterState::BasicBeam(s) => { - let stage_time = s.timer.as_secs_f64(); + let stage_time = s.timer.as_secs_f32(); let stage_progress = match s.stage_section { StageSection::Buildup => { - stage_time / s.static_data.buildup_duration.as_secs_f64() + stage_time / s.static_data.buildup_duration.as_secs_f32() }, - StageSection::Cast => s.timer.as_secs_f64(), + StageSection::Cast => s.timer.as_secs_f32(), StageSection::Recover => { - stage_time / s.static_data.recover_duration.as_secs_f64() + stage_time / s.static_data.recover_duration.as_secs_f32() }, _ => 0.0, }; @@ -4594,7 +4594,7 @@ pub struct FigureStateMeta { bone_consts: Consts, locals: Consts, lantern_offset: anim::vek::Vec3, - state_time: f64, + state_time: f32, last_ori: anim::vek::Quaternion, lpindex: u8, can_shadow_sun: bool, @@ -4702,7 +4702,7 @@ impl FigureState { self.last_ori = vek::Lerp::lerp(self.last_ori, ori, 15.0 * dt).normalized(); - self.state_time += (dt * state_animation_rate) as f64; + self.state_time += dt * state_animation_rate; let mat = { anim::vek::Mat4::from(ori) diff --git a/voxygen/src/scene/simple.rs b/voxygen/src/scene/simple.rs index 6dad94e70b..2502c6c176 100644 --- a/voxygen/src/scene/simple.rs +++ b/voxygen/src/scene/simple.rs @@ -332,8 +332,13 @@ impl Scene { if let Some(body) = scene_data.body { let tgt_skeleton = IdleAnimation::update_skeleton( self.figure_state.skeleton_mut(), - (active_tool_kind, second_tool_kind, hands, scene_data.time), - scene_data.time, + ( + active_tool_kind, + second_tool_kind, + hands, + scene_data.time as f32, + ), + scene_data.time as f32, &mut 0.0, &SkeletonAttr::from(&body), );