This commit is contained in:
Snowram 2020-05-09 17:22:08 +02:00 committed by jshipsey
parent a6de8159f6
commit 0248c6a44e
14 changed files with 58 additions and 110 deletions

View File

@ -17,19 +17,19 @@
lateral: ("npc.reddragon.male.wing_out_r"),
),
foot_fl: (
offset: (-6.5, -4.0, -1.5),
offset: (-5.5, -4.0, -1.5),
lateral: ("npc.reddragon.male.foot_fl"),
),
foot_fr: (
offset: (-6.5, -4.0, -1.5),
offset: (-5.5, -4.0, -1.5),
lateral: ("npc.reddragon.male.foot_fr"),
),
foot_bl: (
offset: (-6.5, -4.0, -3.0),
offset: (-5.5, -4.0, -3.0),
lateral: ("npc.reddragon.male.foot_bl"),
),
foot_br: (
offset: (-6.5, -4.0, -3.0),
offset: (-5.5, -4.0, -3.0),
lateral: ("npc.reddragon.male.foot_br"),
)
),
@ -51,19 +51,19 @@
lateral: ("npc.reddragon.female.wing_out_r"),
),
foot_fl: (
offset: (-6.5, -4.0, -1.5),
offset: (-5.5, -4.0, -1.5),
lateral: ("npc.reddragon.female.foot_fl"),
),
foot_fr: (
offset: (-6.5, -4.0, -1.5),
offset: (-5.5, -4.0, -1.5),
lateral: ("npc.reddragon.female.foot_fr"),
),
foot_bl: (
offset: (-6.5, -4.0, -3.0),
offset: (-5.5, -4.0, -3.0),
lateral: ("npc.reddragon.female.foot_bl"),
),
foot_br: (
offset: (-6.5, -4.0, -3.0),
offset: (-5.5, -4.0, -3.0),
lateral: ("npc.reddragon.female.foot_br"),
)
),

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,25 +1,16 @@
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
use std::{f32::consts::PI, ops::Mul};
use std::f32::consts::PI;
use vek::*;
pub struct FlyAnimation;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
const TEST_1: f32 = 0.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
const TEST_2: f32 = 0.0;
#[const_tweaker::tweak(min = -1.0, max = 1.0, step = 0.01)]
const TEST_3: f32 = 0.0;
#[const_tweaker::tweak(min = -1.0, max = 1.0, step = 0.01)]
const TEST_4: f32 = 0.0;
impl Animation for FlyAnimation {
type Dependency = (f32, f64);
type Skeleton = DragonSkeleton;
fn update_skeleton(
skeleton: &Self::Skeleton,
(_velocity, global_time): Self::Dependency,
_global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
@ -30,49 +21,18 @@ impl Animation for FlyAnimation {
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
//let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wingl = (anim_time as f32 * 2.0 + PI).sin();
let wingr = (anim_time as f32 * 2.0).sin();
let vertlf = (anim_time as f32 * lab as f32 + PI * 1.8).sin().max(0.15);
let vertrfoffset = (anim_time as f32 * lab as f32 + PI * 0.80).sin().max(0.15);
let vertlboffset = (anim_time as f32 * lab as f32).sin().max(0.15);
let vertrb = (anim_time as f32 * lab as f32 + PI).sin().max(0.15);
let horilf = (anim_time as f32 * lab as f32 + PI * 1.2).sin();
let horirfoffset = (anim_time as f32 * lab as f32 + PI * 0.20).sin();
let horilboffset = (anim_time as f32 * lab as f32 + PI * 1.4).sin();
let horirb = (anim_time as f32 * lab as f32 + PI * 0.4).sin();
let 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 verthead = (anim_time as f32 * lab as f32 + PI * 0.3).sin();
let footl = (anim_time as f32 * lab as f32 + PI).sin();
let footr = (anim_time as f32 * lab as f32).sin();
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
let wolf_look = Vec2::new(
((global_time + anim_time) as f32 / 4.0)
.floor()
.mul(7331.0)
.sin()
* 0.25,
((global_time + anim_time) as f32 / 4.0)
.floor()
.mul(1337.0)
.sin()
* 0.125,
);
let wave = (anim_time as f32 * 14.0).sin();
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.head_upper.offset = Vec3::new(
0.0,
skeleton_attr.head_upper.0,
@ -144,7 +104,7 @@ impl Animation for FlyAnimation {
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
) * 1.05;
next.foot_fr.ori = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_fr.ori = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_fr.scale = Vec3::one() * 1.05;
next.foot_bl.offset = Vec3::new(
@ -160,7 +120,7 @@ impl Animation for FlyAnimation {
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
) * 1.05;
next.foot_br.ori = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_br.ori = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_br.scale = Vec3::one() * 1.05;
next.wing_in_l.offset = Vec3::new(
@ -168,7 +128,7 @@ impl Animation for FlyAnimation {
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_l.ori = Quaternion::rotation_y((0.15 + wingl * 0.6).max(0.2));
next.wing_in_l.ori = Quaternion::rotation_y(0.4 + wingl * 0.6);
next.wing_in_l.scale = Vec3::one() * 1.05;
next.wing_in_r.offset = Vec3::new(
@ -176,7 +136,7 @@ impl Animation for FlyAnimation {
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_r.ori = Quaternion::rotation_y((-0.15 + wingr * 0.6).min(0.2));
next.wing_in_r.ori = Quaternion::rotation_y(-0.4 + wingr * 0.6);
next.wing_in_r.scale = Vec3::one() * 1.05;
next.wing_out_l.offset = Vec3::new(
@ -184,7 +144,7 @@ impl Animation for FlyAnimation {
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2,
);
next.wing_out_l.ori = Quaternion::rotation_y((0.35 + wingl * 0.6).max(0.0));
next.wing_out_l.ori = Quaternion::rotation_y((0.35 + wingl * 0.6).max(0.2));
next.wing_out_l.scale = Vec3::one() * 1.05;
next.wing_out_r.offset = Vec3::new(
@ -192,7 +152,7 @@ impl Animation for FlyAnimation {
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2,
);
next.wing_out_r.ori = Quaternion::rotation_y((-0.35 + wingr * 0.6).min(0.0));
next.wing_out_r.ori = Quaternion::rotation_y((-0.35 + wingr * 0.6).min(-0.2));
next.wing_out_r.scale = Vec3::one() * 1.05;
next

View File

@ -1,18 +1,9 @@
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
use std::{f32::consts::PI, ops::Mul};
use std::ops::Mul;
use vek::*;
pub struct IdleAnimation;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
const TEST_R: f32 = 2.5;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
const TEST_L: f32 = -2.5;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
const OFF1: f32 = -1.4;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.1)]
const OFF2: f32 = -1.4;
impl Animation for IdleAnimation {
type Dependency = f64;
type Skeleton = DragonSkeleton;
@ -30,7 +21,7 @@ impl Animation for IdleAnimation {
let wave_slow = (anim_time as f32 * 2.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let look = Vec2::new(
let dragon_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
@ -49,7 +40,7 @@ impl Animation for IdleAnimation {
skeleton_attr.head_upper.1 + ultra_slow * 0.20,
) * 1.05;
next.head_upper.ori =
Quaternion::rotation_z(0.8 * look.x) * Quaternion::rotation_x(0.8 * look.y);
Quaternion::rotation_z(0.8 * dragon_look.x) * Quaternion::rotation_x(0.8 * dragon_look.y);
next.head_upper.scale = Vec3::one() * 1.05;
next.head_lower.offset = Vec3::new(
@ -58,7 +49,7 @@ impl Animation for IdleAnimation {
skeleton_attr.head_lower.1 + ultra_slow * 0.20,
) * 1.05;
next.head_lower.ori =
Quaternion::rotation_z(0.8 * look.x) * Quaternion::rotation_x(0.8 * look.y);
Quaternion::rotation_z(0.8 * dragon_look.x) * Quaternion::rotation_x(0.8 * dragon_look.y);
next.head_lower.scale = Vec3::one() * 1.05;
next.jaw.offset = Vec3::new(
@ -112,7 +103,7 @@ impl Animation for IdleAnimation {
next.wing_out_l.offset = Vec3::new(
-skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2 + *OFF1,
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_l.ori = Quaternion::rotation_y(-0.3);//2.0
next.wing_out_l.scale = Vec3::one() * 1.05;
@ -120,7 +111,7 @@ impl Animation for IdleAnimation {
next.wing_out_r.offset = Vec3::new(
skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2 + *OFF2,
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_r.ori = Quaternion::rotation_y(0.3);
next.wing_out_r.scale = Vec3::one() * 1.05;

View File

@ -7,6 +7,7 @@ pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
use super::{Bone, Skeleton};
use crate::render::FigureBoneData;
<<<<<<< HEAD
use common::comp::{self};
use vek::Vec3;
@ -62,6 +63,9 @@ const FEET_B_X: f32 = 6.0;
const FEET_B_Y: f32 = -15.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const FEET_B_Z: f32 = 3.0;
=======
use common::comp::{self};
>>>>>>> Cleanup
#[derive(Clone, Default)]
pub struct DragonSkeleton {
@ -217,37 +221,37 @@ impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
use comp::dragon::Species::*;
Self {
head_upper: match (body.species, body.body_type) {
(Reddragon, _) => (*HEAD_UPPER_X, *HEAD_UPPER_Z),
(Reddragon, _) => (2.5, 4.5),
},
head_lower: match (body.species, body.body_type) {
(Reddragon, _) => (*HEAD_LOWER_X, *HEAD_LOWER_Z),
(Reddragon, _) => (7.5, 3.5),
},
jaw: match (body.species, body.body_type) {
(Reddragon, _) => (*JAW_X, *JAW_Z),
(Reddragon, _) => (7.0, -5.0),
},
chest_front: match (body.species, body.body_type) {
(Reddragon, _) => (*CHEST_F_X, *CHEST_F_Z),
(Reddragon, _) => (0.0, 14.0),
},
chest_rear: match (body.species, body.body_type) {
(Reddragon, _) => (*CHEST_R_X, *CHEST_R_Z),
(Reddragon, _) => (-12.5, 0.0),
},
tail_front: match (body.species, body.body_type) {
(Reddragon, _) => (*TAIL_F_X, *TAIL_F_Z),
(Reddragon, _) => (-12.5, 1.5),
},
tail_rear: match (body.species, body.body_type) {
(Reddragon, _) => (*TAIL_R_X, *TAIL_R_Z),
(Reddragon, _) => (-14.0, 0.0),
},
wing_in: match (body.species, body.body_type) {
(Reddragon, _) => (*WING_IN_X, *WING_IN_Y, *WING_IN_Z),
(Reddragon, _) => (2.5, -16.5, 0.0),
},
wing_out: match (body.species, body.body_type) {
(Reddragon, _) => (*WING_OUT_X, *WING_OUT_Y, *WING_OUT_Z),
(Reddragon, _) => (23.0, 0.5, 4.0),
},
feet_f: match (body.species, body.body_type) {
(Reddragon, _) => (*FEET_F_X, *FEET_F_Y, *FEET_F_Z),
(Reddragon, _) => (6.0, 0.0, 1.5),
},
feet_b: match (body.species, body.body_type) {
(Reddragon, _) => (*FEET_B_X, *FEET_B_Y, *FEET_B_Z),
(Reddragon, _) => (6.0, -15.0, 3.0),
},
height: match (body.species, body.body_type) {
(Reddragon, _) => (1.0),

View File

@ -19,10 +19,8 @@ impl Animation for RunAnimation {
let lab = 14;
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let vertlf = (anim_time as f32 * lab as f32 + PI * 1.8).sin().max(0.15);
let vertrfoffset = (anim_time as f32 * lab as f32 + PI * 0.80).sin().max(0.15);
@ -36,15 +34,11 @@ impl Animation for RunAnimation {
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 verthead = (anim_time as f32 * lab as f32 + PI * 0.3).sin();
let footl = (anim_time as f32 * lab as f32 + PI).sin();
let footr = (anim_time as f32 * lab as f32).sin();
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
let wolf_look = Vec2::new(
let dragon_look = Vec2::new(
((global_time + anim_time) as f32 / 4.0)
.floor()
.mul(7331.0)
@ -63,7 +57,7 @@ impl Animation for RunAnimation {
skeleton_attr.head_upper.1,
) * 1.05;
next.head_upper.ori =
Quaternion::rotation_x(wolf_look.y) * Quaternion::rotation_z(wolf_look.x);
Quaternion::rotation_x(dragon_look.y) * Quaternion::rotation_z(dragon_look.x);
next.head_upper.scale = Vec3::one() * 1.05;
next.head_lower.offset = Vec3::new(

View File

@ -1052,7 +1052,7 @@ impl FigureMgr {
is_player,
);
},
Body::Dragon(dragon_body) => {
Body::Dragon(_) => {
let skeleton_attr = &self
.dragon_model_cache
.get_or_create_model(
@ -1064,7 +1064,6 @@ impl FigureMgr {
None,
)
.1;
let ref skeleton_attr = dragon_body.into();
let state = self
.dragon_states