This commit is contained in:
jshipsey 2020-05-09 18:02:27 -04:00
parent 9d6a7981ac
commit 7bf0d99a9a
12 changed files with 189 additions and 186 deletions

View File

@ -49,9 +49,7 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
} }
} }
pub const ALL_SPECIES: [Species; 1] = [ pub const ALL_SPECIES: [Species; 1] = [Species::Reddragon];
Species::Reddragon,
];
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> { impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
type Item = Species; type Item = Species;

View File

@ -79,9 +79,7 @@ impl EntityInfo {
Body::QuadrupedSmall(body) => { Body::QuadrupedSmall(body) => {
Some(get_npc_name(&NPC_NAMES.quadruped_small, body.species)) Some(get_npc_name(&NPC_NAMES.quadruped_small, body.species))
}, },
Body::Dragon(body) => { Body::Dragon(body) => Some(get_npc_name(&NPC_NAMES.dragon, body.species)),
Some(get_npc_name(&NPC_NAMES.dragon, body.species))
},
_ => None, _ => None,
} }
.map(|s| { .map(|s| {

View File

@ -1,108 +1,114 @@
pub mod fly;
pub mod idle; pub mod idle;
pub mod jump;
pub mod run; pub mod run;
// Reexports // Reexports
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation}; pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
use super::{Bone, Skeleton}; use super::{Bone, Skeleton};
use crate::render::FigureBoneData; use crate::render::FigureBoneData;
use common::comp::{self}; use common::comp::{self};
#[derive(Clone)] #[derive(Clone, Default)]
pub struct BipedLargeSkeleton { pub struct DragonSkeleton {
head: Bone, head_upper: Bone,
upper_torso: Bone, head_lower: Bone,
lower_torso: Bone, jaw: Bone,
shoulder_l: Bone, chest_front: Bone,
shoulder_r: Bone, chest_rear: Bone,
hand_l: Bone, tail_front: Bone,
hand_r: Bone, tail_rear: Bone,
leg_l: Bone, wing_in_l: Bone,
leg_r: Bone, wing_in_r: Bone,
foot_l: Bone, wing_out_l: Bone,
foot_r: Bone, wing_out_r: Bone,
torso: Bone, foot_fl: Bone,
foot_fr: Bone,
foot_bl: Bone,
foot_br: Bone,
} }
impl BipedLargeSkeleton { impl DragonSkeleton {
pub fn new() -> Self { pub fn new() -> Self { Self::default() }
Self {
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(),
torso: Bone::default(),
}
}
} }
impl Skeleton for BipedLargeSkeleton { impl Skeleton for DragonSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn bone_count(&self) -> usize { 11 } fn bone_count(&self) -> usize { 15 }
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 16] {
let upper_torso_mat = self.upper_torso.compute_base_matrix(); let head_upper_mat = self.head_upper.compute_base_matrix();
let shoulder_l_mat = self.shoulder_l.compute_base_matrix(); let head_lower_mat = self.head_lower.compute_base_matrix();
let shoulder_r_mat = self.shoulder_r.compute_base_matrix(); let chest_front_mat = self.chest_front.compute_base_matrix();
let leg_l_mat = self.leg_l.compute_base_matrix(); let chest_rear_mat = self.chest_rear.compute_base_matrix();
let leg_r_mat = self.leg_r.compute_base_matrix(); let wing_in_l_mat = self.wing_in_l.compute_base_matrix();
let torso_mat = self.torso.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(torso_mat * upper_torso_mat * self.head.compute_base_matrix()), FigureBoneData::new(chest_front_mat * head_lower_mat * head_upper_mat),
FigureBoneData::new(torso_mat * upper_torso_mat), FigureBoneData::new(chest_front_mat * head_lower_mat),
FigureBoneData::new( FigureBoneData::new(
torso_mat * upper_torso_mat * self.lower_torso.compute_base_matrix(), chest_front_mat * head_lower_mat * head_upper_mat * self.jaw.compute_base_matrix(),
), ),
FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_l_mat), FigureBoneData::new(chest_front_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_r_mat), FigureBoneData::new(chest_front_mat * self.chest_rear.compute_base_matrix()),
FigureBoneData::new(torso_mat * upper_torso_mat * self.hand_l.compute_base_matrix()), FigureBoneData::new(chest_front_mat * chest_rear_mat * tail_front_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * self.hand_r.compute_base_matrix()), FigureBoneData::new(
FigureBoneData::new(torso_mat * upper_torso_mat * leg_l_mat), chest_front_mat
FigureBoneData::new(torso_mat * upper_torso_mat * leg_r_mat), * chest_rear_mat
FigureBoneData::new(self.foot_l.compute_base_matrix()), * tail_front_mat
FigureBoneData::new(self.foot_r.compute_base_matrix()), * self.tail_rear.compute_base_matrix(),
FigureBoneData::default(), ),
FigureBoneData::default(), FigureBoneData::new(chest_front_mat * self.wing_in_l.compute_base_matrix()),
FigureBoneData::default(), FigureBoneData::new(chest_front_mat * self.wing_in_r.compute_base_matrix()),
FigureBoneData::default(), FigureBoneData::new(
chest_front_mat * wing_in_l_mat * self.wing_out_l.compute_base_matrix(),
),
FigureBoneData::new(
chest_front_mat * wing_in_r_mat * self.wing_out_r.compute_base_matrix(),
),
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(),
] ]
} }
fn interpolate(&mut self, target: &Self, dt: f32) { fn interpolate(&mut self, target: &Self, dt: f32) {
self.head.interpolate(&target.head, dt); self.head_upper.interpolate(&target.head_upper, dt);
self.upper_torso.interpolate(&target.upper_torso, dt); self.head_lower.interpolate(&target.head_lower, dt);
self.lower_torso.interpolate(&target.lower_torso, dt); self.jaw.interpolate(&target.jaw, dt);
self.shoulder_l.interpolate(&target.shoulder_l, dt); self.chest_front.interpolate(&target.chest_front, dt);
self.shoulder_r.interpolate(&target.shoulder_r, dt); self.chest_rear.interpolate(&target.chest_rear, dt);
self.hand_l.interpolate(&target.hand_l, dt); self.tail_front.interpolate(&target.tail_front, dt);
self.hand_r.interpolate(&target.hand_r, dt); self.tail_rear.interpolate(&target.tail_rear, dt);
self.leg_l.interpolate(&target.leg_l, dt); self.wing_in_l.interpolate(&target.wing_in_l, dt);
self.leg_r.interpolate(&target.leg_r, dt); self.wing_in_r.interpolate(&target.wing_in_r, dt);
self.foot_l.interpolate(&target.foot_l, dt); self.wing_out_l.interpolate(&target.wing_out_l, dt);
self.foot_r.interpolate(&target.foot_r, dt); self.wing_out_r.interpolate(&target.wing_out_r, dt);
self.torso.interpolate(&target.torso, 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);
} }
} }
pub struct SkeletonAttr { pub struct SkeletonAttr {
head: (f32, f32), head_upper: (f32, f32),
upper_torso: (f32, f32), head_lower: (f32, f32),
lower_torso: (f32, f32), jaw: (f32, f32),
shoulder: (f32, f32, f32), chest_front: (f32, f32),
hand: (f32, f32, f32), chest_rear: (f32, f32),
leg: (f32, f32, f32), tail_front: (f32, f32),
foot: (f32, f32, f32), tail_rear: (f32, f32),
wing_in: (f32, f32, f32),
wing_out: (f32, f32, f32),
feet_f: (f32, f32, f32),
feet_b: (f32, f32, f32),
height: f32,
} }
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr { impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -110,7 +116,7 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
fn try_from(body: &'a comp::Body) -> Result<Self, Self::Error> { fn try_from(body: &'a comp::Body) -> Result<Self, Self::Error> {
match body { match body {
comp::Body::BipedLarge(body) => Ok(SkeletonAttr::from(body)), comp::Body::Dragon(body) => Ok(SkeletonAttr::from(body)),
_ => Err(()), _ => Err(()),
} }
} }
@ -119,41 +125,61 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
impl Default for SkeletonAttr { impl Default for SkeletonAttr {
fn default() -> Self { fn default() -> Self {
Self { Self {
head: (0.0, 0.0), head_upper: (0.0, 0.0),
upper_torso: (0.0, 0.0), head_lower: (0.0, 0.0),
lower_torso: (0.0, 0.0), jaw: (0.0, 0.0),
shoulder: (0.0, 0.0, 0.0), chest_front: (0.0, 0.0),
hand: (0.0, 0.0, 0.0), chest_rear: (0.0, 0.0),
leg: (0.0, 0.0, 0.0), tail_front: (0.0, 0.0),
foot: (0.0, 0.0, 0.0), tail_rear: (0.0, 0.0),
wing_in: (0.0, 0.0, 0.0),
wing_out: (0.0, 0.0, 0.0),
feet_f: (0.0, 0.0, 0.0),
feet_b: (0.0, 0.0, 0.0),
height: (0.0),
} }
} }
} }
impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr { impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
fn from(body: &'a comp::biped_large::Body) -> Self { fn from(body: &'a comp::dragon::Body) -> Self {
use comp::biped_large::Species::*; use comp::dragon::Species::*;
Self { Self {
head: match (body.species, body.body_type) { head_upper: match (body.species, body.body_type) {
(Ogre, _) => (3.0, 6.0), (Reddragon, _) => (2.5, 4.5),
}, },
upper_torso: match (body.species, body.body_type) { head_lower: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 19.0), (Reddragon, _) => (7.5, 3.5),
}, },
lower_torso: match (body.species, body.body_type) { jaw: match (body.species, body.body_type) {
(Ogre, _) => (1.0, -9.5), (Reddragon, _) => (7.0, -5.0),
}, },
shoulder: match (body.species, body.body_type) { chest_front: match (body.species, body.body_type) {
(Ogre, _) => (6.1, 0.5, 2.5), (Reddragon, _) => (0.0, 14.0),
}, },
hand: match (body.species, body.body_type) { chest_rear: match (body.species, body.body_type) {
(Ogre, _) => (10.5, -1.0, -0.5), (Reddragon, _) => (-12.5, 0.0),
}, },
leg: match (body.species, body.body_type) { tail_front: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 0.0, -6.0), (Reddragon, _) => (-6.5, 1.5),
}, },
foot: match (body.species, body.body_type) { tail_rear: match (body.species, body.body_type) {
(Ogre, _) => (4.0, 0.5, 2.5), (Reddragon, _) => (-11.5, -1.0),
},
wing_in: match (body.species, body.body_type) {
(Reddragon, _) => (2.5, -16.5, 0.0),
},
wing_out: match (body.species, body.body_type) {
(Reddragon, _) => (23.0, 0.5, 4.0),
},
feet_f: match (body.species, body.body_type) {
(Reddragon, _) => (6.0, 0.0, 1.5),
},
feet_b: match (body.species, body.body_type) {
(Reddragon, _) => (6.0, -15.0, 3.0),
},
height: match (body.species, body.body_type) {
(Reddragon, _) => (1.0),
}, },
} }
} }

View File

@ -55,11 +55,7 @@ impl Animation for GlidingAnimation {
0.0 0.0
} * 0.8; } * 0.8;
next.head.offset = Vec3::new( next.head.offset = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
0.0,
-2.0 + skeleton_attr.head.0,
skeleton_attr.head.1,
);
next.head.ori = Quaternion::rotation_x(0.35 - slow * 0.10 + head_look.y) next.head.ori = Quaternion::rotation_x(0.35 - slow * 0.10 + head_look.y)
* Quaternion::rotation_z(head_look.x + slowa * 0.15); * Quaternion::rotation_z(head_look.x + slowa * 0.15);

View File

@ -55,11 +55,7 @@ impl Animation for RollAnimation {
next.chest.ori = Quaternion::rotation_x(wave_dub * 0.4); next.chest.ori = Quaternion::rotation_x(wave_dub * 0.4);
next.chest.scale = Vec3::one() * 1.01; next.chest.scale = Vec3::one() * 1.01;
next.belt.offset = Vec3::new( next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + 2.0, skeleton_attr.belt.1 + 2.0);
0.0,
skeleton_attr.belt.0 + 2.0,
skeleton_attr.belt.1 + 2.0,
);
next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.8); next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.8);
next.shorts.offset = Vec3::new( next.shorts.offset = Vec3::new(

View File

@ -132,8 +132,7 @@ impl Animation for SwimAnimation {
next.lantern.scale = Vec3::one() * 0.65; next.lantern.scale = Vec3::one() * 0.65;
next.torso.offset = Vec3::new(0.0, -0.3 + shortalt * -0.065, 0.4) * skeleton_attr.scaler; next.torso.offset = Vec3::new(0.0, -0.3 + shortalt * -0.065, 0.4) * skeleton_attr.scaler;
next.torso.ori = next.torso.ori = Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05);
Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one(); next.control.scale = Vec3::one();

View File

@ -64,7 +64,7 @@ impl Animation for FlyAnimation {
skeleton_attr.tail_front.1 + centeroffset * 0.6, skeleton_attr.tail_front.1 + centeroffset * 0.6,
); );
next.tail_front.ori = Quaternion::rotation_x(center * 0.03); next.tail_front.ori = Quaternion::rotation_x(center * 0.03);
next.tail_front.scale = Vec3::one()*0.98; next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.offset = Vec3::new( next.tail_rear.offset = Vec3::new(
0.0, 0.0,
@ -72,7 +72,7 @@ impl Animation for FlyAnimation {
skeleton_attr.tail_rear.1 + centeroffset * 0.6, skeleton_attr.tail_rear.1 + centeroffset * 0.6,
); );
next.tail_rear.ori = Quaternion::rotation_x(center * 0.03); next.tail_rear.ori = Quaternion::rotation_x(center * 0.03);
next.tail_rear.scale = Vec3::one()*0.98; next.tail_rear.scale = Vec3::one() * 0.98;
next.chest_front.offset = Vec3::new( next.chest_front.offset = Vec3::new(
0.0, 0.0,
@ -82,11 +82,8 @@ impl Animation for FlyAnimation {
next.chest_front.ori = Quaternion::rotation_y(center * 0.05); next.chest_front.ori = Quaternion::rotation_y(center * 0.05);
next.chest_front.scale = Vec3::one(); next.chest_front.scale = Vec3::one();
next.chest_rear.offset = Vec3::new( next.chest_rear.offset =
0.0, Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
skeleton_attr.chest_rear.0,
skeleton_attr.chest_rear.1,
);
next.chest_rear.ori = Quaternion::rotation_y(center * 0.05); next.chest_rear.ori = Quaternion::rotation_y(center * 0.05);
next.chest_rear.scale = Vec3::one(); next.chest_rear.scale = Vec3::one();

View File

@ -19,7 +19,7 @@ impl Animation for IdleAnimation {
let ultra_slow = (anim_time as f32 * 1.0).sin(); let ultra_slow = (anim_time as f32 * 1.0).sin();
let slow = (anim_time as f32 * 2.5).sin(); let slow = (anim_time as f32 * 2.5).sin();
let slowalt = (anim_time as f32 * 2.5+PI/2.0).sin(); let slowalt = (anim_time as f32 * 2.5 + PI / 2.0).sin();
let dragon_look = Vec2::new( let dragon_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0) ((global_time + anim_time) as f32 / 8.0)
@ -39,8 +39,8 @@ impl Animation for IdleAnimation {
skeleton_attr.head_upper.0, skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + ultra_slow * 0.20, skeleton_attr.head_upper.1 + ultra_slow * 0.20,
); );
next.head_upper.ori = next.head_upper.ori = Quaternion::rotation_z(0.8 * dragon_look.x)
Quaternion::rotation_z(0.8 * dragon_look.x) * Quaternion::rotation_x(0.8 * dragon_look.y); * Quaternion::rotation_x(0.8 * dragon_look.y);
next.head_upper.scale = Vec3::one(); next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new( next.head_lower.offset = Vec3::new(
@ -48,15 +48,11 @@ impl Animation for IdleAnimation {
skeleton_attr.head_lower.0, skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + ultra_slow * 0.20, skeleton_attr.head_lower.1 + ultra_slow * 0.20,
); );
next.head_lower.ori = next.head_lower.ori = Quaternion::rotation_z(0.8 * dragon_look.x)
Quaternion::rotation_z(0.8 * dragon_look.x) * Quaternion::rotation_x(-0.2+0.8 * dragon_look.y); * Quaternion::rotation_x(-0.2 + 0.8 * dragon_look.y);
next.head_lower.scale = Vec3::one() * 1.05; next.head_lower.scale = Vec3::one() * 1.05;
next.jaw.offset = Vec3::new( next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
0.0,
skeleton_attr.jaw.0,
skeleton_attr.jaw.1,
);
next.jaw.ori = Quaternion::rotation_x(slow * 0.05); next.jaw.ori = Quaternion::rotation_x(slow * 0.05);
next.jaw.scale = Vec3::one() * 0.98; next.jaw.scale = Vec3::one() * 0.98;
@ -68,21 +64,20 @@ impl Animation for IdleAnimation {
next.chest_front.ori = Quaternion::rotation_y(slow * 0.01); next.chest_front.ori = Quaternion::rotation_y(slow * 0.01);
next.chest_front.scale = Vec3::one() * 1.05; next.chest_front.scale = Vec3::one() * 1.05;
next.chest_rear.offset = Vec3::new( next.chest_rear.offset =
0.0, Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
skeleton_attr.chest_rear.0,
skeleton_attr.chest_rear.1,
);
next.chest_rear.ori = Quaternion::rotation_y(slow * 0.01); next.chest_rear.ori = Quaternion::rotation_y(slow * 0.01);
next.chest_rear.scale = Vec3::one() * 1.05; next.chest_rear.scale = Vec3::one() * 1.05;
next.tail_front.offset = Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1); next.tail_front.offset =
next.tail_front.ori = Quaternion::rotation_z(slowalt * 0.10)*Quaternion::rotation_x(0.1); Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.scale = Vec3::one()*0.98; next.tail_front.ori = Quaternion::rotation_z(slowalt * 0.10) * Quaternion::rotation_x(0.1);
next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.offset = Vec3::new(0.0, skeleton_attr.tail_rear.0, skeleton_attr.tail_rear.1); next.tail_rear.offset =
next.tail_rear.ori = Quaternion::rotation_z(slowalt * 0.12)*Quaternion::rotation_x(0.05); Vec3::new(0.0, skeleton_attr.tail_rear.0, skeleton_attr.tail_rear.1);
next.tail_rear.scale = Vec3::one()*0.98; next.tail_rear.ori = Quaternion::rotation_z(slowalt * 0.12) * Quaternion::rotation_x(0.05);
next.tail_rear.scale = Vec3::one() * 0.98;
next.wing_in_l.offset = Vec3::new( next.wing_in_l.offset = Vec3::new(
-skeleton_attr.wing_in.0, -skeleton_attr.wing_in.0,

View File

@ -8,6 +8,7 @@ pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
use super::{Bone, Skeleton}; use super::{Bone, Skeleton};
use crate::render::FigureBoneData; use crate::render::FigureBoneData;
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
use common::comp::{self}; use common::comp::{self};
use vek::Vec3; use vek::Vec3;
@ -66,6 +67,9 @@ const FEET_B_Z: f32 = 3.0;
======= =======
use common::comp::{self}; use common::comp::{self};
>>>>>>> Cleanup >>>>>>> Cleanup
=======
use common::comp::{self};
>>>>>>> fmt
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct DragonSkeleton { pub struct DragonSkeleton {
@ -134,15 +138,26 @@ impl Skeleton for DragonSkeleton {
[ [
FigureBoneData::new(chest_front_mat * head_lower_mat * head_upper_mat), FigureBoneData::new(chest_front_mat * head_lower_mat * head_upper_mat),
FigureBoneData::new(chest_front_mat * head_lower_mat), FigureBoneData::new(chest_front_mat * head_lower_mat),
FigureBoneData::new(chest_front_mat * head_lower_mat * head_upper_mat * self.jaw.compute_base_matrix()), FigureBoneData::new(
chest_front_mat * head_lower_mat * head_upper_mat * self.jaw.compute_base_matrix(),
),
FigureBoneData::new(chest_front_mat), FigureBoneData::new(chest_front_mat),
FigureBoneData::new(chest_front_mat * self.chest_rear.compute_base_matrix() ), FigureBoneData::new(chest_front_mat * self.chest_rear.compute_base_matrix()),
FigureBoneData::new(chest_front_mat * chest_rear_mat * tail_front_mat), FigureBoneData::new(chest_front_mat * chest_rear_mat * tail_front_mat),
FigureBoneData::new(chest_front_mat * chest_rear_mat * tail_front_mat * self.tail_rear.compute_base_matrix()), FigureBoneData::new(
chest_front_mat
* chest_rear_mat
* tail_front_mat
* self.tail_rear.compute_base_matrix(),
),
FigureBoneData::new(chest_front_mat * self.wing_in_l.compute_base_matrix()), FigureBoneData::new(chest_front_mat * self.wing_in_l.compute_base_matrix()),
FigureBoneData::new(chest_front_mat * self.wing_in_r.compute_base_matrix()), FigureBoneData::new(chest_front_mat * self.wing_in_r.compute_base_matrix()),
FigureBoneData::new(chest_front_mat * wing_in_l_mat * self.wing_out_l.compute_base_matrix()), FigureBoneData::new(
FigureBoneData::new(chest_front_mat * wing_in_r_mat * self.wing_out_r.compute_base_matrix()), chest_front_mat * wing_in_l_mat * self.wing_out_l.compute_base_matrix(),
),
FigureBoneData::new(
chest_front_mat * wing_in_r_mat * self.wing_out_r.compute_base_matrix(),
),
FigureBoneData::new(self.foot_fl.compute_base_matrix()), FigureBoneData::new(self.foot_fl.compute_base_matrix()),
FigureBoneData::new(self.foot_fr.compute_base_matrix()), FigureBoneData::new(self.foot_fr.compute_base_matrix()),
FigureBoneData::new(self.foot_bl.compute_base_matrix()), FigureBoneData::new(self.foot_bl.compute_base_matrix()),
@ -217,7 +232,7 @@ impl Default for SkeletonAttr {
} }
impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr { impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
fn from(body: &'a comp::dragon::Body) -> Self { fn from(body: &'a comp::dragon::Body) -> Self {
use comp::dragon::Species::*; use comp::dragon::Species::*;
Self { Self {
head_upper: match (body.species, body.body_type) { head_upper: match (body.species, body.body_type) {
@ -258,4 +273,4 @@ impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
}, },
} }
} }
} }

View File

@ -21,7 +21,7 @@ impl Animation for RunAnimation {
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos(); 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 = (anim_time as f32 * 4.5).sin();
let vertlf = (anim_time as f32 * lab as f32 + PI * 1.8).sin().max(0.15); 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 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 vertlboffset = (anim_time as f32 * lab as f32).sin().max(0.15);
@ -51,20 +51,14 @@ impl Animation for RunAnimation {
* 0.125, * 0.125,
); );
next.head_upper.offset = Vec3::new( next.head_upper.offset =
0.0, Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1,
);
next.head_upper.ori = next.head_upper.ori =
Quaternion::rotation_x(dragon_look.y) * Quaternion::rotation_z(dragon_look.x); Quaternion::rotation_x(dragon_look.y) * Quaternion::rotation_z(dragon_look.x);
next.head_upper.scale = Vec3::one(); next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new( next.head_lower.offset =
0.0, Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1,
);
next.head_lower.ori = Quaternion::rotation_x(wave_slow * 0.05); next.head_lower.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.head_lower.scale = Vec3::one(); next.head_lower.scale = Vec3::one();
@ -74,7 +68,7 @@ impl Animation for RunAnimation {
skeleton_attr.jaw.1 + wave_slow * 0.2, skeleton_attr.jaw.1 + wave_slow * 0.2,
); );
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05); next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.jaw.scale = Vec3::one()*0.98; next.jaw.scale = Vec3::one() * 0.98;
next.tail_front.offset = Vec3::new( next.tail_front.offset = Vec3::new(
0.0, 0.0,
@ -82,7 +76,7 @@ impl Animation for RunAnimation {
skeleton_attr.tail_front.1 + centeroffset * 0.6, skeleton_attr.tail_front.1 + centeroffset * 0.6,
); );
next.tail_front.ori = Quaternion::rotation_x(center * 0.03); next.tail_front.ori = Quaternion::rotation_x(center * 0.03);
next.tail_front.scale = Vec3::one()*0.98; next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.offset = Vec3::new( next.tail_rear.offset = Vec3::new(
0.0, 0.0,
@ -90,7 +84,7 @@ impl Animation for RunAnimation {
skeleton_attr.tail_rear.1 + centeroffset * 0.6, skeleton_attr.tail_rear.1 + centeroffset * 0.6,
); );
next.tail_rear.ori = Quaternion::rotation_x(center * 0.03); next.tail_rear.ori = Quaternion::rotation_x(center * 0.03);
next.tail_rear.scale = Vec3::one()*0.98; next.tail_rear.scale = Vec3::one() * 0.98;
next.chest_front.offset = Vec3::new( next.chest_front.offset = Vec3::new(
0.0, 0.0,
@ -100,11 +94,8 @@ impl Animation for RunAnimation {
next.chest_front.ori = Quaternion::rotation_y(horichest * -0.09); next.chest_front.ori = Quaternion::rotation_y(horichest * -0.09);
next.chest_front.scale = Vec3::one(); next.chest_front.scale = Vec3::one();
next.chest_rear.offset = Vec3::new( next.chest_rear.offset =
0.0, Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
skeleton_attr.chest_rear.0,
skeleton_attr.chest_rear.1,
);
next.chest_rear.ori = Quaternion::rotation_y(horichest * -0.09); next.chest_rear.ori = Quaternion::rotation_y(horichest * -0.09);
next.chest_rear.scale = Vec3::one(); next.chest_rear.scale = Vec3::one();

View File

@ -411,10 +411,8 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
None, None,
], ],
Body::Dragon(body) => { Body::Dragon(body) => {
let dragon_center_spec = let dragon_center_spec = DragonCenterSpec::load_watched(manifest_indicator);
DragonCenterSpec::load_watched(manifest_indicator); let dragon_lateral_spec = DragonLateralSpec::load_watched(manifest_indicator);
let dragon_lateral_spec =
DragonLateralSpec::load_watched(manifest_indicator);
[ [
Some(dragon_center_spec.mesh_head_upper( Some(dragon_center_spec.mesh_head_upper(
@ -427,11 +425,7 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
body.body_type, body.body_type,
generate_mesh, generate_mesh,
)), )),
Some(dragon_center_spec.mesh_jaw( Some(dragon_center_spec.mesh_jaw(body.species, body.body_type, generate_mesh)),
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_center_spec.mesh_chest_front( Some(dragon_center_spec.mesh_chest_front(
body.species, body.species,
body.body_type, body.body_type,

View File

@ -1925,8 +1925,7 @@ impl Asset for DragonLateralSpec {
impl DragonCenterSpec { impl DragonCenterSpec {
pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> {
assets::load_watched::<Self>("voxygen.voxel.dragon_center_manifest", indicator) assets::load_watched::<Self>("voxygen.voxel.dragon_center_manifest", indicator).unwrap()
.unwrap()
} }
pub fn mesh_head_upper( pub fn mesh_head_upper(
@ -2012,7 +2011,7 @@ impl DragonCenterSpec {
generate_mesh(&center, Vec3::from(spec.chest_front.offset)) generate_mesh(&center, Vec3::from(spec.chest_front.offset))
} }
pub fn mesh_chest_rear( pub fn mesh_chest_rear(
&self, &self,
species: DSpecies, species: DSpecies,
@ -2078,8 +2077,7 @@ impl DragonCenterSpec {
} }
impl DragonLateralSpec { impl DragonLateralSpec {
pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> {
assets::load_watched::<Self>("voxygen.voxel.dragon_lateral_manifest", indicator) assets::load_watched::<Self>("voxygen.voxel.dragon_lateral_manifest", indicator).unwrap()
.unwrap()
} }
pub fn mesh_wing_in_l( pub fn mesh_wing_in_l(