mirror of
https://gitlab.com/veloren/veloren.git
synced 2025-07-26 05:12:29 +00:00
Add AnimationEvent to every animation
This commit is contained in:
@ -1,76 +0,0 @@
|
||||
pub mod biped_large;
|
||||
pub mod bird_medium;
|
||||
pub mod bird_small;
|
||||
pub mod character;
|
||||
pub mod critter;
|
||||
pub mod dragon;
|
||||
pub mod fish_medium;
|
||||
pub mod fish_small;
|
||||
pub mod fixture;
|
||||
pub mod golem;
|
||||
pub mod object;
|
||||
pub mod quadruped_medium;
|
||||
pub mod quadruped_small;
|
||||
pub mod quadruped_low;
|
||||
|
||||
use crate::render::FigureBoneData;
|
||||
use vek::*;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Bone {
|
||||
pub offset: Vec3<f32>,
|
||||
pub ori: Quaternion<f32>,
|
||||
pub scale: Vec3<f32>,
|
||||
}
|
||||
|
||||
impl Default for Bone {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
offset: Vec3::zero(),
|
||||
ori: Quaternion::identity(),
|
||||
scale: Vec3::broadcast(1.0 / 11.0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Bone {
|
||||
pub fn compute_base_matrix(&self) -> Mat4<f32> {
|
||||
Mat4::<f32>::translation_3d(self.offset)
|
||||
* Mat4::scaling_3d(self.scale)
|
||||
* Mat4::from(self.ori)
|
||||
}
|
||||
|
||||
/// Change the current bone to be more like `target`.
|
||||
fn interpolate(&mut self, target: &Bone, dt: f32) {
|
||||
// TODO: Make configurable.
|
||||
let factor = (15.0 * dt).min(1.0);
|
||||
self.offset += (target.offset - self.offset) * factor;
|
||||
self.ori = vek::Slerp::slerp(self.ori, target.ori, factor);
|
||||
self.scale += (target.scale - self.scale) * factor;
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Skeleton: Send + Sync + 'static {
|
||||
type Attr;
|
||||
|
||||
fn bone_count(&self) -> usize { 16 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>);
|
||||
|
||||
/// Change the current skeleton to be more like `target`.
|
||||
fn interpolate(&mut self, target: &Self, dt: f32);
|
||||
}
|
||||
|
||||
pub trait Animation {
|
||||
type Skeleton: Skeleton;
|
||||
type Dependency;
|
||||
|
||||
/// Returns a new skeleton that is generated by the animation.
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
dependency: Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &<<Self as Animation>::Skeleton as Skeleton>::Attr,
|
||||
) -> Self::Skeleton;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, BipedLargeSkeleton, SkeletonAttr};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for IdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 1.0;
|
||||
@ -128,6 +129,6 @@ impl Animation for IdleAnimation {
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one();
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, BipedLargeSkeleton, SkeletonAttr};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for JumpAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
|
||||
@ -108,6 +109,6 @@ impl Animation for JumpAnimation {
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one();
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, BipedLargeSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 10.0;
|
||||
@ -138,6 +139,6 @@ impl Animation for RunAnimation {
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, beltsnap * 0.25);
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.13);
|
||||
next.torso.scale = Vec3::one();
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, BirdMediumSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct FlyAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for FlyAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 12.0; //14.0
|
||||
@ -83,6 +84,6 @@ impl Animation for FlyAnimation {
|
||||
) / 11.0;
|
||||
next.leg_r.ori = Quaternion::rotation_x(-1.3 + footr * 0.06);
|
||||
next.leg_r.scale = Vec3::one() / 11.0;
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, BirdMediumSkeleton, SkeletonAttr};
|
||||
use std::ops::Mul;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for IdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave_slow = (anim_time as f32 * 4.5).sin();
|
||||
@ -86,6 +87,6 @@ impl Animation for IdleAnimation {
|
||||
) / 11.0;
|
||||
next.leg_r.ori = Quaternion::rotation_x(0.0);
|
||||
next.leg_r.scale = Vec3::one() / 11.0;
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, BirdMediumSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 16.0; //14.0
|
||||
@ -83,6 +84,6 @@ impl Animation for RunAnimation {
|
||||
) / 11.0;
|
||||
next.leg_r.ori = Quaternion::rotation_x(footr * 0.5);
|
||||
next.leg_r.scale = Vec3::one() / 11.0;
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, BirdSmallSkeleton, SkeletonAttr};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for IdleAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
@ -37,6 +38,6 @@ impl Animation for IdleAnimation {
|
||||
next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, BirdSmallSkeleton, SkeletonAttr};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for JumpAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
@ -37,6 +38,6 @@ impl Animation for JumpAnimation {
|
||||
next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, BirdSmallSkeleton, SkeletonAttr};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
@ -37,6 +38,6 @@ impl Animation for RunAnimation {
|
||||
next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.wing_r.scale = Vec3::one() / 10.88;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct AlphaAnimation;
|
||||
|
||||
@ -20,7 +21,7 @@ impl Animation for AlphaAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
@ -508,6 +509,6 @@ impl Animation for AlphaAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct BetaAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for BetaAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
@ -143,6 +144,6 @@ impl Animation for BetaAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
@ -22,7 +23,7 @@ impl Animation for BlockAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin();
|
||||
@ -218,6 +219,6 @@ impl Animation for BlockAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
@ -22,7 +23,7 @@ impl Animation for BlockIdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin();
|
||||
@ -347,6 +348,6 @@ impl Animation for BlockIdleAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct ChargeAnimation;
|
||||
|
||||
@ -28,7 +29,7 @@ impl Animation for ChargeAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
|
||||
let mut next = (*skeleton).clone();
|
||||
@ -233,6 +234,6 @@ impl Animation for ChargeAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct ClimbAnimation;
|
||||
|
||||
@ -25,7 +26,7 @@ impl Animation for ClimbAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let speed = velocity.magnitude();
|
||||
@ -195,6 +196,6 @@ impl Animation for ClimbAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct DanceAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for DanceAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
*rate = 1.0;
|
||||
@ -198,6 +199,6 @@ impl Animation for DanceAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
@ -22,7 +23,7 @@ impl Animation for DashAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
let lab = 1.0;
|
||||
@ -202,6 +203,6 @@ impl Animation for DashAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use vek::*;
|
||||
|
||||
@ -21,7 +22,7 @@ impl Animation for EquipAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
let lab = 1.0;
|
||||
@ -238,6 +239,6 @@ impl Animation for EquipAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct GlideWieldAnimation;
|
||||
|
||||
@ -29,7 +30,7 @@ impl Animation for GlideWieldAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
*rate = 1.0;
|
||||
@ -379,6 +380,6 @@ impl Animation for GlideWieldAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct GlidingAnimation;
|
||||
|
||||
@ -29,7 +30,7 @@ impl Animation for GlidingAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
@ -178,6 +179,6 @@ impl Animation for GlidingAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for IdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave_ultra_slow = (anim_time as f32 * 1.0).sin();
|
||||
@ -177,6 +178,6 @@ impl Animation for IdleAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
impl Animation for JumpAnimation {
|
||||
@ -25,7 +26,7 @@ impl Animation for JumpAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
let slow = (anim_time as f32 * 7.0).sin();
|
||||
|
||||
@ -220,6 +221,6 @@ impl Animation for JumpAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
/* use std::f32::consts::PI; */
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct LeapAnimation;
|
||||
|
||||
@ -20,7 +21,7 @@ impl Animation for LeapAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
@ -113,6 +114,6 @@ impl Animation for LeapAnimation {
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RollAnimation;
|
||||
|
||||
@ -26,7 +27,7 @@ impl Animation for RollAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
@ -190,6 +191,6 @@ impl Animation for RollAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -30,7 +31,7 @@ impl Animation for RunAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
@ -265,6 +266,6 @@ impl Animation for RunAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct ShootAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for ShootAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
|
||||
let mut next = (*skeleton).clone();
|
||||
@ -193,6 +194,6 @@ impl Animation for ShootAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct SitAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for SitAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let slow = (anim_time as f32 * 1.0).sin();
|
||||
@ -182,6 +183,6 @@ impl Animation for SitAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
@ -23,7 +24,7 @@ impl Animation for SpinAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
@ -138,6 +139,6 @@ impl Animation for SpinAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct SpinMeleeAnimation;
|
||||
|
||||
@ -20,7 +21,7 @@ impl Animation for SpinMeleeAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
let lab = 1.0;
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
@ -165,6 +166,6 @@ impl Animation for SpinMeleeAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct StandAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for StandAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let slow = (anim_time as f32 * 1.0).sin();
|
||||
@ -188,6 +189,6 @@ impl Animation for StandAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct SwimAnimation;
|
||||
|
||||
@ -29,7 +30,7 @@ impl Animation for SwimAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
@ -213,6 +214,6 @@ impl Animation for SwimAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct WieldAnimation;
|
||||
|
||||
@ -20,7 +21,7 @@ impl Animation for WieldAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
*rate = 1.0;
|
||||
let lab = 1.0;
|
||||
|
||||
@ -387,6 +388,6 @@ impl Animation for WieldAnimation {
|
||||
(_, _) => Vec3::zero(),
|
||||
};
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CritterAttr, CritterSkeleton};
|
||||
use super::{super::{Animation, AnimationEventItem}, CritterAttr, CritterSkeleton};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for IdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &CritterAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave = (anim_time as f32 * 10.0).sin();
|
||||
@ -63,6 +64,6 @@ impl Animation for IdleAnimation {
|
||||
next.tail.ori = Quaternion::rotation_y(wave_slow * 0.05);
|
||||
next.tail.scale = Vec3::one() / 18.0;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, CritterAttr, CritterSkeleton};
|
||||
use super::{super::{Animation, AnimationEventItem}, CritterAttr, CritterSkeleton};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for JumpAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &CritterAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) / 18.0;
|
||||
@ -41,6 +42,6 @@ impl Animation for JumpAnimation {
|
||||
next.tail.ori = Quaternion::rotation_y(0.0);
|
||||
next.tail.scale = Vec3::one() / 18.0;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
use super::{super::Animation, CritterAttr, CritterSkeleton};
|
||||
use super::{super::{Animation, AnimationEventItem}, CritterAttr, CritterSkeleton};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for RunAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &CritterAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave = (anim_time as f32 * 13.0).sin();
|
||||
@ -51,6 +52,6 @@ impl Animation for RunAnimation {
|
||||
next.tail.ori = Quaternion::rotation_y(wave_slow * 0.08);
|
||||
next.tail.scale = Vec3::one() / 18.0;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, DragonSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct FlyAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for FlyAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 12.0;
|
||||
@ -155,6 +156,6 @@ impl Animation for FlyAnimation {
|
||||
next.wing_out_r.ori = Quaternion::rotation_y((-0.35 + wingr * 0.6).min(-0.2));
|
||||
next.wing_out_r.scale = Vec3::one();
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, DragonSkeleton, SkeletonAttr};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for IdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let ultra_slow = (anim_time as f32 * 1.0).sin();
|
||||
@ -147,6 +148,6 @@ impl Animation for IdleAnimation {
|
||||
next.foot_br.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_br.scale = Vec3::one();
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, DragonSkeleton, SkeletonAttr};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 14;
|
||||
@ -167,6 +168,6 @@ impl Animation for RunAnimation {
|
||||
next.wing_out_r.ori = Quaternion::rotation_y(2.0);
|
||||
next.wing_out_r.scale = Vec3::one();
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, FishMediumSkeleton, SkeletonAttr};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for IdleAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
@ -44,6 +45,6 @@ impl Animation for IdleAnimation {
|
||||
next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
||||
next.fin_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.fin_r.scale = Vec3::one() / 10.5;
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, FishMediumSkeleton, SkeletonAttr};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for JumpAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
@ -44,6 +45,6 @@ impl Animation for JumpAnimation {
|
||||
next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
||||
next.fin_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.fin_r.scale = Vec3::one() / 10.5;
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, FishMediumSkeleton, SkeletonAttr};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
@ -44,6 +45,6 @@ impl Animation for RunAnimation {
|
||||
next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
||||
next.fin_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.fin_r.scale = Vec3::one() / 10.5;
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, FishSmallSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, FishSmallSkeleton, SkeletonAttr};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for IdleAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
@ -29,6 +30,6 @@ impl Animation for IdleAnimation {
|
||||
next.tail.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one() * 1.01;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, FishSmallSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, FishSmallSkeleton, SkeletonAttr};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for JumpAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
@ -29,6 +30,6 @@ impl Animation for JumpAnimation {
|
||||
next.tail.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one() * 1.01;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, FishSmallSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, FishSmallSkeleton, SkeletonAttr};
|
||||
//use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
||||
@ -29,6 +30,6 @@ impl Animation for RunAnimation {
|
||||
next.tail.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one() * 1.01;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, GolemSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, GolemSkeleton, SkeletonAttr};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for IdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 1.0;
|
||||
@ -121,6 +122,6 @@ impl Animation for IdleAnimation {
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one();
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, GolemSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, GolemSkeleton, SkeletonAttr};
|
||||
//use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for JumpAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
|
||||
@ -101,6 +102,6 @@ impl Animation for JumpAnimation {
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one();
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, GolemSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, GolemSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -19,7 +20,7 @@ impl Animation for RunAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 10.0;
|
||||
@ -126,6 +127,6 @@ impl Animation for RunAnimation {
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, belt * 0.15);
|
||||
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.2);
|
||||
next.torso.scale = Vec3::one();
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ pub mod bird_small;
|
||||
pub mod character;
|
||||
pub mod critter;
|
||||
pub mod dragon;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")] pub mod dyn_lib;
|
||||
pub mod fish_medium;
|
||||
pub mod fish_small;
|
||||
@ -23,6 +24,7 @@ pub use dyn_lib::init;
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
use std::ffi::CStr;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
// TODO: replace with inner type everywhere
|
||||
pub struct FigureBoneData(pub Mat4<f32>);
|
||||
@ -106,6 +108,21 @@ pub trait Skeleton: Send + Sync + 'static {
|
||||
fn interpolate(&mut self, target: &Self, dt: f32);
|
||||
}
|
||||
|
||||
pub enum AnimationEvent {
|
||||
Step,
|
||||
}
|
||||
|
||||
pub struct AnimationEventItem {
|
||||
pub event: AnimationEvent,
|
||||
pub pos: Vec3<f32>,
|
||||
}
|
||||
|
||||
impl AnimationEventItem {
|
||||
pub fn new(event: AnimationEvent, pos: Vec3<f32>) -> Self {
|
||||
Self { event, pos }
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Animation {
|
||||
type Skeleton: Skeleton;
|
||||
type Dependency;
|
||||
@ -120,7 +137,7 @@ pub trait Animation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &<<Self as Animation>::Skeleton as Skeleton>::Attr,
|
||||
) -> Self::Skeleton;
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>);
|
||||
|
||||
/// Calls `update_skeleton_inner` either directly or via `libloading` to
|
||||
/// generate the new skeleton.
|
||||
@ -130,7 +147,7 @@ pub trait Animation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &<<Self as Animation>::Skeleton as Skeleton>::Attr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
#[cfg(not(feature = "use-dyn-lib"))]
|
||||
{
|
||||
Self::update_skeleton_inner(skeleton, dependency, anim_time, rate, skeleton_attr)
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedLowSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct AlphaAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for AlphaAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let short = (((1.0)
|
||||
@ -96,6 +97,6 @@ impl Animation for AlphaAnimation {
|
||||
next.foot_br.ori = Quaternion::rotation_y(short * 0.12);
|
||||
next.foot_br.scale = Vec3::one();
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedLowSkeleton, SkeletonAttr};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for IdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let slower = (anim_time as f32 * 1.25).sin();
|
||||
@ -108,6 +109,6 @@ impl Animation for IdleAnimation {
|
||||
next.foot_br.ori = Quaternion::rotation_y(slow * -0.05);
|
||||
next.foot_br.scale = Vec3::one();
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedLowSkeleton, SkeletonAttr};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
@ -17,7 +18,7 @@ impl Animation for JumpAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head_upper.offset =
|
||||
@ -82,6 +83,6 @@ impl Animation for JumpAnimation {
|
||||
next.foot_br.ori = Quaternion::rotation_y(0.0);
|
||||
next.foot_br.scale = Vec3::one();
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedLowSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 0.7 * skeleton_attr.tempo;
|
||||
@ -171,6 +172,6 @@ impl Animation for RunAnimation {
|
||||
* Quaternion::rotation_z(foothorirb * -0.4 + tilt * -2.0);
|
||||
next.foot_br.scale = Vec3::one();
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedMediumSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct AlphaAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for AlphaAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let short = (((1.0)
|
||||
@ -140,6 +141,6 @@ impl Animation for AlphaAnimation {
|
||||
next.foot_br.ori =
|
||||
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
|
||||
next.foot_br.scale = Vec3::one();
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedMediumSkeleton, SkeletonAttr};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for IdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let slower = (anim_time as f32 * 1.0 + PI).sin();
|
||||
@ -166,6 +167,6 @@ impl Animation for IdleAnimation {
|
||||
next.foot_br.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_br.scale = Vec3::one() * 0.94;
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedMediumSkeleton, SkeletonAttr};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
@ -17,7 +18,7 @@ impl Animation for JumpAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head_upper.offset =
|
||||
@ -122,6 +123,6 @@ impl Animation for JumpAnimation {
|
||||
next.foot_br.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_br.scale = Vec3::one();
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedMediumSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
*rate = 1.0;
|
||||
@ -317,6 +318,6 @@ impl Animation for RunAnimation {
|
||||
* Quaternion::rotation_y(tilt * -1.0);
|
||||
next.foot_br.scale = Vec3::one() * 0.96;
|
||||
}
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedSmallSkeleton, SkeletonAttr};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for IdleAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let slow = (anim_time as f32 * 3.5).sin();
|
||||
@ -89,6 +90,6 @@ impl Animation for IdleAnimation {
|
||||
next.tail.ori = Quaternion::rotation_z(slow * 0.4);
|
||||
next.tail.scale = Vec3::one();
|
||||
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedSmallSkeleton, SkeletonAttr};
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
|
||||
@ -17,7 +18,7 @@ impl Animation for JumpAnimation {
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) / 11.0;
|
||||
@ -63,6 +64,6 @@ impl Animation for JumpAnimation {
|
||||
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
|
||||
next.tail.ori = Quaternion::rotation_x(-0.3);
|
||||
next.tail.scale = Vec3::one();
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr};
|
||||
use super::{super::{Animation, AnimationEventItem}, QuadrupedSmallSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub struct RunAnimation;
|
||||
|
||||
@ -18,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
) -> (Self::Skeleton, VecDeque<AnimationEventItem>) {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let slow = (anim_time as f32 * 14.0).sin();
|
||||
@ -76,6 +77,6 @@ impl Animation for RunAnimation {
|
||||
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
|
||||
next.tail.ori = Quaternion::rotation_z(0.0);
|
||||
next.tail.scale = Vec3::one();
|
||||
next
|
||||
(next, VecDeque::new())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user