mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fmt
This commit is contained in:
parent
62bd79dba7
commit
cf392b5a66
@ -49,9 +49,7 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
|
||||
}
|
||||
}
|
||||
|
||||
pub const ALL_SPECIES: [Species; 1] = [
|
||||
Species::Reddragon,
|
||||
];
|
||||
pub const ALL_SPECIES: [Species; 1] = [Species::Reddragon];
|
||||
|
||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||
type Item = Species;
|
||||
|
@ -79,9 +79,7 @@ impl EntityInfo {
|
||||
Body::QuadrupedSmall(body) => {
|
||||
Some(get_npc_name(&NPC_NAMES.quadruped_small, body.species))
|
||||
},
|
||||
Body::Dragon(body) => {
|
||||
Some(get_npc_name(&NPC_NAMES.dragon, body.species))
|
||||
},
|
||||
Body::Dragon(body) => Some(get_npc_name(&NPC_NAMES.dragon, body.species)),
|
||||
_ => None,
|
||||
}
|
||||
.map(|s| {
|
||||
|
@ -1,108 +1,114 @@
|
||||
pub mod fly;
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod run;
|
||||
|
||||
// Reexports
|
||||
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
||||
pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
use crate::render::FigureBoneData;
|
||||
use common::comp::{self};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BipedLargeSkeleton {
|
||||
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,
|
||||
torso: Bone,
|
||||
#[derive(Clone, Default)]
|
||||
pub struct DragonSkeleton {
|
||||
head_upper: Bone,
|
||||
head_lower: Bone,
|
||||
jaw: 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 BipedLargeSkeleton {
|
||||
pub fn new() -> Self {
|
||||
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 DragonSkeleton {
|
||||
pub fn new() -> Self { Self::default() }
|
||||
}
|
||||
|
||||
impl Skeleton for BipedLargeSkeleton {
|
||||
impl Skeleton for DragonSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
fn bone_count(&self) -> usize { 11 }
|
||||
fn bone_count(&self) -> usize { 15 }
|
||||
|
||||
fn compute_matrices(&self) -> [FigureBoneData; 16] {
|
||||
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();
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
let head_upper_mat = self.head_upper.compute_base_matrix();
|
||||
let head_lower_mat = self.head_lower.compute_base_matrix();
|
||||
let chest_front_mat = self.chest_front.compute_base_matrix();
|
||||
let chest_rear_mat = self.chest_rear.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(torso_mat * upper_torso_mat * self.head.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * upper_torso_mat),
|
||||
FigureBoneData::new(chest_front_mat * head_lower_mat * head_upper_mat),
|
||||
FigureBoneData::new(chest_front_mat * head_lower_mat),
|
||||
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(torso_mat * upper_torso_mat * shoulder_r_mat),
|
||||
FigureBoneData::new(torso_mat * upper_torso_mat * self.hand_l.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * upper_torso_mat * self.hand_r.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * upper_torso_mat * leg_l_mat),
|
||||
FigureBoneData::new(torso_mat * upper_torso_mat * leg_r_mat),
|
||||
FigureBoneData::new(self.foot_l.compute_base_matrix()),
|
||||
FigureBoneData::new(self.foot_r.compute_base_matrix()),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::default(),
|
||||
FigureBoneData::new(chest_front_mat),
|
||||
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
|
||||
* 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_r.compute_base_matrix()),
|
||||
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(),
|
||||
]
|
||||
}
|
||||
|
||||
fn interpolate(&mut self, target: &Self, dt: f32) {
|
||||
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);
|
||||
self.torso.interpolate(&target.torso, dt);
|
||||
self.head_upper.interpolate(&target.head_upper, dt);
|
||||
self.head_lower.interpolate(&target.head_lower, dt);
|
||||
self.jaw.interpolate(&target.jaw, 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);
|
||||
}
|
||||
}
|
||||
|
||||
pub struct SkeletonAttr {
|
||||
head: (f32, f32),
|
||||
upper_torso: (f32, f32),
|
||||
lower_torso: (f32, f32),
|
||||
shoulder: (f32, f32, f32),
|
||||
hand: (f32, f32, f32),
|
||||
leg: (f32, f32, f32),
|
||||
foot: (f32, f32, f32),
|
||||
head_upper: (f32, f32),
|
||||
head_lower: (f32, f32),
|
||||
jaw: (f32, f32),
|
||||
chest_front: (f32, f32),
|
||||
chest_rear: (f32, f32),
|
||||
tail_front: (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 {
|
||||
@ -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> {
|
||||
match body {
|
||||
comp::Body::BipedLarge(body) => Ok(SkeletonAttr::from(body)),
|
||||
comp::Body::Dragon(body) => Ok(SkeletonAttr::from(body)),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
@ -119,41 +125,61 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
|
||||
impl Default for SkeletonAttr {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
head: (0.0, 0.0),
|
||||
upper_torso: (0.0, 0.0),
|
||||
lower_torso: (0.0, 0.0),
|
||||
shoulder: (0.0, 0.0, 0.0),
|
||||
hand: (0.0, 0.0, 0.0),
|
||||
leg: (0.0, 0.0, 0.0),
|
||||
foot: (0.0, 0.0, 0.0),
|
||||
head_upper: (0.0, 0.0),
|
||||
head_lower: (0.0, 0.0),
|
||||
jaw: (0.0, 0.0),
|
||||
chest_front: (0.0, 0.0),
|
||||
chest_rear: (0.0, 0.0),
|
||||
tail_front: (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 {
|
||||
fn from(body: &'a comp::biped_large::Body) -> Self {
|
||||
use comp::biped_large::Species::*;
|
||||
impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
|
||||
fn from(body: &'a comp::dragon::Body) -> Self {
|
||||
use comp::dragon::Species::*;
|
||||
Self {
|
||||
head: match (body.species, body.body_type) {
|
||||
(Ogre, _) => (3.0, 6.0),
|
||||
head_upper: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (2.5, 4.5),
|
||||
},
|
||||
upper_torso: match (body.species, body.body_type) {
|
||||
(Ogre, _) => (0.0, 19.0),
|
||||
head_lower: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (7.5, 3.5),
|
||||
},
|
||||
lower_torso: match (body.species, body.body_type) {
|
||||
(Ogre, _) => (1.0, -9.5),
|
||||
jaw: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (7.0, -5.0),
|
||||
},
|
||||
shoulder: match (body.species, body.body_type) {
|
||||
(Ogre, _) => (6.1, 0.5, 2.5),
|
||||
chest_front: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (0.0, 14.0),
|
||||
},
|
||||
hand: match (body.species, body.body_type) {
|
||||
(Ogre, _) => (10.5, -1.0, -0.5),
|
||||
chest_rear: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (-12.5, 0.0),
|
||||
},
|
||||
leg: match (body.species, body.body_type) {
|
||||
(Ogre, _) => (0.0, 0.0, -6.0),
|
||||
tail_front: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (-6.5, 1.5),
|
||||
},
|
||||
foot: match (body.species, body.body_type) {
|
||||
(Ogre, _) => (4.0, 0.5, 2.5),
|
||||
tail_rear: match (body.species, body.body_type) {
|
||||
(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),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -55,11 +55,7 @@ impl Animation for GlidingAnimation {
|
||||
0.0
|
||||
} * 0.8;
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-2.0 + skeleton_attr.head.0,
|
||||
skeleton_attr.head.1,
|
||||
);
|
||||
next.head.offset = Vec3::new(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)
|
||||
* Quaternion::rotation_z(head_look.x + slowa * 0.15);
|
||||
|
||||
|
@ -55,11 +55,7 @@ impl Animation for RollAnimation {
|
||||
next.chest.ori = Quaternion::rotation_x(wave_dub * 0.4);
|
||||
next.chest.scale = Vec3::one() * 1.01;
|
||||
|
||||
next.belt.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.belt.0 + 2.0,
|
||||
skeleton_attr.belt.1 + 2.0,
|
||||
);
|
||||
next.belt.offset = Vec3::new(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.shorts.offset = Vec3::new(
|
||||
|
@ -132,8 +132,7 @@ impl Animation for SwimAnimation {
|
||||
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.ori =
|
||||
Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05);
|
||||
next.torso.ori = Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
|
@ -64,7 +64,7 @@ impl Animation for FlyAnimation {
|
||||
skeleton_attr.tail_front.1 + centeroffset * 0.6,
|
||||
);
|
||||
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(
|
||||
0.0,
|
||||
@ -72,7 +72,7 @@ impl Animation for FlyAnimation {
|
||||
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
|
||||
);
|
||||
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(
|
||||
0.0,
|
||||
@ -82,11 +82,8 @@ impl Animation for FlyAnimation {
|
||||
next.chest_front.ori = Quaternion::rotation_y(center * 0.05);
|
||||
next.chest_front.scale = Vec3::one();
|
||||
|
||||
next.chest_rear.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest_rear.0,
|
||||
skeleton_attr.chest_rear.1,
|
||||
);
|
||||
next.chest_rear.offset =
|
||||
Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
|
||||
next.chest_rear.ori = Quaternion::rotation_y(center * 0.05);
|
||||
next.chest_rear.scale = Vec3::one();
|
||||
|
||||
|
@ -19,7 +19,7 @@ impl Animation for IdleAnimation {
|
||||
|
||||
let ultra_slow = (anim_time as f32 * 1.0).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(
|
||||
((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.1 + ultra_slow * 0.20,
|
||||
);
|
||||
next.head_upper.ori =
|
||||
Quaternion::rotation_z(0.8 * dragon_look.x) * Quaternion::rotation_x(0.8 * dragon_look.y);
|
||||
next.head_upper.ori = Quaternion::rotation_z(0.8 * dragon_look.x)
|
||||
* Quaternion::rotation_x(0.8 * dragon_look.y);
|
||||
next.head_upper.scale = Vec3::one();
|
||||
|
||||
next.head_lower.offset = Vec3::new(
|
||||
@ -48,15 +48,11 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.head_lower.0,
|
||||
skeleton_attr.head_lower.1 + ultra_slow * 0.20,
|
||||
);
|
||||
next.head_lower.ori =
|
||||
Quaternion::rotation_z(0.8 * dragon_look.x) * Quaternion::rotation_x(-0.2+0.8 * dragon_look.y);
|
||||
next.head_lower.ori = Quaternion::rotation_z(0.8 * dragon_look.x)
|
||||
* Quaternion::rotation_x(-0.2 + 0.8 * dragon_look.y);
|
||||
next.head_lower.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.jaw.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.jaw.0,
|
||||
skeleton_attr.jaw.1,
|
||||
);
|
||||
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
|
||||
next.jaw.ori = Quaternion::rotation_x(slow * 0.05);
|
||||
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.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.chest_rear.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest_rear.0,
|
||||
skeleton_attr.chest_rear.1,
|
||||
);
|
||||
next.chest_rear.offset =
|
||||
Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
|
||||
next.chest_rear.ori = Quaternion::rotation_y(slow * 0.01);
|
||||
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.ori = Quaternion::rotation_z(slowalt * 0.10)*Quaternion::rotation_x(0.1);
|
||||
next.tail_front.scale = Vec3::one()*0.98;
|
||||
next.tail_front.offset =
|
||||
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
|
||||
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.ori = Quaternion::rotation_z(slowalt * 0.12)*Quaternion::rotation_x(0.05);
|
||||
next.tail_rear.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.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(
|
||||
-skeleton_attr.wing_in.0,
|
||||
|
@ -8,6 +8,7 @@ pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
|
||||
use super::{Bone, Skeleton};
|
||||
use crate::render::FigureBoneData;
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
use common::comp::{self};
|
||||
use vek::Vec3;
|
||||
|
||||
@ -66,6 +67,9 @@ const FEET_B_Z: f32 = 3.0;
|
||||
=======
|
||||
use common::comp::{self};
|
||||
>>>>>>> Cleanup
|
||||
=======
|
||||
use common::comp::{self};
|
||||
>>>>>>> fmt
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
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),
|
||||
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 * 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 * 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_r.compute_base_matrix()),
|
||||
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(
|
||||
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()),
|
||||
@ -217,7 +232,7 @@ impl Default 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::*;
|
||||
Self {
|
||||
head_upper: match (body.species, body.body_type) {
|
||||
@ -258,4 +273,4 @@ impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ impl Animation for RunAnimation {
|
||||
|
||||
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
|
||||
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 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);
|
||||
@ -51,20 +51,14 @@ impl Animation for RunAnimation {
|
||||
* 0.125,
|
||||
);
|
||||
|
||||
next.head_upper.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.head_upper.0,
|
||||
skeleton_attr.head_upper.1,
|
||||
);
|
||||
next.head_upper.offset =
|
||||
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
|
||||
next.head_upper.ori =
|
||||
Quaternion::rotation_x(dragon_look.y) * Quaternion::rotation_z(dragon_look.x);
|
||||
next.head_upper.scale = Vec3::one();
|
||||
|
||||
next.head_lower.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.head_lower.0,
|
||||
skeleton_attr.head_lower.1,
|
||||
);
|
||||
next.head_lower.offset =
|
||||
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
|
||||
next.head_lower.ori = Quaternion::rotation_x(wave_slow * 0.05);
|
||||
next.head_lower.scale = Vec3::one();
|
||||
|
||||
@ -74,7 +68,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.jaw.1 + wave_slow * 0.2,
|
||||
);
|
||||
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(
|
||||
0.0,
|
||||
@ -82,7 +76,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.tail_front.1 + centeroffset * 0.6,
|
||||
);
|
||||
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(
|
||||
0.0,
|
||||
@ -90,7 +84,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
|
||||
);
|
||||
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(
|
||||
0.0,
|
||||
@ -100,11 +94,8 @@ impl Animation for RunAnimation {
|
||||
next.chest_front.ori = Quaternion::rotation_y(horichest * -0.09);
|
||||
next.chest_front.scale = Vec3::one();
|
||||
|
||||
next.chest_rear.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest_rear.0,
|
||||
skeleton_attr.chest_rear.1,
|
||||
);
|
||||
next.chest_rear.offset =
|
||||
Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
|
||||
next.chest_rear.ori = Quaternion::rotation_y(horichest * -0.09);
|
||||
next.chest_rear.scale = Vec3::one();
|
||||
|
||||
|
@ -411,10 +411,8 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
None,
|
||||
],
|
||||
Body::Dragon(body) => {
|
||||
let dragon_center_spec =
|
||||
DragonCenterSpec::load_watched(manifest_indicator);
|
||||
let dragon_lateral_spec =
|
||||
DragonLateralSpec::load_watched(manifest_indicator);
|
||||
let dragon_center_spec = DragonCenterSpec::load_watched(manifest_indicator);
|
||||
let dragon_lateral_spec = DragonLateralSpec::load_watched(manifest_indicator);
|
||||
|
||||
[
|
||||
Some(dragon_center_spec.mesh_head_upper(
|
||||
@ -427,11 +425,7 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
|
||||
body.body_type,
|
||||
generate_mesh,
|
||||
)),
|
||||
Some(dragon_center_spec.mesh_jaw(
|
||||
body.species,
|
||||
body.body_type,
|
||||
generate_mesh,
|
||||
)),
|
||||
Some(dragon_center_spec.mesh_jaw(body.species, body.body_type, generate_mesh)),
|
||||
Some(dragon_center_spec.mesh_chest_front(
|
||||
body.species,
|
||||
body.body_type,
|
||||
|
@ -1925,8 +1925,7 @@ impl Asset for DragonLateralSpec {
|
||||
|
||||
impl DragonCenterSpec {
|
||||
pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> {
|
||||
assets::load_watched::<Self>("voxygen.voxel.dragon_center_manifest", indicator)
|
||||
.unwrap()
|
||||
assets::load_watched::<Self>("voxygen.voxel.dragon_center_manifest", indicator).unwrap()
|
||||
}
|
||||
|
||||
pub fn mesh_head_upper(
|
||||
@ -2012,7 +2011,7 @@ impl DragonCenterSpec {
|
||||
|
||||
generate_mesh(¢er, Vec3::from(spec.chest_front.offset))
|
||||
}
|
||||
|
||||
|
||||
pub fn mesh_chest_rear(
|
||||
&self,
|
||||
species: DSpecies,
|
||||
@ -2078,8 +2077,7 @@ impl DragonCenterSpec {
|
||||
}
|
||||
impl DragonLateralSpec {
|
||||
pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> {
|
||||
assets::load_watched::<Self>("voxygen.voxel.dragon_lateral_manifest", indicator)
|
||||
.unwrap()
|
||||
assets::load_watched::<Self>("voxygen.voxel.dragon_lateral_manifest", indicator).unwrap()
|
||||
}
|
||||
|
||||
pub fn mesh_wing_in_l(
|
||||
|
Loading…
Reference in New Issue
Block a user