cleanup, last tweaks

This commit is contained in:
jshipsey 2020-08-01 02:19:01 -04:00
parent aa3bdc42d7
commit bcc257f893
11 changed files with 165 additions and 63 deletions

View File

@ -9,12 +9,12 @@
center: ("npc.ogre.male.torso_upper"),
),
torso_lower: (
offset: (-5.0, -4.5, -4.5),
offset: (-5.0, -4.5, -9.0),
center: ("npc.ogre.male.torso_lower"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("npc.ogre.male.torso_upper"),
center: ("armor.empty"),
)
),
(Ogre, Female): (
@ -27,12 +27,12 @@
center: ("npc.ogre.male.torso_upper"),
),
torso_lower: (
offset: (-5.0, -4.5, -4.5),
offset: (-5.0, -4.5, -9.0),
center: ("npc.ogre.male.torso_lower"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("npc.ogre.male.torso_upper"),
center: ("armor.empty"),
)
),
(Cyclops, Male): (
@ -81,12 +81,12 @@
center: ("npc.wendigo.male.torso_upper"),
),
torso_lower: (
offset: (-4.0, -2.0, -2.0),
offset: (-4.0, -2.0, -4.0),
center: ("npc.wendigo.male.torso_lower"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("npc.ogre.male.torso_upper"),
center: ("armor.empty"),
)
),
(Wendigo, Female): (
@ -99,12 +99,12 @@
center: ("npc.wendigo.male.torso_upper"),
),
torso_lower: (
offset: (-4.0, -2.0, -2.0),
offset: (-4.0, -2.0, -4.0),
center: ("npc.wendigo.male.torso_lower"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("npc.ogre.male.torso_upper"),
center: ("armor.empty"),
)
),
(Troll, Male): (
@ -117,12 +117,12 @@
center: ("npc.troll.male.torso_upper"),
),
torso_lower: (
offset: (-6.0, -3.5, -2.5),
offset: (-6.0, -3.5, -5.0),
center: ("npc.troll.male.torso_lower"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("npc.ogre.male.torso_upper"),
center: ("armor.empty"),
)
),
(Troll, Female): (
@ -135,12 +135,12 @@
center: ("npc.troll.male.torso_upper"),
),
torso_lower: (
offset: (-6.0, -3.5, -2.5),
offset: (-6.0, -3.5, -5.0),
center: ("npc.troll.male.torso_lower"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("npc.ogre.male.torso_upper"),
center: ("armor.empty"),
)
),
})

View File

@ -57,7 +57,7 @@
),
(Goose, Male): (
head: (
offset: (-2.0, -3.5, -2.5),
offset: (-2.0, -3.5, -0.0),
center: ("npc.goose.male.head"),
),
torso: (
@ -71,7 +71,7 @@
),
(Goose, Female): (
head: (
offset: (-2.0, -3.5, -2.5),
offset: (-2.0, -3.5, -0.0),
center: ("npc.goose.male.head"),
),
torso: (
@ -85,7 +85,7 @@
),
(Peacock, Male): (
head: (
offset: (-2.0, -1.5, -6.5),
offset: (-2.0, -1.5, -0.0),
center: ("npc.peacock.male.head"),
),
torso: (
@ -99,7 +99,7 @@
),
(Peacock, Female): (
head: (
offset: (-2.0, -1.5, -6.5),
offset: (-2.0, -1.5, -0.0),
center: ("npc.peacock.female.head"),
),
torso: (
@ -197,7 +197,7 @@
),
(Cockatrice, Male): (
head: (
offset: (-2.5, -3.5, -8.0),
offset: (-2.5, 0.0, -8.0),
center: ("npc.cockatrice.male.head"),
),
torso: (
@ -211,7 +211,7 @@
),
(Cockatrice, Female): (
head: (
offset: (-2.5, -3.5, -8.0),
offset: (-2.5, 0.0, -8.0),
center: ("npc.cockatrice.male.head"),
),
torso: (

Binary file not shown.

Binary file not shown.

View File

@ -145,14 +145,14 @@ impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
upper_torso: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 19.0),
(Cyclops, _) => (-2.0, 27.0),
(Wendigo, _) => (-1.0, 27.0),
(Troll, _) => (-1.0, 25.5),
(Wendigo, _) => (-1.0, 29.0),
(Troll, _) => (-1.0, 27.5),
},
lower_torso: match (body.species, body.body_type) {
(Ogre, _) => (1.0, -9.5),
(Ogre, _) => (1.0, -5.5),
(Cyclops, _) => (1.0, -4.5),
(Wendigo, _) => (-1.5, -8.0),
(Troll, _) => (1.0, -12.5),
(Wendigo, _) => (-1.5, -6.0),
(Troll, _) => (1.0, -10.5),
},
shoulder: match (body.species, body.body_type) {
(Ogre, _) => (6.1, 0.5, 2.5),
@ -167,16 +167,16 @@ impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
(Troll, _) => (11.5, 0.0, -1.5),
},
leg: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 0.0, -6.0),
(Ogre, _) => (0.0, 0.0, 0.0),
(Cyclops, _) => (0.0, 0.0, -5.0),
(Wendigo, _) => (2.0, 0.0, -8.5),
(Troll, _) => (5.0, 0.0, -16.0),
(Wendigo, _) => (2.0, 2.0, -2.5),
(Troll, _) => (5.0, 0.0, -6.0),
},
foot: match (body.species, body.body_type) {
(Ogre, _) => (4.0, 0.5, 5.5),
(Ogre, _) => (4.0, 2.5, 2.5),
(Cyclops, _) => (4.0, 0.5, 5.0),
(Wendigo, _) => (5.0, 0.5, 5.5),
(Troll, _) => (6.0, 0.5, 3.0),
(Wendigo, _) => (5.0, 0.5, 6.0),
(Troll, _) => (6.0, 0.5, 4.0),
},
}
}

View File

@ -52,8 +52,6 @@ impl Animation for WieldAnimation {
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
let footvertl = (anim_time as f32 * 16.0 * lab as f32).sin();
let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).sin();
let handhoril = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin();
let handhorir = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin();
let footrotl = (((5.0)
/ (2.5

View File

@ -0,0 +1,94 @@
use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr};
use std::ops::Mul;
use vek::*;
pub struct FeedAnimation;
impl Animation for FeedAnimation {
type Dependency = f64;
type Skeleton = BirdMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"bird_medium_feed\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_medium_feed")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave = (anim_time as f32 * 8.0).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let duck_head_look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0 + 1.0, -2.0 + skeleton_attr.head.1);
next.head.ori = Quaternion::rotation_z(duck_head_look.x)
* Quaternion::rotation_x(-0.3 / skeleton_attr.feed + wave_slow_cos * 0.03 + wave * 0.1);
next.head.scale = Vec3::one();
next.torso.offset = Vec3::new(
0.0,
skeleton_attr.chest.0 + skeleton_attr.feed,
-1.0 - 5.0 * (skeleton_attr.feed - 1.0) + wave_slow * 0.3 + skeleton_attr.chest.1,
) / 11.0;
next.torso.ori = Quaternion::rotation_x(-0.5 * skeleton_attr.feed)
* Quaternion::rotation_y(wave_slow * 0.03);
next.torso.scale = Vec3::one() / 11.0;
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.ori = Quaternion::rotation_x(wave_slow_cos * 0.03);
next.tail.scale = Vec3::one();
next.wing_l.offset = Vec3::new(
-skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_l.ori = Quaternion::rotation_y(0.4 - wave_slow * 0.1);
next.wing_l.scale = Vec3::one() * 1.05;
next.wing_r.offset = Vec3::new(
skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_r.ori = Quaternion::rotation_y(-0.4 + wave_slow * 0.1);
next.wing_r.scale = Vec3::one() * 1.05;
next.leg_l.offset = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 11.0;
next.leg_l.ori = Quaternion::rotation_y(0.0);
next.leg_l.scale = Vec3::one() / 11.0;
next.leg_r.offset = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 11.0;
next.leg_r.ori = Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() / 11.0;
next
}
}

View File

@ -1,9 +1,10 @@
pub mod feed;
pub mod fly;
pub mod idle;
pub mod run;
// Reexports
pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
pub use self::{feed::FeedAnimation, fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
use super::{Bone, FigureBoneData, Skeleton};
use common::comp::{self};
@ -77,6 +78,7 @@ pub struct SkeletonAttr {
tail: (f32, f32),
wing: (f32, f32, f32),
foot: (f32, f32, f32),
feed: f32,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -98,6 +100,7 @@ impl Default for SkeletonAttr {
tail: (0.0, 0.0),
wing: (0.0, 0.0, 0.0),
foot: (0.0, 0.0, 0.0),
feed: 0.0,
}
}
}
@ -109,12 +112,12 @@ impl<'a> From<&'a comp::bird_medium::Body> for SkeletonAttr {
head: match (body.species, body.body_type) {
(Duck, _) => (4.0, 3.0),
(Chicken, _) => (4.0, 3.0),
(Goose, _) => (5.0, 5.0),
(Peacock, _) => (4.0, 7.0),
(Goose, _) => (5.0, 2.5),
(Peacock, _) => (1.0, 1.0),
(Eagle, _) => (2.5, 5.0),
(Snowyowl, _) => (2.5, 5.0),
(Parrot, _) => (0.5, 4.5),
(Cockatrice, _) => (3.0, 4.0),
(Cockatrice, _) => (0.0, 4.0),
},
chest: match (body.species, body.body_type) {
(Duck, _) => (0.0, 5.0),
@ -156,6 +159,16 @@ impl<'a> From<&'a comp::bird_medium::Body> for SkeletonAttr {
(Parrot, _) => (1.5, -3.0, 3.0),
(Cockatrice, _) => (4.0, -3.5, 12.0),
},
feed: match (body.species, body.body_type) {
(Duck, _) => 1.0,
(Chicken, _) => 1.0,
(Goose, _) => 1.4,
(Peacock, _) => 1.6,
(Eagle, _) => 1.2,
(Snowyowl, _) => 1.0,
(Parrot, _) => 1.2,
(Cockatrice, _) => 1.3,
},
}
}
}

View File

@ -1,5 +1,5 @@
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
use std::{f32::consts::PI, ops::Mul};
use std::f32::consts::PI;
use vek::*;
pub struct RunAnimation;
@ -14,7 +14,7 @@ impl Animation for RunAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "dragon_run")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
(_velocity, orientation, last_ori, _global_time, avg_vel): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
@ -34,20 +34,6 @@ impl Animation for RunAnimation {
let shortalt = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.5).sin();
let footvert = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.0).sin();
let footvertt = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin();
let footvertalt = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.2).sin();
let footverttalt = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.6).sin();
let footvertf = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.3).sin();
let footverttf = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.7).sin();
let footvertaltf = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.5).sin();
let footverttaltf = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.9).sin();
let footvertfslow = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.6).sin();
let footverttfslow = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.0).sin();
let footvertaltfslow = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.8).sin();
let footverttaltfslow = (anim_time as f32 * 16.0 * lab as f32 + PI * 2.2).sin();
//
let ori: Vec2<f32> = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
@ -79,9 +65,6 @@ impl Animation for RunAnimation {
let horilboffset = (anim_time as f32 * lab as f32 + PI * 1.4).sin();
let horirb = (anim_time as f32 * lab as f32 + PI * 0.4).sin();
let vertchest = (anim_time as f32 * lab as f32 + PI * 0.3).sin().max(0.2);
let horichest = (anim_time as f32 * lab as f32 + PI * 0.8).sin();
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();

View File

@ -312,7 +312,7 @@ impl<'a> From<&'a comp::quadruped_small::Body> for SkeletonAttr {
(Hyena, _) => (1.0),
(Rabbit, _) => (1.2),
(Truffler, _) => (0.6),
(Frog, _) => (1.2),
(Frog, _) => (0.7),
},
}
}

View File

@ -1231,12 +1231,29 @@ impl FigureMgr {
&mut state_animation_rate,
skeleton_attr,
),
_ => anim::bird_medium::IdleAnimation::update_skeleton(
&BirdMediumSkeleton::new(),
time,
state.state_time,
&mut state_animation_rate,
skeleton_attr,
),
};
let target_bones = match &character {
CharacterState::Sit { .. } => {
anim::bird_medium::FeedAnimation::update_skeleton(
&target_base,
time,
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
},
// TODO!
_ => state.skeleton_mut().clone(),
_ => target_base,
};
state.skeleton.interpolate(&target_base, dt);
state.skeleton.interpolate(&target_bones, dt);
state.update(
renderer,
pos.0,