mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
run animation incremental tweaks
Former-commit-id: 3abad8762a7a2daaf96c955cf89bcf5713ae7318
This commit is contained in:
parent
9510edd148
commit
9c15fa08a8
@ -31,7 +31,11 @@ impl Animation for IdleAnimation {
|
||||
let waveultracos_slow = (time as f32 * 1.0 + PI).cos();
|
||||
let wave_dip = (wave_slow.abs() - 0.5).abs();
|
||||
|
||||
<<<<<<< HEAD
|
||||
next.head.offset = Vec3::new(5.5, 0.0, 12.0 + waveultra_slow * 0.4);
|
||||
=======
|
||||
next.head.offset = Vec3::new(5.5, 0.0, 12.0 + waveultra_slow * 0.4) / SCALE;
|
||||
>>>>>>> run animation incremental tweaks
|
||||
next.head.ori = Quaternion::rotation_y(waveultra_slow * 0.05);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
@ -47,11 +51,17 @@ impl Animation for IdleAnimation {
|
||||
next.shorts.ori = Quaternion::rotation_y(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
<<<<<<< HEAD
|
||||
next.l_hand.offset = Vec3::new(2.0 + waveultracos_slow * 0.3, 7.5, 12.5 + waveultra_slow * 1.1);
|
||||
next.l_hand.ori = Quaternion::rotation_y(0.0 + waveultra_slow * 0.06);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(2.0 + waveultracos_slow * 0.3 , - 7.5, 12.5 + waveultra_slow * 1.1);
|
||||
=======
|
||||
next.l_hand.offset = Vec3::new(2.0 + waveultracos_slow * 0.3, 7.5, 12.5 + waveultra_slow * 1.1) / SCALE;
|
||||
next.l_hand.ori = Quaternion::rotation_y(0.0 + waveultra_slow * 0.06);
|
||||
next.r_hand.offset = Vec3::new(2.0 + waveultracos_slow * 0.3 , - 7.5, 12.5 + waveultra_slow * 1.1) / SCALE;
|
||||
>>>>>>> run animation incremental tweaks
|
||||
next.r_hand.ori = Quaternion::rotation_y(0.0 + waveultra_slow * 0.06);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
@ -63,9 +73,15 @@ impl Animation for IdleAnimation {
|
||||
next.r_foot.ori = Quaternion::rotation_y(0.04 + waveultra_slow * 0.04);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
<<<<<<< HEAD
|
||||
next.weapon.offset = Vec3::new(-4.5, 14.0, 13.0);
|
||||
next.weapon.ori = Quaternion::rotation_x(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
=======
|
||||
next.back.offset = Vec3::new(-4.5, 14.0, 13.0);
|
||||
next.back.ori = Quaternion::rotation_x(2.5);
|
||||
next.back.scale = Vec3::one();
|
||||
>>>>>>> run animation incremental tweaks
|
||||
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
@ -80,6 +96,14 @@ impl Animation for IdleAnimation {
|
||||
next.r_shoulder.ori = Quaternion::rotation_y(0.0);
|
||||
next.r_shoulder.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(2.9, 6.0, 18.0) / SCALE;
|
||||
next.l_shoulder.ori = Quaternion::rotation_y(0.0);
|
||||
next.l_shoulder.scale = Vec3::one() / SCALE;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(2.9, -6.0, 18.0) / SCALE;
|
||||
next.r_shoulder.ori = Quaternion::rotation_y(0.0);
|
||||
next.r_shoulder.scale = Vec3::one() / SCALE;
|
||||
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -1,97 +1,86 @@
|
||||
pub mod run;
|
||||
pub mod idle;
|
||||
// Standard
|
||||
use std::f32::consts::PI;
|
||||
|
||||
// Reexports
|
||||
pub use self::run::RunAnimation;
|
||||
pub use self::idle::IdleAnimation;
|
||||
|
||||
// Crate
|
||||
use crate::render::FigureBoneData;
|
||||
// Library
|
||||
use vek::*;
|
||||
|
||||
// Local
|
||||
use super::{
|
||||
Skeleton,
|
||||
Bone,
|
||||
CharacterSkeleton,
|
||||
super::Animation,
|
||||
SCALE
|
||||
};
|
||||
|
||||
const SCALE: f32 = 11.0;
|
||||
pub struct RunAnimation;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CharacterSkeleton {
|
||||
head: Bone,
|
||||
chest: Bone,
|
||||
belt: Bone,
|
||||
shorts: Bone,
|
||||
l_hand: Bone,
|
||||
r_hand: Bone,
|
||||
l_foot: Bone,
|
||||
r_foot: Bone,
|
||||
weapon: Bone,
|
||||
torso: Bone,
|
||||
l_shoulder: Bone,
|
||||
r_shoulder: Bone,
|
||||
}
|
||||
impl Animation for RunAnimation {
|
||||
type Skeleton = CharacterSkeleton;
|
||||
type Dependency = f64;
|
||||
|
||||
impl CharacterSkeleton {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
head: Bone::default(),
|
||||
chest: Bone::default(),
|
||||
belt: Bone::default(),
|
||||
shorts: Bone::default(),
|
||||
l_hand: Bone::default(),
|
||||
r_hand: Bone::default(),
|
||||
l_foot: Bone::default(),
|
||||
r_foot: Bone::default(),
|
||||
weapon: Bone::default(),
|
||||
torso: Bone::default(),
|
||||
l_shoulder: Bone::default(),
|
||||
r_shoulder: Bone::default(),
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
time: f64,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
let wave = (time as f32 * 14.0).sin();
|
||||
let wavetest = (wave.cbrt());
|
||||
let fuzzwave = (time as f32 * 12.0).sin();
|
||||
let wavecos = (time as f32 * 14.0).cos();
|
||||
let wave_slow = (time as f32 * 7.0 + PI).sin();
|
||||
let wavecos_slow = (time as f32 * 8.0 + PI).cos();
|
||||
let wave_dip = (wave_slow.abs() - 0.5).abs();
|
||||
|
||||
impl Skeleton for CharacterSkeleton {
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
let chest_mat = self.chest.compute_base_matrix();
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
[
|
||||
FigureBoneData::new(torso_mat * self.head.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * chest_mat),
|
||||
FigureBoneData::new(torso_mat * self.belt.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.shorts.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.l_hand.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.l_foot.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.r_foot.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * chest_mat * self.weapon.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat),
|
||||
//FigureBoneData::new(torso_mat * self.l_shoulder.compute_base_matrix()),
|
||||
//FigureBoneData::new(torso_mat * self.r_shoulder.compute_base_matrix()),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
next.head.offset = Vec3::new(6.0, 0.0, 12.0 + wavecos * 1.3);
|
||||
next.head.ori = Quaternion::rotation_y(-0.15);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
]
|
||||
}
|
||||
next.chest.offset = Vec3::new(2.5, 0.0, 8.0 + wavecos * 1.1);
|
||||
next.chest.ori = Quaternion::rotation_z(wave * 0.1);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
fn interpolate(&mut self, target: &Self) {
|
||||
self.head.interpolate(&target.head);
|
||||
self.chest.interpolate(&target.chest);
|
||||
self.belt.interpolate(&target.belt);
|
||||
self.shorts.interpolate(&target.shorts);
|
||||
self.l_hand.interpolate(&target.l_hand);
|
||||
self.r_hand.interpolate(&target.r_hand);
|
||||
self.l_foot.interpolate(&target.l_foot);
|
||||
self.r_foot.interpolate(&target.r_foot);
|
||||
self.weapon.interpolate(&target.weapon);
|
||||
self.torso.interpolate(&target.torso);
|
||||
self.l_shoulder.interpolate(&target.l_shoulder);
|
||||
self.r_shoulder.interpolate(&target.r_shoulder);
|
||||
next.belt.offset = Vec3::new(2.5, 0.0, 6.0 + wavecos * 1.1);
|
||||
next.belt.ori = Quaternion::rotation_z(wave * 0.25);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(2.5, 0.0, 3.0 + wavecos * 1.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(2.0 - wavecos * 2.5, 7.5, 12.0 + wave * 1.5);
|
||||
next.l_hand.ori = Quaternion::rotation_y(wavecos * 0.9);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(2.0 + wavecos * 2.5, -7.5, 12.0 - wave * 1.5);
|
||||
next.r_hand.ori = Quaternion::rotation_y(wavecos * -0.9);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(3.5 + wave * 1.0, 3.4, 6.0);
|
||||
next.l_foot.ori = Quaternion::rotation_y(-0.0 - wave * 1.5);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.5 - wave * 1.0, -3.4, 6.0);
|
||||
next.r_foot.ori = Quaternion::rotation_y(-0.0 + wave * 1.5);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(-5.0, 14.0, 13.0);
|
||||
next.weapon.ori = Quaternion::rotation_x(2.5);
|
||||
next.weapon.scale = Vec3::one();
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.torso.ori = Quaternion::rotation_y(0.25 + wavecos * 0.1);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(3.0, 6.0, 18.0);
|
||||
next.l_shoulder.ori = Quaternion::rotation_y(0.0);
|
||||
next.l_shoulder.scale = Vec3::one();
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(3.0, -6.0, 18.0);
|
||||
next.r_shoulder.ori = Quaternion::rotation_y(0.0);
|
||||
next.r_shoulder.scale = Vec3::one();
|
||||
|
||||
|
||||
next
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -90,28 +90,6 @@ impl FigureCache {
|
||||
None,
|
||||
None,
|
||||
];
|
||||
// let bone_meshes = [
|
||||
//
|
||||
//
|
||||
// Some(load_segment("head.vox").generate_mesh(Vec3::new(-5.5, -7.0, -6.0))),
|
||||
// Some(load_segment("chest.vox").generate_mesh(Vec3::new(-2.5, -6.0, 0.0))),
|
||||
// Some(load_segment("belt.vox").generate_mesh(Vec3::new(-2.5, -5.0, 0.0))),
|
||||
// Some(load_segment("pants.vox").generate_mesh(Vec3::new(-2.5, -5.0, 0.0))),
|
||||
// Some(load_segment("hand.vox").generate_mesh(Vec3::new(0.0, -2.0, -7.0))),
|
||||
// Some(load_segment("hand.vox").generate_mesh(Vec3::new(0.0, -2.0, -7.0))),
|
||||
// Some(load_segment("foot.vox").generate_mesh(Vec3::new(-3.5, -2.5, -8.0))),
|
||||
// Some(load_segment("foot.vox").generate_mesh(Vec3::new(-3.5, -2.5, -8.0))),
|
||||
// Some(load_segment("sword.vox").generate_mesh(Vec3::new(0.0, -0.0, -4.0))),
|
||||
// None,
|
||||
//Some(load_segment("shoulder_left.vox").generate_mesh(Vec3::new(-3.0, -2.5, -8.0))),
|
||||
//Some(load_segment("shoulder_right.vox").generate_mesh(Vec3::new(-3.0, -2.5, -8.0))),
|
||||
// None,
|
||||
// None,
|
||||
// None,
|
||||
// None,
|
||||
// None,
|
||||
// None,
|
||||
// ];
|
||||
|
||||
let mut mesh = Mesh::new();
|
||||
bone_meshes
|
||||
|
Loading…
Reference in New Issue
Block a user