purged references to npckind from anim files, removed warnings

This commit is contained in:
jshipsey 2019-10-25 19:18:34 -04:00
parent 2b5fd372c5
commit c5942dfcc9
29 changed files with 755 additions and 1025 deletions

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
BipedLargeSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -13,74 +13,56 @@ impl Animation for IdleAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let duck_m_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 10.88;
next.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_head.scale = Vec3::one() / 10.88;
next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one() / 10.88;
next.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_upper_torso.scale = Vec3::one() / 10.88;
next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one() / 10.88;
next.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_lower_torso.scale = Vec3::one() / 10.88;
next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one() / 10.88;
next.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_shoulder_l.scale = Vec3::one() / 10.88;
next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() / 10.88;
next.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_shoulder_r.scale = Vec3::one() / 10.88;
next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() / 10.88;
next.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_hand_l.scale = Vec3::one() / 10.88;
next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() / 10.88;
next.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_hand_r.scale = Vec3::one() / 10.88;
next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() / 10.88;
next.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_leg_l.scale = Vec3::one() / 10.88;
next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one() / 10.88;
next.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_leg_r.scale = Vec3::one() / 10.88;
next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_foot_l.scale = Vec3::one() / 10.88;
next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_foot_r.scale = Vec3::one() / 10.88;
next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one() / 10.88;
next
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
BipedLargeSkeleton,
};
use std::f32::consts::PI;
//use std::f32::consts::PI;
use vek::*;
pub struct JumpAnimation;
@ -14,60 +14,55 @@ impl Animation for JumpAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
anim_time: f64,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_head.scale = Vec3::one() / 10.88;
next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 10.88;
next.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_upper_torso.scale = Vec3::one() / 10.88;
next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one() / 10.88;
next.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_lower_torso.scale = Vec3::one() / 10.88;
next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one() / 10.88;
next.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_shoulder_l.scale = Vec3::one() / 10.88;
next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one() / 10.88;
next.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_shoulder_r.scale = Vec3::one() / 10.88;
next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() / 10.88;
next.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_hand_l.scale = Vec3::one() / 10.88;
next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() / 10.88;
next.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_hand_r.scale = Vec3::one() / 10.88;
next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() / 10.88;
next.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_leg_l.scale = Vec3::one() / 10.88;
next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() / 10.88;
next.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_leg_r.scale = Vec3::one() / 10.88;
next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one() / 10.88;
next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_foot_l.scale = Vec3::one() / 10.88;
next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_foot_r.scale = Vec3::one() / 10.88;
next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one() / 10.88;
next
}
}

View File

@ -12,61 +12,61 @@ use crate::render::FigureBoneData;
#[derive(Clone)]
pub struct BipedLargeSkeleton {
knight_head: Bone,
knight_upper_torso: Bone,
knight_lower_torso: Bone,
knight_shoulder_l: Bone,
knight_shoulder_r: Bone,
knight_hand_l: Bone,
knight_hand_r: Bone,
knight_leg_l: Bone,
knight_leg_r: Bone,
knight_foot_l: Bone,
knight_foot_r: Bone,
head: Bone,
upper_torso: Bone,
lower_torso: Bone,
shoulder_l: Bone,
shoulder_r: Bone,
hand_l: Bone,
hand_r: Bone,
leg_l: Bone,
leg_r: Bone,
foot_l: Bone,
foot_r: Bone,
}
impl BipedLargeSkeleton {
pub fn new() -> Self {
Self {
knight_head: Bone::default(),
knight_upper_torso: Bone::default(),
knight_lower_torso: Bone::default(),
knight_shoulder_l: Bone::default(),
knight_shoulder_r: Bone::default(),
knight_hand_l: Bone::default(),
knight_hand_r: Bone::default(),
knight_leg_l: Bone::default(),
knight_leg_r: Bone::default(),
knight_foot_l: Bone::default(),
knight_foot_r: Bone::default(),
head: Bone::default(),
upper_torso: Bone::default(),
lower_torso: Bone::default(),
shoulder_l: Bone::default(),
shoulder_r: Bone::default(),
hand_l: Bone::default(),
hand_r: Bone::default(),
leg_l: Bone::default(),
leg_r: Bone::default(),
foot_l: Bone::default(),
foot_r: Bone::default(),
}
}
}
impl Skeleton for BipedLargeSkeleton {
fn compute_matrices(&self) -> [FigureBoneData; 16] {
let upper_torso_mat = self.knight_upper_torso.compute_base_matrix();
let shoulder_l_mat = self.knight_shoulder_l.compute_base_matrix();
let shoulder_r_mat = self.knight_shoulder_r.compute_base_matrix();
let leg_l_mat = self.knight_leg_l.compute_base_matrix();
let leg_r_mat = self.knight_leg_r.compute_base_matrix();
let upper_torso_mat = self.upper_torso.compute_base_matrix();
let shoulder_l_mat = self.shoulder_l.compute_base_matrix();
let shoulder_r_mat = self.shoulder_r.compute_base_matrix();
let leg_l_mat = self.leg_l.compute_base_matrix();
let leg_r_mat = self.leg_r.compute_base_matrix();
[
FigureBoneData::new(self.knight_head.compute_base_matrix()),
FigureBoneData::new(self.head.compute_base_matrix()),
FigureBoneData::new(upper_torso_mat),
FigureBoneData::new(self.knight_lower_torso.compute_base_matrix() * upper_torso_mat),
FigureBoneData::new(self.lower_torso.compute_base_matrix() * upper_torso_mat),
FigureBoneData::new(shoulder_l_mat * upper_torso_mat),
FigureBoneData::new(shoulder_r_mat * upper_torso_mat),
FigureBoneData::new(
self.knight_hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat,
self.hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat,
),
FigureBoneData::new(
self.knight_hand_r.compute_base_matrix() * shoulder_r_mat * upper_torso_mat,
self.hand_r.compute_base_matrix() * shoulder_r_mat * upper_torso_mat,
),
FigureBoneData::new(leg_l_mat),
FigureBoneData::new(leg_r_mat),
FigureBoneData::new(self.knight_foot_l.compute_base_matrix() * leg_l_mat),
FigureBoneData::new(self.knight_foot_r.compute_base_matrix() * leg_r_mat),
FigureBoneData::new(self.foot_l.compute_base_matrix() * leg_l_mat),
FigureBoneData::new(self.foot_r.compute_base_matrix() * leg_r_mat),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
@ -76,20 +76,16 @@ impl Skeleton for BipedLargeSkeleton {
}
fn interpolate(&mut self, target: &Self, dt: f32) {
self.knight_head.interpolate(&target.knight_head, dt);
self.knight_upper_torso
.interpolate(&target.knight_upper_torso, dt);
self.knight_lower_torso
.interpolate(&target.knight_lower_torso, dt);
self.knight_shoulder_l
.interpolate(&target.knight_shoulder_l, dt);
self.knight_shoulder_r
.interpolate(&target.knight_shoulder_r, dt);
self.knight_hand_l.interpolate(&target.knight_hand_l, dt);
self.knight_hand_r.interpolate(&target.knight_hand_r, dt);
self.knight_leg_l.interpolate(&target.knight_leg_l, dt);
self.knight_leg_r.interpolate(&target.knight_leg_r, dt);
self.knight_foot_l.interpolate(&target.knight_foot_l, dt);
self.knight_foot_r.interpolate(&target.knight_foot_r, dt);
self.head.interpolate(&target.head, dt);
self.upper_torso.interpolate(&target.upper_torso, dt);
self.lower_torso.interpolate(&target.lower_torso, dt);
self.shoulder_l.interpolate(&target.shoulder_l, dt);
self.shoulder_r.interpolate(&target.shoulder_r, dt);
self.hand_l.interpolate(&target.hand_l, dt);
self.hand_r.interpolate(&target.hand_r, dt);
self.leg_l.interpolate(&target.leg_l, dt);
self.leg_r.interpolate(&target.leg_r, dt);
self.foot_l.interpolate(&target.foot_l, dt);
self.foot_r.interpolate(&target.foot_r, dt);
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
BipedLargeSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct RunAnimation;
@ -13,74 +13,56 @@ impl Animation for RunAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
(_velocity, global_time): Self::Dependency,
anim_time: f64,
(_velocity, _global_time): Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let duck_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 10.88;
next.knight_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_head.scale = Vec3::one() / 10.88;
next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one() / 10.88;
next.knight_upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_upper_torso.scale = Vec3::one() / 10.88;
next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one() / 10.88;
next.knight_lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_lower_torso.scale = Vec3::one() / 10.88;
next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one() / 10.88;
next.knight_shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_shoulder_l.scale = Vec3::one() / 10.88;
next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() / 10.88;
next.knight_shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_shoulder_r.scale = Vec3::one() / 10.88;
next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() / 10.88;
next.knight_hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_hand_l.scale = Vec3::one() / 10.88;
next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() / 10.88;
next.knight_hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_hand_r.scale = Vec3::one() / 10.88;
next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() / 10.88;
next.knight_leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_leg_l.scale = Vec3::one() / 10.88;
next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one() / 10.88;
next.knight_leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_leg_r.scale = Vec3::one() / 10.88;
next.knight_foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_foot_l.scale = Vec3::one() / 10.88;
next.knight_foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.knight_foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.knight_foot_r.scale = Vec3::one() / 10.88;
next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one() / 10.88;
next
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
BirdMediumSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -13,59 +13,40 @@ impl Animation for IdleAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let duck_m_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() * 1.01;
next.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.duck_m_head.ori =
Quaternion::rotation_z(duck_m_look.x) * Quaternion::rotation_x(duck_m_look.y);
next.duck_m_head.scale = Vec3::one() / 10.88;
next.tail.offset = Vec3::new(0.0, 3.1, -4.5);
next.tail.ori = Quaternion::rotation_z(0.0);
next.tail.scale = Vec3::one() * 0.98;
next.duck_m_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.duck_m_torso.ori = Quaternion::rotation_x(0.0);
next.duck_m_torso.scale = Vec3::one() * 1.01;
next.wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_l.scale = Vec3::one() / 11.0;
next.duck_m_tail.offset = Vec3::new(0.0, 3.1, -4.5);
next.duck_m_tail.ori = Quaternion::rotation_z(0.0);
next.duck_m_tail.scale = Vec3::one() * 0.98;
next.wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.wing_r.ori = Quaternion::rotation_y(0.0);
next.wing_r.scale = Vec3::one() / 11.0;
next.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.duck_m_wing_l.scale = Vec3::one() / 11.0;
next.leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.leg_l.ori = Quaternion::rotation_y(0.0);
next.leg_l.scale = Vec3::one() / 10.5;
next.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.duck_m_wing_r.ori = Quaternion::rotation_y(0.0);
next.duck_m_wing_r.scale = Vec3::one() / 11.0;
next.duck_m_leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.duck_m_leg_l.ori = Quaternion::rotation_y(0.0);
next.duck_m_leg_l.scale = Vec3::one() / 10.5;
next.duck_m_leg_r.offset = Vec3::new(0.0, 0.75, 5.25);
next.duck_m_leg_r.ori = Quaternion::rotation_x(0.0);
next.duck_m_leg_r.scale = Vec3::one() * 1.00;
next.leg_r.offset = Vec3::new(0.0, 0.75, 5.25);
next.leg_r.ori = Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() * 1.00;
next
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
BirdMediumSkeleton,
};
use std::f32::consts::PI;
//use std::f32::consts::PI;
use vek::*;
pub struct JumpAnimation;
@ -14,44 +14,39 @@ impl Animation for JumpAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
anim_time: f64,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.duck_m_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.duck_m_head.scale = Vec3::one() / 10.88;
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() * 1.01;
next.duck_m_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.duck_m_torso.ori = Quaternion::rotation_x(0.0);
next.duck_m_torso.scale = Vec3::one() * 1.01;
next.tail.offset = Vec3::new(0.0, 3.1, -4.5);
next.tail.ori = Quaternion::rotation_z(0.0);
next.tail.scale = Vec3::one() * 0.98;
next.duck_m_tail.offset = Vec3::new(0.0, 3.1, -4.5);
next.duck_m_tail.ori = Quaternion::rotation_z(0.0);
next.duck_m_tail.scale = Vec3::one() * 0.98;
next.wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_l.scale = Vec3::one() / 11.0;
next.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.duck_m_wing_l.scale = Vec3::one() / 11.0;
next.wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.wing_r.ori = Quaternion::rotation_y(0.0);
next.wing_r.scale = Vec3::one() / 11.0;
next.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.duck_m_wing_r.ori = Quaternion::rotation_y(0.0);
next.duck_m_wing_r.scale = Vec3::one() / 11.0;
next.leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.leg_l.ori = Quaternion::rotation_y(0.0);
next.leg_l.scale = Vec3::one() / 10.5;
next.duck_m_leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.duck_m_leg_l.ori = Quaternion::rotation_y(0.0);
next.duck_m_leg_l.scale = Vec3::one() / 10.5;
next.duck_m_leg_r.offset = Vec3::new(0.0, 0.75, 5.25);
next.duck_m_leg_r.ori = Quaternion::rotation_x(0.0);
next.duck_m_leg_r.scale = Vec3::one() * 1.00;
next.leg_r.offset = Vec3::new(0.0, 0.75, 5.25);
next.leg_r.ori = Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() * 1.00;
next
}
}

View File

@ -12,41 +12,41 @@ use crate::render::FigureBoneData;
#[derive(Clone)]
pub struct BirdMediumSkeleton {
duck_m_head: Bone,
duck_m_torso: Bone,
duck_m_tail: Bone,
duck_m_wing_l: Bone,
duck_m_wing_r: Bone,
duck_m_leg_l: Bone,
duck_m_leg_r: Bone,
head: Bone,
torso: Bone,
tail: Bone,
wing_l: Bone,
wing_r: Bone,
leg_l: Bone,
leg_r: Bone,
}
impl BirdMediumSkeleton {
pub fn new() -> Self {
Self {
duck_m_head: Bone::default(),
duck_m_torso: Bone::default(),
duck_m_tail: Bone::default(),
duck_m_wing_l: Bone::default(),
duck_m_wing_r: Bone::default(),
duck_m_leg_l: Bone::default(),
duck_m_leg_r: Bone::default(),
head: Bone::default(),
torso: Bone::default(),
tail: Bone::default(),
wing_l: Bone::default(),
wing_r: Bone::default(),
leg_l: Bone::default(),
leg_r: Bone::default(),
}
}
}
impl Skeleton for BirdMediumSkeleton {
fn compute_matrices(&self) -> [FigureBoneData; 16] {
let torso_mat = self.duck_m_torso.compute_base_matrix();
let torso_mat = self.torso.compute_base_matrix();
[
FigureBoneData::new(self.duck_m_head.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.head.compute_base_matrix() * torso_mat),
FigureBoneData::new(torso_mat),
FigureBoneData::new(self.duck_m_tail.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.duck_m_wing_l.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.duck_m_wing_r.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.duck_m_leg_l.compute_base_matrix()),
FigureBoneData::new(self.duck_m_leg_r.compute_base_matrix()),
FigureBoneData::new(self.tail.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.wing_l.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.wing_r.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.leg_l.compute_base_matrix()),
FigureBoneData::new(self.leg_r.compute_base_matrix()),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
@ -60,12 +60,12 @@ impl Skeleton for BirdMediumSkeleton {
}
fn interpolate(&mut self, target: &Self, dt: f32) {
self.duck_m_head.interpolate(&target.duck_m_head, dt);
self.duck_m_torso.interpolate(&target.duck_m_torso, dt);
self.duck_m_tail.interpolate(&target.duck_m_tail, dt);
self.duck_m_wing_l.interpolate(&target.duck_m_wing_l, dt);
self.duck_m_wing_r.interpolate(&target.duck_m_wing_r, dt);
self.duck_m_leg_l.interpolate(&target.duck_m_leg_l, dt);
self.duck_m_leg_r.interpolate(&target.duck_m_leg_r, dt);
self.head.interpolate(&target.head, dt);
self.torso.interpolate(&target.torso, dt);
self.tail.interpolate(&target.tail, dt);
self.wing_l.interpolate(&target.wing_l, dt);
self.wing_r.interpolate(&target.wing_r, dt);
self.leg_l.interpolate(&target.leg_l, dt);
self.leg_r.interpolate(&target.leg_r, dt);
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
BirdMediumSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct RunAnimation;
@ -13,58 +13,40 @@ impl Animation for RunAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
(_velocity, global_time): Self::Dependency,
anim_time: f64,
(_velocity, _global_time): Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let duck_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() * 1.01;
next.duck_m_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.duck_m_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.duck_m_head.scale = Vec3::one() / 10.88;
next.tail.offset = Vec3::new(0.0, 3.1, -4.5);
next.tail.ori = Quaternion::rotation_z(0.0);
next.tail.scale = Vec3::one() * 0.98;
next.duck_m_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.duck_m_torso.ori = Quaternion::rotation_x(0.0);
next.duck_m_torso.scale = Vec3::one() * 1.01;
next.wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_l.scale = Vec3::one() / 11.0;
next.duck_m_tail.offset = Vec3::new(0.0, 3.1, -4.5);
next.duck_m_tail.ori = Quaternion::rotation_z(0.0);
next.duck_m_tail.scale = Vec3::one() * 0.98;
next.wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.wing_r.ori = Quaternion::rotation_y(0.0);
next.wing_r.scale = Vec3::one() / 11.0;
next.duck_m_wing_l.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.duck_m_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.duck_m_wing_l.scale = Vec3::one() / 11.0;
next.leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.leg_l.ori = Quaternion::rotation_y(0.0);
next.leg_l.scale = Vec3::one() / 10.5;
next.duck_m_wing_r.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.duck_m_wing_r.ori = Quaternion::rotation_y(0.0);
next.duck_m_wing_r.scale = Vec3::one() / 11.0;
next.duck_m_leg_l.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.duck_m_leg_l.ori = Quaternion::rotation_y(0.0);
next.duck_m_leg_l.scale = Vec3::one() / 10.5;
next.duck_m_leg_r.offset = Vec3::new(0.0, 0.75, 5.25);
next.duck_m_leg_r.ori = Quaternion::rotation_x(0.0);
next.duck_m_leg_r.scale = Vec3::one() * 1.00;
next.leg_r.offset = Vec3::new(0.0, 0.75, 5.25);
next.leg_r.ori = Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() * 1.00;
next
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
BirdSmallSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -13,46 +13,28 @@ impl Animation for IdleAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let duck_m_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 10.88;
next.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_head.scale = Vec3::one() / 10.88;
next.wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_l.scale = Vec3::one() / 10.88;
next.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_torso.scale = Vec3::one() / 10.88;
next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_wing_l.scale = Vec3::one() / 10.88;
next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_wing_r.scale = Vec3::one() / 10.88;
next.wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_r.scale = Vec3::one() / 10.88;
next
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
BirdSmallSkeleton,
};
use std::f32::consts::PI;
//use std::f32::consts::PI;
use vek::*;
pub struct JumpAnimation;
@ -14,32 +14,27 @@ impl Animation for JumpAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
anim_time: f64,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_head.scale = Vec3::one() / 10.88;
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 10.88;
next.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_torso.scale = Vec3::one() / 10.88;
next.wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_l.scale = Vec3::one() / 10.88;
next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_wing_l.scale = Vec3::one() / 10.88;
next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_wing_r.scale = Vec3::one() / 10.88;
next.wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_r.scale = Vec3::one() / 10.88;
next
}

View File

@ -12,32 +12,32 @@ use crate::render::FigureBoneData;
#[derive(Clone)]
pub struct BirdSmallSkeleton {
crow_head: Bone,
crow_torso: Bone,
crow_wing_l: Bone,
crow_wing_r: Bone,
head: Bone,
torso: Bone,
wing_l: Bone,
wing_r: Bone,
}
impl BirdSmallSkeleton {
pub fn new() -> Self {
Self {
crow_head: Bone::default(),
crow_torso: Bone::default(),
crow_wing_l: Bone::default(),
crow_wing_r: Bone::default(),
head: Bone::default(),
torso: Bone::default(),
wing_l: Bone::default(),
wing_r: Bone::default(),
}
}
}
impl Skeleton for BirdSmallSkeleton {
fn compute_matrices(&self) -> [FigureBoneData; 16] {
let torso_mat = self.crow_torso.compute_base_matrix();
let torso_mat = self.torso.compute_base_matrix();
[
FigureBoneData::new(self.crow_head.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.head.compute_base_matrix() * torso_mat),
FigureBoneData::new(torso_mat),
FigureBoneData::new(self.crow_wing_l.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.crow_wing_r.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.wing_l.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.wing_r.compute_base_matrix() * torso_mat),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
@ -54,9 +54,9 @@ impl Skeleton for BirdSmallSkeleton {
}
fn interpolate(&mut self, target: &Self, dt: f32) {
self.crow_head.interpolate(&target.crow_head, dt);
self.crow_torso.interpolate(&target.crow_torso, dt);
self.crow_wing_l.interpolate(&target.crow_wing_l, dt);
self.crow_wing_r.interpolate(&target.crow_wing_r, dt);
self.head.interpolate(&target.head, dt);
self.torso.interpolate(&target.torso, dt);
self.wing_l.interpolate(&target.wing_l, dt);
self.wing_r.interpolate(&target.wing_r, dt);
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
BirdSmallSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct RunAnimation;
@ -13,46 +13,28 @@ impl Animation for RunAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
(_velocity, global_time): Self::Dependency,
anim_time: f64,
(_velocity, _global_time): Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let duck_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 10.88;
next.crow_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_head.scale = Vec3::one() / 10.88;
next.wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_l.scale = Vec3::one() / 10.88;
next.crow_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_torso.scale = Vec3::one() / 10.88;
next.crow_wing_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_wing_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_wing_l.scale = Vec3::one() / 10.88;
next.crow_wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.crow_wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.crow_wing_r.scale = Vec3::one() / 10.88;
next.wing_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.wing_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.wing_r.scale = Vec3::one() / 10.88;
next
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
DragonSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -13,82 +13,64 @@ impl Animation for IdleAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let duck_m_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_front.ori = Quaternion::rotation_x(0.0);
next.chest_front.scale = Vec3::one() * 1.01;
next.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.dragon_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.dragon_head.scale = Vec3::one() / 10.88;
next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_rear.ori = Quaternion::rotation_x(0.0);
next.chest_rear.scale = Vec3::one() * 1.01;
next.dragon_chest_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_chest_front.ori = Quaternion::rotation_x(0.0);
next.dragon_chest_front.scale = Vec3::one() * 1.01;
next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_front.ori = Quaternion::rotation_x(0.0);
next.tail_front.scale = Vec3::one() * 1.01;
next.dragon_chest_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0);
next.dragon_chest_rear.scale = Vec3::one() * 1.01;
next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_rear.ori = Quaternion::rotation_x(0.0);
next.tail_rear.scale = Vec3::one() * 1.01;
next.dragon_tail_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_tail_front.ori = Quaternion::rotation_x(0.0);
next.dragon_tail_front.scale = Vec3::one() * 1.01;
next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_l.ori = Quaternion::rotation_x(0.0);
next.wing_in_l.scale = Vec3::one() * 1.01;
next.dragon_tail_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0);
next.dragon_tail_rear.scale = Vec3::one() * 1.01;
next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_r.ori = Quaternion::rotation_x(0.0);
next.wing_in_r.scale = Vec3::one() * 1.01;
next.dragon_wing_in_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_in_l.scale = Vec3::one() * 1.01;
next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_l.ori = Quaternion::rotation_x(0.0);
next.wing_out_l.scale = Vec3::one() * 1.01;
next.dragon_wing_in_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_in_r.scale = Vec3::one() * 1.01;
next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_r.ori = Quaternion::rotation_x(0.0);
next.wing_out_r.scale = Vec3::one() * 1.01;
next.dragon_wing_out_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_out_l.scale = Vec3::one() * 1.01;
next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fl.ori = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() * 1.01;
next.dragon_wing_out_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_out_r.scale = Vec3::one() * 1.01;
next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fr.ori = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() * 1.01;
next.dragon_foot_fl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_fl.scale = Vec3::one() * 1.01;
next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() * 1.01;
next.dragon_foot_fr.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_fr.scale = Vec3::one() * 1.01;
next.dragon_foot_bl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_bl.scale = Vec3::one() * 1.01;
next.dragon_foot_br.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_br.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_br.scale = Vec3::one() * 1.01;
next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() * 1.01;
next
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
DragonSkeleton,
};
use std::f32::consts::PI;
//use std::f32::consts::PI;
use vek::*;
pub struct JumpAnimation;
@ -14,68 +14,63 @@ impl Animation for JumpAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
anim_time: f64,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.dragon_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.dragon_head.scale = Vec3::one() / 10.88;
next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_front.ori = Quaternion::rotation_x(0.0);
next.chest_front.scale = Vec3::one() * 1.01;
next.dragon_chest_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_chest_front.ori = Quaternion::rotation_x(0.0);
next.dragon_chest_front.scale = Vec3::one() * 1.01;
next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_rear.ori = Quaternion::rotation_x(0.0);
next.chest_rear.scale = Vec3::one() * 1.01;
next.dragon_chest_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0);
next.dragon_chest_rear.scale = Vec3::one() * 1.01;
next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_front.ori = Quaternion::rotation_x(0.0);
next.tail_front.scale = Vec3::one() * 1.01;
next.dragon_tail_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_tail_front.ori = Quaternion::rotation_x(0.0);
next.dragon_tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_rear.ori = Quaternion::rotation_x(0.0);
next.tail_rear.scale = Vec3::one() * 1.01;
next.dragon_tail_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0);
next.dragon_tail_rear.scale = Vec3::one() * 1.01;
next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_l.ori = Quaternion::rotation_x(0.0);
next.wing_in_l.scale = Vec3::one() * 1.01;
next.dragon_wing_in_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_in_l.scale = Vec3::one() * 1.01;
next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_r.ori = Quaternion::rotation_x(0.0);
next.wing_in_r.scale = Vec3::one() * 1.01;
next.dragon_wing_in_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_in_r.scale = Vec3::one() * 1.01;
next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_l.ori = Quaternion::rotation_x(0.0);
next.wing_out_l.scale = Vec3::one() * 1.01;
next.dragon_wing_out_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_out_l.scale = Vec3::one() * 1.01;
next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_r.ori = Quaternion::rotation_x(0.0);
next.wing_out_r.scale = Vec3::one() * 1.01;
next.dragon_wing_out_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_out_r.scale = Vec3::one() * 1.01;
next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fl.ori = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() * 1.01;
next.dragon_foot_fl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_fl.scale = Vec3::one() * 1.01;
next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fr.ori = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() * 1.01;
next.dragon_foot_fr.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_fr.scale = Vec3::one() * 1.01;
next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() * 1.01;
next.dragon_foot_bl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_bl.scale = Vec3::one() * 1.01;
next.dragon_foot_br.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_br.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_br.scale = Vec3::one() * 1.01;
next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() * 1.01;
next
}
}

View File

@ -12,62 +12,62 @@ use crate::render::FigureBoneData;
#[derive(Clone)]
pub struct DragonSkeleton {
dragon_head: Bone,
dragon_chest_front: Bone,
dragon_chest_rear: Bone,
dragon_tail_front: Bone,
dragon_tail_rear: Bone,
dragon_wing_in_l: Bone,
dragon_wing_in_r: Bone,
dragon_wing_out_l: Bone,
dragon_wing_out_r: Bone,
dragon_foot_fl: Bone,
dragon_foot_fr: Bone,
dragon_foot_bl: Bone,
dragon_foot_br: Bone,
head: Bone,
chest_front: Bone,
chest_rear: Bone,
tail_front: Bone,
tail_rear: Bone,
wing_in_l: Bone,
wing_in_r: Bone,
wing_out_l: Bone,
wing_out_r: Bone,
foot_fl: Bone,
foot_fr: Bone,
foot_bl: Bone,
foot_br: Bone,
}
impl DragonSkeleton {
pub fn new() -> Self {
Self {
dragon_head: Bone::default(),
dragon_chest_front: Bone::default(),
dragon_chest_rear: Bone::default(),
dragon_tail_front: Bone::default(),
dragon_tail_rear: Bone::default(),
dragon_wing_in_l: Bone::default(),
dragon_wing_in_r: Bone::default(),
dragon_wing_out_l: Bone::default(),
dragon_wing_out_r: Bone::default(),
dragon_foot_fl: Bone::default(),
dragon_foot_fr: Bone::default(),
dragon_foot_bl: Bone::default(),
dragon_foot_br: Bone::default(),
head: Bone::default(),
chest_front: Bone::default(),
chest_rear: Bone::default(),
tail_front: Bone::default(),
tail_rear: Bone::default(),
wing_in_l: Bone::default(),
wing_in_r: Bone::default(),
wing_out_l: Bone::default(),
wing_out_r: Bone::default(),
foot_fl: Bone::default(),
foot_fr: Bone::default(),
foot_bl: Bone::default(),
foot_br: Bone::default(),
}
}
}
impl Skeleton for DragonSkeleton {
fn compute_matrices(&self) -> [FigureBoneData; 16] {
let chest_front_mat = self.dragon_chest_front.compute_base_matrix();
let wing_in_l_mat = self.dragon_wing_in_l.compute_base_matrix();
let wing_in_r_mat = self.dragon_wing_in_r.compute_base_matrix();
let tail_front_mat = self.dragon_tail_front.compute_base_matrix();
let chest_front_mat = self.chest_front.compute_base_matrix();
let wing_in_l_mat = self.wing_in_l.compute_base_matrix();
let wing_in_r_mat = self.wing_in_r.compute_base_matrix();
let tail_front_mat = self.tail_front.compute_base_matrix();
[
FigureBoneData::new(self.dragon_head.compute_base_matrix() * chest_front_mat),
FigureBoneData::new(self.head.compute_base_matrix() * chest_front_mat),
FigureBoneData::new(chest_front_mat),
FigureBoneData::new(self.dragon_chest_rear.compute_base_matrix() * chest_front_mat),
FigureBoneData::new(self.chest_rear.compute_base_matrix() * chest_front_mat),
FigureBoneData::new(tail_front_mat),
FigureBoneData::new(self.dragon_tail_rear.compute_base_matrix() * tail_front_mat),
FigureBoneData::new(self.tail_rear.compute_base_matrix() * tail_front_mat),
FigureBoneData::new(wing_in_l_mat),
FigureBoneData::new(wing_in_r_mat),
FigureBoneData::new(self.dragon_wing_out_l.compute_base_matrix() * wing_in_l_mat),
FigureBoneData::new(self.dragon_wing_out_r.compute_base_matrix() * wing_in_r_mat),
FigureBoneData::new(self.dragon_foot_fl.compute_base_matrix()),
FigureBoneData::new(self.dragon_foot_fr.compute_base_matrix()),
FigureBoneData::new(self.dragon_foot_bl.compute_base_matrix()),
FigureBoneData::new(self.dragon_foot_br.compute_base_matrix()),
FigureBoneData::new(self.wing_out_l.compute_base_matrix() * wing_in_l_mat),
FigureBoneData::new(self.wing_out_r.compute_base_matrix() * wing_in_r_mat),
FigureBoneData::new(self.foot_fl.compute_base_matrix()),
FigureBoneData::new(self.foot_fr.compute_base_matrix()),
FigureBoneData::new(self.foot_bl.compute_base_matrix()),
FigureBoneData::new(self.foot_br.compute_base_matrix()),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
@ -75,26 +75,18 @@ impl Skeleton for DragonSkeleton {
}
fn interpolate(&mut self, target: &Self, dt: f32) {
self.dragon_head.interpolate(&target.dragon_head, dt);
self.dragon_chest_front
.interpolate(&target.dragon_chest_front, dt);
self.dragon_chest_rear
.interpolate(&target.dragon_chest_rear, dt);
self.dragon_tail_front
.interpolate(&target.dragon_tail_front, dt);
self.dragon_tail_rear
.interpolate(&target.dragon_tail_rear, dt);
self.dragon_wing_in_l
.interpolate(&target.dragon_wing_in_l, dt);
self.dragon_wing_in_r
.interpolate(&target.dragon_wing_in_r, dt);
self.dragon_wing_out_l
.interpolate(&target.dragon_wing_out_l, dt);
self.dragon_wing_out_r
.interpolate(&target.dragon_wing_out_r, dt);
self.dragon_foot_fl.interpolate(&target.dragon_foot_fl, dt);
self.dragon_foot_fr.interpolate(&target.dragon_foot_fr, dt);
self.dragon_foot_bl.interpolate(&target.dragon_foot_bl, dt);
self.dragon_foot_br.interpolate(&target.dragon_foot_br, dt);
self.head.interpolate(&target.head, dt);
self.chest_front.interpolate(&target.chest_front, dt);
self.chest_rear.interpolate(&target.chest_rear, dt);
self.tail_front.interpolate(&target.tail_front, dt);
self.tail_rear.interpolate(&target.tail_rear, dt);
self.wing_in_l.interpolate(&target.wing_in_l, dt);
self.wing_in_r.interpolate(&target.wing_in_r, dt);
self.wing_out_l.interpolate(&target.wing_out_l, dt);
self.wing_out_r.interpolate(&target.wing_out_r, dt);
self.foot_fl.interpolate(&target.foot_fl, dt);
self.foot_fr.interpolate(&target.foot_fr, dt);
self.foot_bl.interpolate(&target.foot_bl, dt);
self.foot_br.interpolate(&target.foot_br, dt);
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
DragonSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct RunAnimation;
@ -13,82 +13,64 @@ impl Animation for RunAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
(_velocity, global_time): Self::Dependency,
anim_time: f64,
(_velocity, _global_time): Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let duck_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_front.ori = Quaternion::rotation_x(0.0);
next.chest_front.scale = Vec3::one() * 1.01;
next.dragon_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.dragon_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.dragon_head.scale = Vec3::one() / 10.88;
next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_rear.ori = Quaternion::rotation_x(0.0);
next.chest_rear.scale = Vec3::one() * 1.01;
next.dragon_chest_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_chest_front.ori = Quaternion::rotation_x(0.0);
next.dragon_chest_front.scale = Vec3::one() * 1.01;
next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_front.ori = Quaternion::rotation_x(0.0);
next.tail_front.scale = Vec3::one() * 1.01;
next.dragon_chest_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_chest_rear.ori = Quaternion::rotation_x(0.0);
next.dragon_chest_rear.scale = Vec3::one() * 1.01;
next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_rear.ori = Quaternion::rotation_x(0.0);
next.tail_rear.scale = Vec3::one() * 1.01;
next.dragon_tail_front.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_tail_front.ori = Quaternion::rotation_x(0.0);
next.dragon_tail_front.scale = Vec3::one() * 1.01;
next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_l.ori = Quaternion::rotation_x(0.0);
next.wing_in_l.scale = Vec3::one() * 1.01;
next.dragon_tail_rear.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_tail_rear.ori = Quaternion::rotation_x(0.0);
next.dragon_tail_rear.scale = Vec3::one() * 1.01;
next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_r.ori = Quaternion::rotation_x(0.0);
next.wing_in_r.scale = Vec3::one() * 1.01;
next.dragon_wing_in_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_in_l.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_in_l.scale = Vec3::one() * 1.01;
next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_l.ori = Quaternion::rotation_x(0.0);
next.wing_out_l.scale = Vec3::one() * 1.01;
next.dragon_wing_in_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_in_r.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_in_r.scale = Vec3::one() * 1.01;
next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_r.ori = Quaternion::rotation_x(0.0);
next.wing_out_r.scale = Vec3::one() * 1.01;
next.dragon_wing_out_l.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_out_l.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_out_l.scale = Vec3::one() * 1.01;
next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fl.ori = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() * 1.01;
next.dragon_wing_out_r.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_wing_out_r.ori = Quaternion::rotation_x(0.0);
next.dragon_wing_out_r.scale = Vec3::one() * 1.01;
next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fr.ori = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() * 1.01;
next.dragon_foot_fl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_fl.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_fl.scale = Vec3::one() * 1.01;
next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() * 1.01;
next.dragon_foot_fr.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_fr.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_fr.scale = Vec3::one() * 1.01;
next.dragon_foot_bl.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_bl.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_bl.scale = Vec3::one() * 1.01;
next.dragon_foot_br.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.dragon_foot_br.ori = Quaternion::rotation_x(0.0);
next.dragon_foot_br.scale = Vec3::one() * 1.01;
next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() * 1.01;
next
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
FishMediumSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -13,55 +13,36 @@ impl Animation for IdleAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let duck_m_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() * 1.01;
next.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.marlin_head.ori =
Quaternion::rotation_z(duck_m_look.x) * Quaternion::rotation_x(duck_m_look.y);
next.marlin_head.scale = Vec3::one() / 10.88;
next.rear.offset = Vec3::new(0.0, 3.1, -4.5);
next.rear.ori = Quaternion::rotation_z(0.0);
next.rear.scale = Vec3::one() * 0.98;
next.marlin_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.marlin_torso.ori = Quaternion::rotation_x(0.0);
next.marlin_torso.scale = Vec3::one() * 1.01;
next.tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one() / 11.0;
next.marlin_rear.offset = Vec3::new(0.0, 3.1, -4.5);
next.marlin_rear.ori = Quaternion::rotation_z(0.0);
next.marlin_rear.scale = Vec3::one() * 0.98;
next.fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.fin_l.ori = Quaternion::rotation_y(0.0);
next.fin_l.scale = Vec3::one() / 11.0;
next.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.marlin_tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.marlin_tail.scale = Vec3::one() / 11.0;
next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.marlin_fin_l.ori = Quaternion::rotation_y(0.0);
next.marlin_fin_l.scale = Vec3::one() / 11.0;
next.marlin_fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.marlin_fin_r.ori = Quaternion::rotation_y(0.0);
next.marlin_fin_r.scale = Vec3::one() / 10.5;
next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.fin_r.ori = Quaternion::rotation_y(0.0);
next.fin_r.scale = Vec3::one() / 10.5;
next
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
FishMediumSkeleton,
};
use std::f32::consts::PI;
//use std::f32::consts::PI;
use vek::*;
pub struct JumpAnimation;
@ -13,41 +13,36 @@ impl Animation for JumpAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.marlin_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.marlin_head.scale = Vec3::one() / 10.88;
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() * 1.01;
next.marlin_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.marlin_torso.ori = Quaternion::rotation_x(0.0);
next.marlin_torso.scale = Vec3::one() * 1.01;
next.rear.offset = Vec3::new(0.0, 3.1, -4.5);
next.rear.ori = Quaternion::rotation_z(0.0);
next.rear.scale = Vec3::one() * 0.98;
next.marlin_rear.offset = Vec3::new(0.0, 3.1, -4.5);
next.marlin_rear.ori = Quaternion::rotation_z(0.0);
next.marlin_rear.scale = Vec3::one() * 0.98;
next.tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one() / 11.0;
next.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.marlin_tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.marlin_tail.scale = Vec3::one() / 11.0;
next.fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.fin_l.ori = Quaternion::rotation_y(0.0);
next.fin_l.scale = Vec3::one() / 11.0;
next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.marlin_fin_l.ori = Quaternion::rotation_y(0.0);
next.marlin_fin_l.scale = Vec3::one() / 11.0;
next.marlin_fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.marlin_fin_r.ori = Quaternion::rotation_y(0.0);
next.marlin_fin_r.scale = Vec3::one() / 10.5;
next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.fin_r.ori = Quaternion::rotation_y(0.0);
next.fin_r.scale = Vec3::one() / 10.5;
next
}
}

View File

@ -12,39 +12,39 @@ use crate::render::FigureBoneData;
#[derive(Clone)]
pub struct FishMediumSkeleton {
marlin_head: Bone,
marlin_torso: Bone,
marlin_rear: Bone,
marlin_tail: Bone,
marlin_fin_l: Bone,
marlin_fin_r: Bone,
head: Bone,
torso: Bone,
rear: Bone,
tail: Bone,
fin_l: Bone,
fin_r: Bone,
}
impl FishMediumSkeleton {
pub fn new() -> Self {
Self {
marlin_head: Bone::default(),
marlin_torso: Bone::default(),
marlin_rear: Bone::default(),
marlin_tail: Bone::default(),
marlin_fin_l: Bone::default(),
marlin_fin_r: Bone::default(),
head: Bone::default(),
torso: Bone::default(),
rear: Bone::default(),
tail: Bone::default(),
fin_l: Bone::default(),
fin_r: Bone::default(),
}
}
}
impl Skeleton for FishMediumSkeleton {
fn compute_matrices(&self) -> [FigureBoneData; 16] {
let torso_mat = self.marlin_torso.compute_base_matrix();
let rear_mat = self.marlin_rear.compute_base_matrix();
let torso_mat = self.torso.compute_base_matrix();
let rear_mat = self.rear.compute_base_matrix();
[
FigureBoneData::new(self.marlin_head.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.head.compute_base_matrix() * torso_mat),
FigureBoneData::new(torso_mat),
FigureBoneData::new(rear_mat * torso_mat),
FigureBoneData::new(self.marlin_tail.compute_base_matrix() * rear_mat),
FigureBoneData::new(self.marlin_fin_l.compute_base_matrix() * rear_mat),
FigureBoneData::new(self.marlin_fin_r.compute_base_matrix() * rear_mat),
FigureBoneData::new(self.tail.compute_base_matrix() * rear_mat),
FigureBoneData::new(self.fin_l.compute_base_matrix() * rear_mat),
FigureBoneData::new(self.fin_r.compute_base_matrix() * rear_mat),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
@ -59,11 +59,11 @@ impl Skeleton for FishMediumSkeleton {
}
fn interpolate(&mut self, target: &Self, dt: f32) {
self.marlin_head.interpolate(&target.marlin_head, dt);
self.marlin_torso.interpolate(&target.marlin_torso, dt);
self.marlin_rear.interpolate(&target.marlin_rear, dt);
self.marlin_tail.interpolate(&target.marlin_tail, dt);
self.marlin_fin_l.interpolate(&target.marlin_fin_l, dt);
self.marlin_fin_r.interpolate(&target.marlin_fin_r, dt);
self.head.interpolate(&target.head, dt);
self.torso.interpolate(&target.torso, dt);
self.rear.interpolate(&target.rear, dt);
self.tail.interpolate(&target.tail, dt);
self.fin_l.interpolate(&target.fin_l, dt);
self.fin_r.interpolate(&target.fin_r, dt);
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
FishMediumSkeleton,
};
use std::f32::consts::PI;
//use std::f32::consts::PI;
use vek::*;
pub struct RunAnimation;
@ -13,41 +13,36 @@ impl Animation for RunAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.marlin_head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.marlin_head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.marlin_head.scale = Vec3::one() / 10.88;
next.torso.offset = Vec3::new(0.0, 4.5, 2.0);
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() * 1.01;
next.marlin_torso.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.marlin_torso.ori = Quaternion::rotation_x(0.0);
next.marlin_torso.scale = Vec3::one() * 1.01;
next.rear.offset = Vec3::new(0.0, 3.1, -4.5);
next.rear.ori = Quaternion::rotation_z(0.0);
next.rear.scale = Vec3::one() * 0.98;
next.marlin_rear.offset = Vec3::new(0.0, 3.1, -4.5);
next.marlin_rear.ori = Quaternion::rotation_z(0.0);
next.marlin_rear.scale = Vec3::one() * 0.98;
next.tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one() / 11.0;
next.marlin_tail.offset = Vec3::new(0.0, -13.0, 8.0) / 11.0;
next.marlin_tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.marlin_tail.scale = Vec3::one() / 11.0;
next.fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.fin_l.ori = Quaternion::rotation_y(0.0);
next.fin_l.scale = Vec3::one() / 11.0;
next.marlin_fin_l.offset = Vec3::new(0.0, -11.7, 11.0) / 11.0;
next.marlin_fin_l.ori = Quaternion::rotation_y(0.0);
next.marlin_fin_l.scale = Vec3::one() / 11.0;
next.marlin_fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.marlin_fin_r.ori = Quaternion::rotation_y(0.0);
next.marlin_fin_r.scale = Vec3::one() / 10.5;
next.fin_r.offset = Vec3::new(0.0, 0.0, 12.0) / 11.0;
next.fin_r.ori = Quaternion::rotation_y(0.0);
next.fin_r.scale = Vec3::one() / 10.5;
next
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
FishSmallSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -13,38 +13,20 @@ impl Animation for IdleAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 10.88;
let duck_m_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.cardinalfish_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.cardinalfish_torso.scale = Vec3::one() / 10.88;
next.cardinalfish_tail.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0);
next.cardinalfish_tail.scale = Vec3::one() * 1.01;
next.tail.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail.ori = Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one() * 1.01;
next
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
FishSmallSkeleton,
};
use std::f32::consts::PI;
//use std::f32::consts::PI;
use vek::*;
pub struct JumpAnimation;
@ -14,24 +14,19 @@ impl Animation for JumpAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
anim_time: f64,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 10.88;
next.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.cardinalfish_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.cardinalfish_torso.scale = Vec3::one() / 10.88;
next.cardinalfish_tail.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0);
next.cardinalfish_tail.scale = Vec3::one() * 1.01;
next.tail.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail.ori = Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one() * 1.01;
next
}

View File

@ -12,26 +12,26 @@ use crate::render::FigureBoneData;
#[derive(Clone)]
pub struct FishSmallSkeleton {
cardinalfish_torso: Bone,
cardinalfish_tail: Bone,
torso: Bone,
tail: Bone,
}
impl FishSmallSkeleton {
pub fn new() -> Self {
Self {
cardinalfish_torso: Bone::default(),
cardinalfish_tail: Bone::default(),
torso: Bone::default(),
tail: Bone::default(),
}
}
}
impl Skeleton for FishSmallSkeleton {
fn compute_matrices(&self) -> [FigureBoneData; 16] {
let torso_mat = self.cardinalfish_torso.compute_base_matrix();
let torso_mat = self.torso.compute_base_matrix();
[
FigureBoneData::new(torso_mat),
FigureBoneData::new(self.cardinalfish_tail.compute_base_matrix() * torso_mat),
FigureBoneData::new(self.tail.compute_base_matrix() * torso_mat),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
@ -50,9 +50,7 @@ impl Skeleton for FishSmallSkeleton {
}
fn interpolate(&mut self, target: &Self, dt: f32) {
self.cardinalfish_torso
.interpolate(&target.cardinalfish_torso, dt);
self.cardinalfish_tail
.interpolate(&target.cardinalfish_tail, dt);
self.torso.interpolate(&target.torso, dt);
self.tail.interpolate(&target.tail, dt);
}
}

View File

@ -2,7 +2,7 @@ use super::{
super::{Animation, SkeletonAttr},
FishSmallSkeleton,
};
use std::{f32::consts::PI, ops::Mul};
//use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct RunAnimation;
@ -13,38 +13,20 @@ impl Animation for RunAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
(_velocity, global_time): Self::Dependency,
anim_time: f64,
(_velocity, _global_time): Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
next.torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 10.88;
let duck_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.cardinalfish_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.cardinalfish_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.cardinalfish_torso.scale = Vec3::one() / 10.88;
next.cardinalfish_tail.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0);
next.cardinalfish_tail.ori = Quaternion::rotation_x(0.0);
next.cardinalfish_tail.scale = Vec3::one() * 1.01;
next.tail.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail.ori = Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one() * 1.01;
next
}

View File

@ -25,7 +25,7 @@ impl Animation for IdleAnimation {
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
let wolf_look = Vec2::new(
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
@ -37,7 +37,7 @@ impl Animation for IdleAnimation {
.sin()
* 0.25,
);
let wolf_tail = Vec2::new(
let tailmove = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
@ -50,52 +50,50 @@ impl Animation for IdleAnimation {
* 0.125,
);
next.wolf_head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_ultra_slow * 0.4) / 11.0;
next.wolf_head_upper.ori =
Quaternion::rotation_z(wolf_look.x) * Quaternion::rotation_x(wolf_look.y);
next.wolf_head_upper.scale = Vec3::one() / 10.88;
next.head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_ultra_slow * 0.4) / 11.0;
next.head_upper.ori = Quaternion::rotation_z(look.x) * Quaternion::rotation_x(look.y);
next.head_upper.scale = Vec3::one() / 10.88;
next.wolf_jaw.offset =
Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0 + wave_slow * 0.2);
next.wolf_jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.wolf_jaw.scale = Vec3::one() * 1.01;
next.jaw.offset = Vec3::new(0.0, 4.5 - wave_ultra_slow_cos * 0.12, 2.0 + wave_slow * 0.2);
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.jaw.scale = Vec3::one() * 1.01;
next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_ultra_slow * 0.20);
next.wolf_head_lower.ori = Quaternion::rotation_z(0.0);
next.wolf_head_lower.scale = Vec3::one() * 0.98;
next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_ultra_slow * 0.20);
next.head_lower.ori = Quaternion::rotation_z(0.0);
next.head_lower.scale = Vec3::one() * 0.98;
next.wolf_tail.offset = Vec3::new(0.0, -13.0, 8.0 + wave_ultra_slow * 1.2) / 11.0;
next.wolf_tail.ori = Quaternion::rotation_z(0.0 + wave_slow * 0.2 + wolf_tail.x)
* Quaternion::rotation_x(wolf_tail.y);
next.wolf_tail.scale = Vec3::one() / 11.0;
next.tail.offset = Vec3::new(0.0, -13.0, 8.0 + wave_ultra_slow * 1.2) / 11.0;
next.tail.ori = Quaternion::rotation_z(0.0 + wave_slow * 0.2 + tailmove.x)
* Quaternion::rotation_x(tailmove.y);
next.tail.scale = Vec3::one() / 11.0;
next.wolf_torso_back.offset = Vec3::new(0.0, -11.7, 11.0 + wave_ultra_slow * 1.2) / 11.0;
next.wolf_torso_back.ori = Quaternion::rotation_y(wave_slow_cos * 0.015);
next.wolf_torso_back.scale = Vec3::one() / 11.0;
next.torso_back.offset = Vec3::new(0.0, -11.7, 11.0 + wave_ultra_slow * 1.2) / 11.0;
next.torso_back.ori = Quaternion::rotation_y(wave_slow_cos * 0.015);
next.torso_back.scale = Vec3::one() / 11.0;
next.wolf_torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_ultra_slow * 0.7) / 11.0;
next.wolf_torso_mid.ori = Quaternion::rotation_y(wave_slow * 0.015);
next.wolf_torso_mid.scale = Vec3::one() / 10.5;
next.torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_ultra_slow * 0.7) / 11.0;
next.torso_mid.ori = Quaternion::rotation_y(wave_slow * 0.015);
next.torso_mid.scale = Vec3::one() / 10.5;
next.wolf_ears.offset = Vec3::new(0.0, 0.75, 5.25);
next.wolf_ears.ori = Quaternion::rotation_x(0.0 + wave_slow * 0.1);
next.wolf_ears.scale = Vec3::one() * 1.05;
next.ears.offset = Vec3::new(0.0, 0.75, 5.25);
next.ears.ori = Quaternion::rotation_x(0.0 + wave_slow * 0.1);
next.ears.scale = Vec3::one() * 1.05;
next.wolf_foot_lf.offset = Vec3::new(-5.0, 5.0, 2.5) / 11.0;
next.wolf_foot_lf.ori = Quaternion::rotation_x(0.0);
next.wolf_foot_lf.scale = Vec3::one() / 11.0;
next.foot_lf.offset = Vec3::new(-5.0, 5.0, 2.5) / 11.0;
next.foot_lf.ori = Quaternion::rotation_x(0.0);
next.foot_lf.scale = Vec3::one() / 11.0;
next.wolf_foot_rf.offset = Vec3::new(5.0, 5.0, 2.5) / 11.0;
next.wolf_foot_rf.ori = Quaternion::rotation_x(0.0);
next.wolf_foot_rf.scale = Vec3::one() / 11.0;
next.foot_rf.offset = Vec3::new(5.0, 5.0, 2.5) / 11.0;
next.foot_rf.ori = Quaternion::rotation_x(0.0);
next.foot_rf.scale = Vec3::one() / 11.0;
next.wolf_foot_lb.offset = Vec3::new(-5.0, -10.0, 2.5) / 11.0;
next.wolf_foot_lb.ori = Quaternion::rotation_x(0.0);
next.wolf_foot_lb.scale = Vec3::one() / 11.0;
next.foot_lb.offset = Vec3::new(-5.0, -10.0, 2.5) / 11.0;
next.foot_lb.ori = Quaternion::rotation_x(0.0);
next.foot_lb.scale = Vec3::one() / 11.0;
next.wolf_foot_rb.offset = Vec3::new(5.0, -10.0, 2.5) / 11.0;
next.wolf_foot_rb.ori = Quaternion::rotation_x(0.0);
next.wolf_foot_rb.scale = Vec3::one() / 11.0;
next.foot_rb.offset = Vec3::new(5.0, -10.0, 2.5) / 11.0;
next.foot_rb.ori = Quaternion::rotation_x(0.0);
next.foot_rb.scale = Vec3::one() / 11.0;
next
}

View File

@ -24,56 +24,52 @@ impl Animation for JumpAnimation {
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_stop = (anim_time as f32 * 5.0).min(PI / 2.0).sin();
next.wolf_head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) / 11.0;
next.wolf_head_upper.ori =
next.head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) / 11.0;
next.head_upper.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
next.wolf_head_upper.scale = Vec3::one() / 10.88;
next.head_upper.scale = Vec3::one() / 10.88;
next.wolf_jaw.offset = Vec3::new(0.0, 4.5, 2.0);
next.wolf_jaw.ori = Quaternion::rotation_x(0.0);
next.wolf_jaw.scale = Vec3::one() * 1.01;
next.jaw.offset = Vec3::new(0.0, 4.5, 2.0);
next.jaw.ori = Quaternion::rotation_x(0.0);
next.jaw.scale = Vec3::one() * 1.01;
next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5);
next.wolf_head_lower.ori = Quaternion::rotation_x(wave_stop * -0.1);
next.wolf_head_lower.scale = Vec3::one() * 0.98;
next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5);
next.head_lower.ori = Quaternion::rotation_x(wave_stop * -0.1);
next.head_lower.scale = Vec3::one() * 0.98;
next.wolf_tail.offset = Vec3::new(0.0, -12.0, 8.0) / 11.0;
next.wolf_tail.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
next.wolf_tail.scale = Vec3::one() / 11.0;
next.tail.offset = Vec3::new(0.0, -12.0, 8.0) / 11.0;
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
next.tail.scale = Vec3::one() / 11.0;
next.wolf_torso_back.offset =
next.torso_back.offset =
Vec3::new(0.0, -9.5 + wave_stop * 1.0, 11.0 + wave_stop * 2.2) / 11.0;
next.wolf_torso_back.ori = Quaternion::rotation_x(wave_slow * -0.25);
next.wolf_torso_back.scale = Vec3::one() / 11.0;
next.torso_back.ori = Quaternion::rotation_x(wave_slow * -0.25);
next.torso_back.scale = Vec3::one() / 11.0;
next.wolf_torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_stop * 3.6) / 11.0;
next.wolf_torso_mid.ori = Quaternion::rotation_x(wave_slow * -0.25);
next.wolf_torso_mid.scale = Vec3::one() / 10.5;
next.torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_stop * 3.6) / 11.0;
next.torso_mid.ori = Quaternion::rotation_x(wave_slow * -0.25);
next.torso_mid.scale = Vec3::one() / 10.5;
next.wolf_ears.offset = Vec3::new(0.0, 0.75, 6.25);
next.wolf_ears.ori = Quaternion::rotation_x(0.0);
next.wolf_ears.scale = Vec3::one() * 1.05;
next.ears.offset = Vec3::new(0.0, 0.75, 6.25);
next.ears.ori = Quaternion::rotation_x(0.0);
next.ears.scale = Vec3::one() * 1.05;
next.wolf_foot_lf.offset =
Vec3::new(-5.0, 5.0 + wave_stop * 3.0, 5.0 + wave_stop * 7.0) / 11.0;
next.wolf_foot_lf.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
next.wolf_foot_lf.scale = Vec3::one() / 11.0;
next.foot_lf.offset = Vec3::new(-5.0, 5.0 + wave_stop * 3.0, 5.0 + wave_stop * 7.0) / 11.0;
next.foot_lf.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
next.foot_lf.scale = Vec3::one() / 11.0;
next.wolf_foot_rf.offset =
Vec3::new(5.0, 5.0 - wave_stop * 3.0, 5.0 + wave_stop * 5.0) / 11.0;
next.wolf_foot_rf.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
next.wolf_foot_rf.scale = Vec3::one() / 11.0;
next.foot_rf.offset = Vec3::new(5.0, 5.0 - wave_stop * 3.0, 5.0 + wave_stop * 5.0) / 11.0;
next.foot_rf.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
next.foot_rf.scale = Vec3::one() / 11.0;
next.wolf_foot_lb.offset =
next.foot_lb.offset =
Vec3::new(-5.0, -10.0 - wave_stop * 2.0, 5.0 + wave_stop * 0.0) / 11.0;
next.wolf_foot_lb.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
next.wolf_foot_lb.scale = Vec3::one() / 11.0;
next.foot_lb.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
next.foot_lb.scale = Vec3::one() / 11.0;
next.wolf_foot_rb.offset =
Vec3::new(5.0, -10.0 + wave_stop * 2.0, 5.0 + wave_stop * 2.0) / 11.0;
next.wolf_foot_rb.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
next.wolf_foot_rb.scale = Vec3::one() / 11.0;
next.foot_rb.offset = Vec3::new(5.0, -10.0 + wave_stop * 2.0, 5.0 + wave_stop * 2.0) / 11.0;
next.foot_rb.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
next.foot_rb.scale = Vec3::one() / 11.0;
next
}

View File

@ -12,57 +12,55 @@ use crate::render::FigureBoneData;
#[derive(Clone)]
pub struct QuadrupedMediumSkeleton {
wolf_head_upper: Bone,
wolf_jaw: Bone,
wolf_head_lower: Bone,
wolf_tail: Bone,
wolf_torso_back: Bone,
wolf_torso_mid: Bone,
wolf_ears: Bone,
wolf_foot_lf: Bone,
wolf_foot_rf: Bone,
wolf_foot_lb: Bone,
wolf_foot_rb: Bone,
head_upper: Bone,
jaw: Bone,
head_lower: Bone,
tail: Bone,
torso_back: Bone,
torso_mid: Bone,
ears: Bone,
foot_lf: Bone,
foot_rf: Bone,
foot_lb: Bone,
foot_rb: Bone,
}
impl QuadrupedMediumSkeleton {
pub fn new() -> Self {
Self {
wolf_head_upper: Bone::default(),
wolf_jaw: Bone::default(),
wolf_head_lower: Bone::default(),
wolf_tail: Bone::default(),
wolf_torso_back: Bone::default(),
wolf_torso_mid: Bone::default(),
wolf_ears: Bone::default(),
wolf_foot_lf: Bone::default(),
wolf_foot_rf: Bone::default(),
wolf_foot_lb: Bone::default(),
wolf_foot_rb: Bone::default(),
head_upper: Bone::default(),
jaw: Bone::default(),
head_lower: Bone::default(),
tail: Bone::default(),
torso_back: Bone::default(),
torso_mid: Bone::default(),
ears: Bone::default(),
foot_lf: Bone::default(),
foot_rf: Bone::default(),
foot_lb: Bone::default(),
foot_rb: Bone::default(),
}
}
}
impl Skeleton for QuadrupedMediumSkeleton {
fn compute_matrices(&self) -> [FigureBoneData; 16] {
let ears_mat = self.wolf_ears.compute_base_matrix();
let head_upper_mat = self.wolf_head_upper.compute_base_matrix();
let head_lower_mat = self.wolf_head_lower.compute_base_matrix();
let ears_mat = self.ears.compute_base_matrix();
let head_upper_mat = self.head_upper.compute_base_matrix();
let head_lower_mat = self.head_lower.compute_base_matrix();
[
FigureBoneData::new(head_upper_mat),
FigureBoneData::new(
head_upper_mat * head_lower_mat * self.wolf_jaw.compute_base_matrix(),
),
FigureBoneData::new(head_upper_mat * head_lower_mat * self.jaw.compute_base_matrix()),
FigureBoneData::new(head_upper_mat * head_lower_mat),
FigureBoneData::new(self.wolf_tail.compute_base_matrix()),
FigureBoneData::new(self.wolf_torso_back.compute_base_matrix()),
FigureBoneData::new(self.wolf_torso_mid.compute_base_matrix()),
FigureBoneData::new(self.tail.compute_base_matrix()),
FigureBoneData::new(self.torso_back.compute_base_matrix()),
FigureBoneData::new(self.torso_mid.compute_base_matrix()),
FigureBoneData::new(head_upper_mat * ears_mat),
FigureBoneData::new(self.wolf_foot_lf.compute_base_matrix()),
FigureBoneData::new(self.wolf_foot_rf.compute_base_matrix()),
FigureBoneData::new(self.wolf_foot_lb.compute_base_matrix()),
FigureBoneData::new(self.wolf_foot_rb.compute_base_matrix()),
FigureBoneData::new(self.foot_lf.compute_base_matrix()),
FigureBoneData::new(self.foot_rf.compute_base_matrix()),
FigureBoneData::new(self.foot_lb.compute_base_matrix()),
FigureBoneData::new(self.foot_rb.compute_base_matrix()),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
@ -72,19 +70,16 @@ impl Skeleton for QuadrupedMediumSkeleton {
}
fn interpolate(&mut self, target: &Self, dt: f32) {
self.wolf_head_upper
.interpolate(&target.wolf_head_upper, dt);
self.wolf_jaw.interpolate(&target.wolf_jaw, dt);
self.wolf_head_lower
.interpolate(&target.wolf_head_lower, dt);
self.wolf_tail.interpolate(&target.wolf_tail, dt);
self.wolf_torso_back
.interpolate(&target.wolf_torso_back, dt);
self.wolf_torso_mid.interpolate(&target.wolf_torso_mid, dt);
self.wolf_ears.interpolate(&target.wolf_ears, dt);
self.wolf_foot_lf.interpolate(&target.wolf_foot_lf, dt);
self.wolf_foot_rf.interpolate(&target.wolf_foot_rf, dt);
self.wolf_foot_lb.interpolate(&target.wolf_foot_lb, dt);
self.wolf_foot_rb.interpolate(&target.wolf_foot_rb, dt);
self.head_upper.interpolate(&target.head_upper, dt);
self.jaw.interpolate(&target.jaw, dt);
self.head_lower.interpolate(&target.head_lower, dt);
self.tail.interpolate(&target.tail, dt);
self.torso_back.interpolate(&target.torso_back, dt);
self.torso_mid.interpolate(&target.torso_mid, dt);
self.ears.interpolate(&target.ears, dt);
self.foot_lf.interpolate(&target.foot_lf, dt);
self.foot_rf.interpolate(&target.foot_rf, dt);
self.foot_lb.interpolate(&target.foot_lb, dt);
self.foot_rb.interpolate(&target.foot_rb, dt);
}
}

View File

@ -41,58 +41,57 @@ impl Animation for RunAnimation {
* 0.125,
);
next.wolf_head_upper.offset =
next.head_upper.offset =
Vec3::new(0.0, 9.5 + wave_quick_cos * 2.0, 15.0 + wave_med * 3.0) / 11.0;
next.wolf_head_upper.ori =
Quaternion::rotation_x(-0.12 + wave_quick_cos * 0.12 + wolf_look.y)
* Quaternion::rotation_z(wolf_look.x);
next.wolf_head_upper.scale = Vec3::one() / 10.88;
next.head_upper.ori = Quaternion::rotation_x(-0.12 + wave_quick_cos * 0.12 + wolf_look.y)
* Quaternion::rotation_z(wolf_look.x);
next.head_upper.scale = Vec3::one() / 10.88;
next.wolf_jaw.offset = Vec3::new(0.0, 4.5, 2.0 + wave_slow_cos * 1.0);
next.wolf_jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.wolf_jaw.scale = Vec3::one() * 1.01;
next.jaw.offset = Vec3::new(0.0, 4.5, 2.0 + wave_slow_cos * 1.0);
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.jaw.scale = Vec3::one() * 1.01;
next.wolf_head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_med * 1.0);
next.wolf_head_lower.ori = Quaternion::rotation_z(0.0);
next.wolf_head_lower.scale = Vec3::one() * 0.98;
next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5 + wave_med * 1.0);
next.head_lower.ori = Quaternion::rotation_z(0.0);
next.head_lower.scale = Vec3::one() * 0.98;
next.wolf_tail.offset = Vec3::new(0.0, -12.0, 10.0) / 11.0;
next.wolf_tail.ori = Quaternion::rotation_x(wave_quick * 0.18);
next.wolf_tail.scale = Vec3::one() / 11.0;
next.tail.offset = Vec3::new(0.0, -12.0, 10.0) / 11.0;
next.tail.ori = Quaternion::rotation_x(wave_quick * 0.18);
next.tail.scale = Vec3::one() / 11.0;
next.wolf_torso_back.offset =
next.torso_back.offset =
Vec3::new(0.0, -9.5 + wave_quick_cos * 2.2, 13.0 + wave_med * 2.8) / 11.0;
next.wolf_torso_back.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.14);
next.wolf_torso_back.scale = Vec3::one() / 11.0;
next.torso_back.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.14);
next.torso_back.scale = Vec3::one() / 11.0;
next.wolf_torso_mid.offset =
next.torso_mid.offset =
Vec3::new(0.0, 0.0 + wave_quick_cos * 2.2, 14.0 + wave_med * 3.2) / 11.0;
next.wolf_torso_mid.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.12);
next.wolf_torso_mid.scale = Vec3::one() / 10.5;
next.torso_mid.ori = Quaternion::rotation_x(-0.15 + wave_med_cos * 0.12);
next.torso_mid.scale = Vec3::one() / 10.5;
next.wolf_ears.offset = Vec3::new(0.0, 0.75 + wave * 0.4, 6.25);
next.wolf_ears.ori = Quaternion::rotation_x(wave * 0.2);
next.wolf_ears.scale = Vec3::one() * 1.05;
next.ears.offset = Vec3::new(0.0, 0.75 + wave * 0.4, 6.25);
next.ears.ori = Quaternion::rotation_x(wave * 0.2);
next.ears.scale = Vec3::one() * 1.05;
next.wolf_foot_lf.offset =
next.foot_lf.offset =
Vec3::new(-5.0, 5.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0;
next.wolf_foot_lf.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8);
next.wolf_foot_lf.scale = Vec3::one() / 11.0;
next.foot_lf.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8);
next.foot_lf.scale = Vec3::one() / 11.0;
next.wolf_foot_rf.offset =
next.foot_rf.offset =
Vec3::new(5.0, 5.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0;
next.wolf_foot_rf.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8);
next.wolf_foot_rf.scale = Vec3::one() / 11.0;
next.foot_rf.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8);
next.foot_rf.scale = Vec3::one() / 11.0;
next.wolf_foot_lb.offset =
next.foot_lb.offset =
Vec3::new(-5.0, -10.0 - wave_quick_cos * 3.0, 7.0 + wave_quick * 4.0) / 11.0;
next.wolf_foot_lb.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8);
next.wolf_foot_lb.scale = Vec3::one() / 11.0;
next.foot_lb.ori = Quaternion::rotation_x(0.0 - wave_quick_cos * 0.8);
next.foot_lb.scale = Vec3::one() / 11.0;
next.wolf_foot_rb.offset =
next.foot_rb.offset =
Vec3::new(5.0, -10.0 + wave_quick * 3.0, 7.0 + wave_quick_cos * 4.0) / 11.0;
next.wolf_foot_rb.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8);
next.wolf_foot_rb.scale = Vec3::one() / 11.0;
next.foot_rb.ori = Quaternion::rotation_x(0.0 + wave_quick * 0.8);
next.foot_rb.scale = Vec3::one() / 11.0;
next
}

View File

@ -539,15 +539,6 @@ pub fn mesh_draw() -> Mesh<FigurePipeline> {
load_mesh("object.glider", Vec3::new(-26.0, -26.0, -5.0))
}
//pub fn mesh_right_equip(hand: Hand) -> Mesh<FigurePipeline> {
// load_mesh(
// match hand {
// Hand::Default => "figure/body/hand",
// },
// Vec3::new(-2.0, -2.5, -5.0),
// )
//}
/////////
pub fn mesh_quadruped_small_head(head: quadruped_small::Head) -> Mesh<FigurePipeline> {
load_mesh(