Merge branch 'snowram/dragon-animation' into 'master'

dragon

See merge request veloren/veloren!969
This commit is contained in:
Justin Shipsey 2020-05-10 18:39:29 +00:00
commit 78f3f2cc32
98 changed files with 1458 additions and 702 deletions

View File

@ -64,7 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added non-uniform block heights
- Added `/sudo` command
- Added a Level of Detail (LoD) system for terrain sprites and entities
- Added owl, hyena, parrot npcs
- Added owl, hyena, parrot, cockatrice, red dragon npcs
- Added dungeon entrances
- Villagers tools and clothing
- Cultists clothing

View File

@ -475,6 +475,10 @@
"parrot": {
"keyword": "parrot",
"generic": "Parrot"
},
"cockatrice": {
"keyword": "cockatrice",
"generic": "Cockatrice"
}
}
},
@ -539,5 +543,19 @@
"generic": "Fungome"
}
}
},
"dragon": {
"body": {
"keyword": "dragon",
"names": [
"Smaug"
]
},
"species": {
"reddragon": {
"keyword": "reddragon",
"generic": "Reddragon"
}
}
}
}

View File

@ -25,11 +25,11 @@
lateral: ("npc.ogre.male.leg_r"),
),
foot_l: (
offset: (-3.0, -5.0, -3.0),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.male.foot_l"),
),
foot_r: (
offset: (-3.0, -5.0, -3.0),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.male.foot_r"),
)
),
@ -59,11 +59,11 @@
lateral: ("npc.ogre.female.leg_r"),
),
foot_l: (
offset: (-3.0, -5.0, -3.0),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.female.foot_l"),
),
foot_r: (
offset: (-3.0, -5.0, -3.0),
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.female.foot_r"),
)
),

View File

@ -195,4 +195,32 @@
center: ("npc.parrot.female.tail"),
)
),
(Cockatrice, Male): (
head: (
offset: (-2.5, -3.5, -8.0),
center: ("npc.cockatrice.male.head"),
),
torso: (
offset: (-3.5, -6.5, -7.5),
center: ("npc.cockatrice.male.torso"),
),
tail: (
offset: (-1.5, -3.5, -4.0),
center: ("npc.cockatrice.male.tail"),
)
),
(Cockatrice, Female): (
head: (
offset: (-2.5, -3.5, -8.0),
center: ("npc.cockatrice.female.head"),
),
torso: (
offset: (-3.5, -6.5, -7.5),
center: ("npc.cockatrice.female.torso"),
),
tail: (
offset: (-1.5, -3.5, -4.0),
center: ("npc.cockatrice.female.tail"),
)
),
})

View File

@ -251,4 +251,40 @@
lateral: ("npc.parrot.female.leg_r"),
)
),
(Cockatrice, Male): (
wing_l: (
offset: (-2.0, -3.0, -9.0),
lateral: ("npc.cockatrice.male.wing_l"),
),
wing_r: (
offset: (-2.0, -3.0, -9.0),
lateral: ("npc.cockatrice.male.wing_r"),
),
foot_l: (
offset: (-2.5, 0.0, -12.0),
lateral: ("npc.cockatrice.male.leg_l"),
),
foot_r: (
offset: (-2.5, 0.0, -12.0),
lateral: ("npc.cockatrice.male.leg_r"),
)
),
(Cockatrice, Female): (
wing_l: (
offset: (-2.0, -3.0, -9.0),
lateral: ("npc.cockatrice.female.wing_l"),
),
wing_r: (
offset: (-2.0, -3.0, -9.0),
lateral: ("npc.cockatrice.female.wing_r"),
),
foot_l: (
offset: (-2.5, 0.0, -12.0),
lateral: ("npc.cockatrice.female.leg_l"),
),
foot_r: (
offset: (-2.5, 0.0, -12.0),
lateral: ("npc.cockatrice.female.leg_r"),
)
),
})

View File

@ -0,0 +1,62 @@
({
(Reddragon, Male): (
upper: (
offset: (-6.5, -2.0, -6.0),
center: ("npc.reddragon.male.head_upper"),
),
lower: (
offset: (-2.5, -2.0, -5.0),
center: ("npc.reddragon.male.head_lower"),
),
jaw: (
offset: (-3.5, -2.0, -1.5),
center: ("npc.reddragon.male.jaw"),
),
chest_front: (
offset: (-6.5, -6.0, -7.5),
center: ("npc.reddragon.male.chest_front"),
),
chest_rear: (
offset: (-6.5, -7.0, -7.0),
center: ("npc.reddragon.male.chest_rear"),
),
tail_front: (
offset: (-2.5, -12.0, -3.5),
center: ("npc.reddragon.male.tail_front"),
),
tail_rear: (
offset: (-3.5, -16.0, -3.0),
center: ("npc.reddragon.male.tail_rear"),
)
),
(Reddragon, Female): (
upper: (
offset: (-6.5, -2.0, -6.0),
center: ("npc.reddragon.female.head_upper"),
),
lower: (
offset: (-2.5, -2.0, -5.0),
center: ("npc.reddragon.female.head_lower"),
),
jaw: (
offset: (-3.5, -2.0, -1.5),
center: ("npc.reddragon.female.jaw"),
),
chest_front: (
offset: (-6.5, -6.0, -7.5),
center: ("npc.reddragon.female.chest_front"),
),
chest_rear: (
offset: (-6.5, -7.0, -7.0),
center: ("npc.reddragon.female.chest_rear"),
),
tail_front: (
offset: (-2.5, -12.0, -3.5),
center: ("npc.reddragon.female.tail_front"),
),
tail_rear: (
offset: (-3.5, -16.0, -3.0),
center: ("npc.reddragon.female.tail_rear"),
)
),
})

View File

@ -0,0 +1,70 @@
({
(Reddragon, Male): (
wing_in_l: (
offset: (-24.0, -3.0, 0.0),
lateral: ("npc.reddragon.male.wing_in_l"),
),
wing_in_r: (
offset: (0.0, -3.0, 0.0),
lateral: ("npc.reddragon.male.wing_in_r"),
),
wing_out_l: (
offset: (-29.0, -3.0, -4.0),
lateral: ("npc.reddragon.male.wing_out_l"),
),
wing_out_r: (
offset: (0.0, -3.0, -4.0),
lateral: ("npc.reddragon.male.wing_out_r"),
),
foot_fl: (
offset: (-5.5, -4.0, -1.5),
lateral: ("npc.reddragon.male.foot_fl"),
),
foot_fr: (
offset: (-5.5, -4.0, -1.5),
lateral: ("npc.reddragon.male.foot_fr"),
),
foot_bl: (
offset: (-5.5, -4.0, -3.0),
lateral: ("npc.reddragon.male.foot_bl"),
),
foot_br: (
offset: (-5.5, -4.0, -3.0),
lateral: ("npc.reddragon.male.foot_br"),
)
),
(Reddragon, Female): (
wing_in_l: (
offset: (-24.0, -3.0, 0.0),
lateral: ("npc.reddragon.female.wing_in_l"),
),
wing_in_r: (
offset: (0.0, -3.0, 0.0),
lateral: ("npc.reddragon.female.wing_in_r"),
),
wing_out_l: (
offset: (-29.0, -3.0, -4.0),
lateral: ("npc.reddragon.female.wing_out_l"),
),
wing_out_r: (
offset: (0.0, -3.0, -4.0),
lateral: ("npc.reddragon.female.wing_out_r"),
),
foot_fl: (
offset: (-5.5, -4.0, -1.5),
lateral: ("npc.reddragon.female.foot_fl"),
),
foot_fr: (
offset: (-5.5, -4.0, -1.5),
lateral: ("npc.reddragon.female.foot_fr"),
),
foot_bl: (
offset: (-5.5, -4.0, -3.0),
lateral: ("npc.reddragon.female.foot_bl"),
),
foot_br: (
offset: (-5.5, -4.0, -3.0),
lateral: ("npc.reddragon.female.foot_br"),
)
),
})

BIN
assets/voxygen/voxel/npc/cockatrice/female/head.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/female/leg_l.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/female/leg_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/female/tail.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/female/torso.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/female/wing_l.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/female/wing_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/male/head.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/male/leg_l.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/male/leg_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/male/tail.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/male/torso.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/male/wing_l.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/cockatrice/male/wing_r.vox (Stored with Git LFS) Normal file

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.

BIN
assets/voxygen/voxel/npc/dragon/head.vox (Stored with Git LFS)

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/chest_front.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/chest_rear.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/foot_bl.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/foot_br.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/foot_fl.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/foot_fr.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/head_lower.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/head_upper.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/jaw.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/tail_front.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/tail_rear.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/wing_in_l.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/wing_in_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/wing_out_l.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/female/wing_out_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/chest_front.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/chest_rear.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/foot_bl.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/foot_br.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/foot_fl.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/foot_fr.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/head_lower.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/head_upper.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/jaw.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/tail_front.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/tail_rear.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/wing_in_l.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/wing_in_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/wing_out_l.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/npc/reddragon/male/wing_out_r.vox (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -60,6 +60,7 @@ pub struct AllBodies<BodyMeta, SpeciesMeta> {
pub biped_large: BodyData<BodyMeta, biped_large::AllSpecies<SpeciesMeta>>,
pub golem: BodyData<BodyMeta, golem::AllSpecies<SpeciesMeta>>,
pub critter: BodyData<BodyMeta, critter::AllSpecies<SpeciesMeta>>,
pub dragon: BodyData<BodyMeta, dragon::AllSpecies<SpeciesMeta>>,
}
/// Can only retrieve body metadata by direct index.
@ -76,6 +77,7 @@ impl<BodyMeta, SpeciesMeta> core::ops::Index<NpcKind> for AllBodies<BodyMeta, Sp
NpcKind::Ogre => &self.biped_large.body,
NpcKind::StoneGolem => &self.golem.body,
NpcKind::Rat => &self.critter.body,
NpcKind::Reddragon => &self.dragon.body,
}
}
}

View File

@ -34,6 +34,7 @@ pub enum Species {
Eagle = 4,
Snowyowl = 5,
Parrot = 6,
Cockatrice = 7,
}
/// Data representing per-species generic data.
@ -48,6 +49,7 @@ pub struct AllSpecies<SpeciesMeta> {
pub eagle: SpeciesMeta,
pub snowyowl: SpeciesMeta,
pub parrot: SpeciesMeta,
pub cockatrice: SpeciesMeta,
}
impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta> {
@ -63,11 +65,12 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
Species::Eagle => &self.eagle,
Species::Snowyowl => &self.snowyowl,
Species::Parrot => &self.parrot,
Species::Cockatrice => &self.cockatrice,
}
}
}
pub const ALL_SPECIES: [Species; 7] = [
pub const ALL_SPECIES: [Species; 8] = [
Species::Duck,
Species::Chicken,
Species::Goose,
@ -75,6 +78,7 @@ pub const ALL_SPECIES: [Species; 7] = [
Species::Eagle,
Species::Snowyowl,
Species::Parrot,
Species::Cockatrice,
];
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {

View File

@ -2,128 +2,67 @@ use rand::{seq::SliceRandom, thread_rng};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Body {
pub head: Head,
pub chest_front: ChestFront,
pub chest_rear: ChestRear,
pub tail_front: TailFront,
pub tail_rear: TailRear,
pub wing_in_l: WingInL,
pub wing_in_r: WingInR,
pub wing_out_l: WingOutL,
pub wing_out_r: WingOutR,
pub foot_fl: FootFL,
pub foot_fr: FootFR,
pub foot_bl: FootBL,
pub foot_br: FootBR,
pub species: Species,
pub body_type: BodyType,
}
impl Body {
pub fn random() -> Self {
let mut rng = thread_rng();
Self {
head: *(&ALL_HEADS).choose(&mut rng).unwrap(),
chest_front: *(&ALL_CHEST_FRONTS).choose(&mut rng).unwrap(),
chest_rear: *(&ALL_CHEST_REARS).choose(&mut rng).unwrap(),
tail_front: *(&ALL_TAIL_FRONTS).choose(&mut rng).unwrap(),
tail_rear: *(&ALL_TAIL_REARS).choose(&mut rng).unwrap(),
wing_in_l: *(&ALL_WING_IN_LS).choose(&mut rng).unwrap(),
wing_in_r: *(&ALL_WING_IN_RS).choose(&mut rng).unwrap(),
wing_out_l: *(&ALL_WING_OUT_LS).choose(&mut rng).unwrap(),
wing_out_r: *(&ALL_WING_OUT_RS).choose(&mut rng).unwrap(),
foot_fl: *(&ALL_FOOT_FLS).choose(&mut rng).unwrap(),
foot_fr: *(&ALL_FOOT_FRS).choose(&mut rng).unwrap(),
foot_bl: *(&ALL_FOOT_BLS).choose(&mut rng).unwrap(),
foot_br: *(&ALL_FOOT_BRS).choose(&mut rng).unwrap(),
let species = *(&ALL_SPECIES).choose(&mut rng).unwrap();
Self::random_with(&mut rng, &species)
}
#[inline]
pub fn random_with(rng: &mut impl rand::Rng, &species: &Species) -> Self {
let body_type = *(&ALL_BODY_TYPES).choose(rng).unwrap();
Self { species, body_type }
}
}
impl From<Body> for super::Body {
fn from(body: Body) -> Self { super::Body::Dragon(body) }
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Species {
Reddragon = 0,
}
/// Data representing per-species generic data.
///
/// NOTE: Deliberately don't (yet?) implement serialize.
#[derive(Clone, Debug, Deserialize)]
pub struct AllSpecies<SpeciesMeta> {
pub reddragon: SpeciesMeta,
}
impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta> {
type Output = SpeciesMeta;
#[inline]
fn index(&self, &index: &'a Species) -> &Self::Output {
match index {
Species::Reddragon => &self.reddragon,
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum Head {
Default,
pub const ALL_SPECIES: [Species; 1] = [Species::Reddragon];
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
type Item = Species;
type IntoIter = impl Iterator<Item = Self::Item>;
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
}
const ALL_HEADS: [Head; 1] = [Head::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum ChestFront {
Default,
pub enum BodyType {
Female = 0,
Male = 1,
}
const ALL_CHEST_FRONTS: [ChestFront; 1] = [ChestFront::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum ChestRear {
Default,
}
const ALL_CHEST_REARS: [ChestRear; 1] = [ChestRear::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum TailFront {
Default,
}
const ALL_TAIL_FRONTS: [TailFront; 1] = [TailFront::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum TailRear {
Default,
}
const ALL_TAIL_REARS: [TailRear; 1] = [TailRear::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingInL {
Default,
}
const ALL_WING_IN_LS: [WingInL; 1] = [WingInL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingInR {
Default,
}
const ALL_WING_IN_RS: [WingInR; 1] = [WingInR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingOutL {
Default,
}
const ALL_WING_OUT_LS: [WingOutL; 1] = [WingOutL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum WingOutR {
Default,
}
const ALL_WING_OUT_RS: [WingOutR; 1] = [WingOutR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootFL {
Default,
}
const ALL_FOOT_FLS: [FootFL; 1] = [FootFL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootFR {
Default,
}
const ALL_FOOT_FRS: [FootFR; 1] = [FootFR::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootBL {
Default,
}
const ALL_FOOT_BLS: [FootBL; 1] = [FootBL::Default];
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[repr(u32)]
pub enum FootBR {
Default,
}
const ALL_FOOT_BRS: [FootBR; 1] = [FootBR::Default];
pub const ALL_BODY_TYPES: [BodyType; 2] = [BodyType::Female, BodyType::Male];

View File

@ -79,6 +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)),
_ => None,
}
.map(|s| {

View File

@ -15,9 +15,10 @@ pub enum NpcKind {
Ogre,
Rat,
StoneGolem,
Reddragon,
}
pub const ALL_NPCS: [NpcKind; 7] = [
pub const ALL_NPCS: [NpcKind; 8] = [
NpcKind::Humanoid,
NpcKind::Wolf,
NpcKind::Pig,
@ -25,6 +26,7 @@ pub const ALL_NPCS: [NpcKind; 7] = [
NpcKind::Ogre,
NpcKind::Rat,
NpcKind::StoneGolem,
NpcKind::Reddragon,
];
/// Body-specific NPC name metadata.
@ -91,6 +93,7 @@ pub fn kind_to_body(kind: NpcKind) -> Body {
NpcKind::Ogre => comp::biped_large::Body::random().into(),
NpcKind::Rat => comp::critter::Body::random().into(),
NpcKind::StoneGolem => comp::golem::Body::random().into(),
NpcKind::Reddragon => comp::dragon::Body::random().into(),
}
}
@ -212,6 +215,14 @@ impl NpcBody {
comp::golem::Body::random_with,
)
})
.or_else(|| {
parse(
s,
NpcKind::Reddragon,
&npc_names.dragon,
comp::dragon::Body::random_with,
)
})
.ok_or(())
}
}

View File

@ -10,7 +10,7 @@ use crate::render::FigureBoneData;
use common::comp::{self};
use vek::Vec3;
#[derive(Clone)]
#[derive(Clone, Default)]
pub struct BipedLargeSkeleton {
head: Bone,
upper_torso: Bone,
@ -27,22 +27,7 @@ pub struct BipedLargeSkeleton {
}
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(),
}
}
pub fn new() -> Self { Self::default() }
}
impl Skeleton for BipedLargeSkeleton {
@ -57,7 +42,6 @@ impl Skeleton for BipedLargeSkeleton {
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();
(
[
FigureBoneData::new(torso_mat * upper_torso_mat * self.head.compute_base_matrix()),
@ -146,7 +130,7 @@ impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
(Ogre, _) => (3.0, 6.0),
},
upper_torso: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 20.0),
(Ogre, _) => (0.0, 19.0),
},
lower_torso: match (body.species, body.body_type) {
(Ogre, _) => (1.0, -9.5),
@ -155,7 +139,7 @@ impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
(Ogre, _) => (6.1, 0.5, 2.5),
},
hand: match (body.species, body.body_type) {
(Ogre, _) => (10.5, -1.0, 0.5),
(Ogre, _) => (10.5, -1.0, -0.5),
},
leg: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 0.0, -6.0),

View File

@ -41,7 +41,7 @@ impl Animation for RunAnimation {
* ((anim_time as f32 * lab as f32 + PI * 0.4).sin());
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.ori = Quaternion::rotation_z(belt * -0.3) * Quaternion::rotation_x(0.3);
next.head.ori = Quaternion::rotation_z(belt * -0.3) * Quaternion::rotation_x(0.1);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.offset = Vec3::new(
@ -132,7 +132,7 @@ impl Animation for RunAnimation {
next.foot_r.scale = Vec3::one() / 8.0 * 0.98;
next.torso.offset = Vec3::new(0.0, 0.0, beltsnap * 0.25);
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.2);
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.13);
next.torso.scale = Vec3::one();
next
}

View File

@ -110,6 +110,7 @@ impl<'a> From<&'a comp::bird_medium::Body> for SkeletonAttr {
(Eagle, _) => (2.5, 5.0),
(Snowyowl, _) => (2.5, 5.0),
(Parrot, _) => (0.5, 4.5),
(Cockatrice, _) => (3.0, 4.0),
},
chest: match (body.species, body.body_type) {
(Duck, _) => (0.0, 5.0),
@ -119,6 +120,7 @@ impl<'a> From<&'a comp::bird_medium::Body> for SkeletonAttr {
(Eagle, _) => (0.0, 8.0),
(Snowyowl, _) => (0.0, 4.5),
(Parrot, _) => (0.0, 5.0),
(Cockatrice, _) => (0.0, 12.5),
},
tail: match (body.species, body.body_type) {
(Duck, _) => (-3.0, 1.5),
@ -128,6 +130,7 @@ impl<'a> From<&'a comp::bird_medium::Body> for SkeletonAttr {
(Eagle, _) => (-8.0, -4.0),
(Snowyowl, _) => (-6.0, -2.0),
(Parrot, _) => (-8.0, -2.0),
(Cockatrice, _) => (-10.0, -2.5),
},
wing: match (body.species, body.body_type) {
(Duck, _) => (2.75, 0.0, 1.0),
@ -137,6 +140,7 @@ impl<'a> From<&'a comp::bird_medium::Body> for SkeletonAttr {
(Eagle, _) => (3.0, -8.0, 4.0),
(Snowyowl, _) => (3.5, -5.5, 4.0),
(Parrot, _) => (2.0, -4.5, 3.0),
(Cockatrice, _) => (4.5, -2.5, 1.5),
},
foot: match (body.species, body.body_type) {
(Duck, _) => (2.0, -1.5, 4.0),
@ -146,6 +150,7 @@ impl<'a> From<&'a comp::bird_medium::Body> for SkeletonAttr {
(Eagle, _) => (2.0, -2.0, 8.0),
(Snowyowl, _) => (1.5, -2.5, 7.0),
(Parrot, _) => (1.5, -3.0, 3.0),
(Cockatrice, _) => (4.0, -3.5, 12.0),
},
}
}

View File

@ -68,11 +68,9 @@ impl Animation for AlphaAnimation {
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori = next.chest.ori * -0.3;
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = next.chest.ori * -0.45;
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-0.25, -5.0, 1.0);
next.l_hand.ori = Quaternion::rotation_x(1.27);
@ -84,7 +82,6 @@ impl Animation for AlphaAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-10.0 + push * 5.0, 6.0 + push * 5.0, 2.0);
next.control.ori = Quaternion::rotation_x(-1.4 + slow * 0.4)
@ -130,11 +127,9 @@ impl Animation for AlphaAnimation {
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = next.chest.ori * -0.2;
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = next.chest.ori * -0.15;
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-4.0, 3.0, 2.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
@ -150,7 +145,6 @@ impl Animation for AlphaAnimation {
next.main.ori = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(-0.8);
next.main.scale = Vec3::one();
next.lantern.ori = Quaternion::rotation_x(slowax * -0.7 + 0.4)
* Quaternion::rotation_y(slowax * 0.4);
@ -174,10 +168,7 @@ impl Animation for AlphaAnimation {
next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.main.ori = Quaternion::rotation_x(-0.3);
next.head.offset =
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.head.ori = Quaternion::rotation_z(slower * 0.05)
@ -189,23 +180,18 @@ impl Animation for AlphaAnimation {
next.chest.ori = Quaternion::rotation_z(slower * 0.2)
* Quaternion::rotation_x(0.0 + slower * 0.2)
* Quaternion::rotation_y(slower * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = next.chest.ori * -0.2;
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = next.chest.ori * -0.15;
next.shorts.scale = Vec3::one();
next.lantern.ori = Quaternion::rotation_x(slower * -0.7 + 0.4)
* Quaternion::rotation_y(slower * 0.4);
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
if velocity > 0.5 {
@ -232,9 +218,7 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_z((slower * 0.5).max(0.0));
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
}
@ -245,9 +229,7 @@ impl Animation for AlphaAnimation {
next.control.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
},
Some(ToolKind::Staff(_)) => {
@ -272,7 +254,6 @@ impl Animation for AlphaAnimation {
next.shorts.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.05;
@ -281,7 +262,6 @@ impl Animation for AlphaAnimation {
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -4.0);
next.main.ori = Quaternion::rotation_x(-0.3);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0 - slow * 1.0, 3.0 - slow * 5.0, 0.0);
next.control.ori = Quaternion::rotation_x(-1.2)
@ -306,19 +286,16 @@ impl Animation for AlphaAnimation {
next.chest.ori = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
@ -337,7 +314,6 @@ impl Animation for AlphaAnimation {
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
},
@ -358,15 +334,15 @@ impl Animation for AlphaAnimation {
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
* Quaternion::rotation_x(accel_med * -0.8)
* Quaternion::rotation_y(accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
* Quaternion::rotation_x(accel_med * -0.8)
* Quaternion::rotation_y(accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
@ -386,17 +362,11 @@ impl Animation for AlphaAnimation {
skeleton_attr.lantern.2,
);
next.lantern.scale = Vec3::one() * 0.65;
next.l_shoulder.scale = Vec3::one() * 1.1;
next.r_shoulder.scale = Vec3::one() * 1.1;
next.glider.offset = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.l_control.scale = Vec3::one();
next.r_control.scale = Vec3::one();
next
}

View File

@ -52,19 +52,16 @@ impl Animation for BetaAnimation {
next.chest.ori = Quaternion::rotation_z(slow * 0.2)
* Quaternion::rotation_x(slow * 0.2)
* Quaternion::rotation_y(slow * -0.1);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.04);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.05);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(1.27);
@ -74,7 +71,6 @@ impl Animation for BetaAnimation {
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
next.main.ori = Quaternion::rotation_x(-0.3);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0 + slow * 1.5, 1.5 + slow * 1.0, 0.0);
next.control.ori = Quaternion::rotation_x(-1.4)
@ -84,12 +80,10 @@ impl Animation for BetaAnimation {
next.l_foot.offset = Vec3::new(-3.4, footquick * -9.5, 8.0);
next.l_foot.ori = Quaternion::rotation_x(footquick * 0.3)
* Quaternion::rotation_y(footquick * -0.6);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, footquick * 9.5, 8.0);
next.r_foot.ori = Quaternion::rotation_x(footquick * -0.3)
* Quaternion::rotation_y(footquick * 0.2);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
},
@ -97,7 +91,7 @@ impl Animation for BetaAnimation {
}
next.l_shoulder.offset = Vec3::new(
skeleton_attr.shoulder.0,
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);

View File

@ -58,18 +58,13 @@ impl Animation for ChargeAnimation {
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.ori = Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.chest.scale = Vec3::one();
next.chest.ori = Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02);
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori = Quaternion::rotation_z(stop * -0.5);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_z(stop * -0.7);
next.shorts.scale = Vec3::one();
match active_tool_kind {
//TODO: Inventory
@ -86,7 +81,6 @@ impl Animation for ChargeAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(
-7.0 + quick * 3.5 * (1.0 / (stopa + 0.1)),
@ -112,7 +106,6 @@ impl Animation for ChargeAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-9.0 + stop * 13.0, 6.0 + stop * 4.0, 8.0);
next.control.ori = Quaternion::rotation_x(0.0)
@ -127,19 +120,15 @@ impl Animation for ChargeAnimation {
next.l_foot.ori = Quaternion::rotation_x(foote * -0.1)
* Quaternion::rotation_z(0.4)
* Quaternion::rotation_y(0.15);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4 + foot * 1.5, foote * -1.5, 8.0);
next.r_foot.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_z(0.4)
* Quaternion::rotation_y(0.0);
next.r_foot.scale = Vec3::one();
next.torso.offset =
Vec3::new(0.0 + foot * 0.03, foote * 0.05, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
} else {
next.l_foot.offset = Vec3::new(-3.4, -2.5 + stop * -1.3, 8.0);
@ -153,9 +142,7 @@ impl Animation for ChargeAnimation {
Quaternion::rotation_x(stop * 0.1) * Quaternion::rotation_z(stop * 0.1);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
}
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);

View File

@ -72,7 +72,7 @@ impl Animation for ClimbAnimation {
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
skeleton_attr.hand.0,
-skeleton_attr.hand.0,
skeleton_attr.hand.1 + quicka * 1.5,
skeleton_attr.hand.2 - quick * 4.0,
);

View File

@ -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,
-2.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);
@ -72,10 +68,10 @@ impl Animation for GlidingAnimation {
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_z(slowa * 0.35);
next.l_hand.offset = Vec3::new(-9.5 + slowa * -1.5, -3.0 + slowa * 1.5, 6.0);
next.l_hand.offset = Vec3::new(-9.5 + slowa * -1.5, -3.0 + slowa * 1.5, 8.0);
next.l_hand.ori = Quaternion::rotation_x(-2.7 + slowa * -0.1);
next.r_hand.offset = Vec3::new(9.5 + slowa * -1.5, -3.0 + slowa * -1.5, 6.0);
next.r_hand.offset = Vec3::new(9.5 + slowa * -1.5, -3.0 + slowa * -1.5, 8.0);
next.r_hand.ori = Quaternion::rotation_x(-2.7 + slowa * -0.10);
next.l_foot.offset = Vec3::new(
@ -112,8 +108,8 @@ impl Animation for GlidingAnimation {
);
next.r_shoulder.scale = Vec3::one() * 1.1;
next.glider.offset = Vec3::new(0.0, -13.0 + slow * 0.10, 6.0);
next.glider.ori = Quaternion::rotation_x(1.0) * Quaternion::rotation_y(slowa * 0.04);
next.glider.offset = Vec3::new(0.0, -13.0 + slow * 0.10, 8.0);
next.glider.ori = Quaternion::rotation_x(0.8) * Quaternion::rotation_y(slowa * 0.04);
next.glider.scale = Vec3::one();
next.main.offset = Vec3::new(-7.0, -5.0, 15.0);
@ -130,7 +126,7 @@ impl Animation for GlidingAnimation {
next.lantern.scale = Vec3::one() * 0.65;
next.torso.offset = Vec3::new(0.0, 6.0, 15.0) / 11.0 * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(-0.05 * speed.max(12.0) + slow * 0.10)
next.torso.ori = Quaternion::rotation_x(-0.05 * speed.max(12.0) + slow * 0.06)
* Quaternion::rotation_y(tilt * 16.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;

View File

@ -220,8 +220,8 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
(Orc, Female) => (0.0, 14.0),
(Human, Male) => (0.3, 13.5),
(Human, Female) => (0.0, 13.8),
(Elf, Male) => (0.0, 13.5),
(Elf, Female) => (0.0, 13.5),
(Elf, Male) => (0.5, 13.5),
(Elf, Female) => (1.0, 13.5),
(Dwarf, Male) => (0.0, 14.5),
(Dwarf, Female) => (0.0, 14.0),
(Undead, Male) => (0.5, 13.6),

View File

@ -41,10 +41,10 @@ impl Animation for RollAnimation {
next.head.offset = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + wave_dub * -8.0,
-2.0 + skeleton_attr.head.0 + 3.0,
skeleton_attr.head.1 - 2.0,
);
next.head.ori = Quaternion::rotation_x(wave_dub * 0.4);
next.head.ori = Quaternion::rotation_x(wave_dub * -0.8);
next.head.scale = Vec3::one();
next.chest.offset = Vec3::new(
@ -55,21 +55,15 @@ 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,
skeleton_attr.belt.0 + wave_dub * -3.0,
);
next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4);
next.belt.scale = Vec3::one();
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(
0.0,
skeleton_attr.shorts.0,
skeleton_attr.shorts.0 + wave_dub * -2.0,
skeleton_attr.shorts.0 + 2.0,
skeleton_attr.shorts.1 + 3.0,
);
next.shorts.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4);
next.shorts.scale = Vec3::one();
next.shorts.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.8);
next.l_hand.offset = Vec3::new(
-skeleton_attr.chest.0 + wave * -0.5,
@ -88,23 +82,20 @@ impl Animation for RollAnimation {
);
next.r_hand.ori =
Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(wave * 0.3);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + wave_dub * -1.2 + wave_slow * 4.0,
skeleton_attr.foot.2 + wave_dub * -1.2,
);
next.l_foot.ori = Quaternion::rotation_x(wave * 0.6);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + wave_dub * -1.0 + wave_slow * 4.0,
skeleton_attr.foot.2 + wave_dub * -1.0,
);
next.r_foot.ori = Quaternion::rotation_x(wave * -0.4);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(
-skeleton_attr.shoulder.0,
@ -141,7 +132,7 @@ impl Animation for RollAnimation {
next.lantern.scale = Vec3::one() * 0.65;
next.torso.offset =
Vec3::new(0.0, 0.0, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
Vec3::new(0.0, 0.0, 0.0 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(tilt);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;

View File

@ -26,11 +26,6 @@ impl Animation for RunAnimation {
let lower = if speed > 5.0 { 0.0 } else { 1.0 };
let snapfoot = if speed > 5.0 { 1.1 } else { 2.0 };
let lab = 1.0;
let long = (((5.0)
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 8.0 * walk).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 8.0 * walk).sin());
let short = (((5.0)
/ (1.5
+ 3.5 * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powf(2.0 as f32)))
@ -92,9 +87,9 @@ impl Animation for RunAnimation {
next.head.offset = Vec3::new(
0.0,
-3.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.1 + short * 0.3,
-1.0 + skeleton_attr.head.1 + short * 0.1,
);
next.head.ori = Quaternion::rotation_z(head_look.x + long * -0.1 - short * 0.3)
next.head.ori = Quaternion::rotation_z(head_look.x - short * 0.1)
* Quaternion::rotation_x(head_look.y + 0.35);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
@ -103,11 +98,11 @@ impl Animation for RunAnimation {
skeleton_attr.chest.0,
skeleton_attr.chest.1 + 2.0 + short * 1.1 - lower,
);
next.chest.ori = Quaternion::rotation_z(short * 0.3 * walkintensity);
next.chest.ori = Quaternion::rotation_z(short * 0.15 * walkintensity);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori = Quaternion::rotation_z(short * 0.25);
next.belt.ori = Quaternion::rotation_z(short * 0.1);
next.belt.scale = Vec3::one();
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
@ -115,24 +110,24 @@ impl Animation for RunAnimation {
next.back.scale = Vec3::one() * 1.02;
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_z(short * 0.4);
next.shorts.ori = Quaternion::rotation_z(short * 0.2);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-skeleton_attr.hand.0 + wave_stop * 1.0 * walkintensity,
skeleton_attr.hand.1 + short * 3.0 * walkintensity,
1.0 + skeleton_attr.hand.2 + short * -1.5 * walkintensity,
1.0 + skeleton_attr.hand.2 + short * -0.75 * walkintensity,
);
next.l_hand.ori = Quaternion::rotation_x(0.2 + short * 1.2 * walk)
next.l_hand.ori = Quaternion::rotation_x(0.2 + short * 1.5 * walk)
* Quaternion::rotation_y(wave_stop * -0.1);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(
skeleton_attr.hand.0 + wave_stop * -1.0 * walkintensity,
skeleton_attr.hand.1 + short * -3.0 * walkintensity,
1.0 + skeleton_attr.hand.2 + short * 1.5 * walkintensity,
1.0 + skeleton_attr.hand.2 + short * 0.75 * walkintensity,
);
next.r_hand.ori = Quaternion::rotation_x(0.2 + short * -1.2 * walk)
next.r_hand.ori = Quaternion::rotation_x(0.2 + short * -1.5 * walk)
* Quaternion::rotation_y(wave_stop * 0.1);
next.r_hand.scale = Vec3::one();

View File

@ -46,11 +46,9 @@ impl Animation for ShootAnimation {
next.chest.ori = Quaternion::rotation_z(0.4 + exp * 1.0)
* Quaternion::rotation_x(0.0 + exp * 0.2)
* Quaternion::rotation_y(exp * -0.08);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + exp * 1.0, skeleton_attr.belt.1);
next.belt.ori = next.chest.ori * -0.1;
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(
0.0,
@ -58,7 +56,6 @@ impl Animation for ShootAnimation {
skeleton_attr.shorts.1,
);
next.shorts.ori = next.chest.ori * -0.08;
next.shorts.scale = Vec3::one();
match active_tool_kind {
//TODO: Inventory
@ -75,7 +72,6 @@ impl Animation for ShootAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0 - exp * 5.0);
next.control.ori = Quaternion::rotation_x(exp * 1.3)
@ -98,7 +94,6 @@ impl Animation for ShootAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-9.0, 6.0, 8.0);
next.control.ori = Quaternion::rotation_x(exp * 0.4)
@ -123,23 +118,17 @@ impl Animation for ShootAnimation {
* Quaternion::rotation_y(0.0);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(-0.15)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_x(-0.15);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
} else {
next.l_foot.offset = Vec3::new(-3.4, -2.5, 8.0 + exp * 2.5);
next.l_foot.ori =
Quaternion::rotation_x(exp * -0.2 - 0.2) * Quaternion::rotation_z(exp * 1.0);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 3.5 - exp * 2.0, 8.0);
next.r_foot.ori = Quaternion::rotation_x(exp * 0.1) * Quaternion::rotation_z(exp * 0.5);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
}
next.back.offset = Vec3::new(0.0, -2.8, 7.25);

View File

@ -89,7 +89,6 @@ impl Animation for SitAnimation {
skeleton_attr.foot.2,
);
next.l_foot.ori = Quaternion::rotation_x(slow * 0.1 + stop * 1.2 + slow * 0.1);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(
skeleton_attr.foot.0,
@ -97,7 +96,6 @@ impl Animation for SitAnimation {
skeleton_attr.foot.2,
);
next.r_foot.ori = Quaternion::rotation_x(slowa * 0.1 + stop * 1.2 + slowa * 0.1);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(
-skeleton_attr.shoulder.0,

View File

@ -59,11 +59,9 @@ impl Animation for SwimAnimation {
skeleton_attr.chest.1 + short * 1.3,
);
next.chest.ori = Quaternion::rotation_z(short * 0.4);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori = Quaternion::rotation_z(short * 0.30);
next.belt.scale = Vec3::one();
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.ori = Quaternion::rotation_z(0.0);
@ -71,7 +69,6 @@ impl Animation for SwimAnimation {
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_z(short * 0.5);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-skeleton_attr.hand.0,
@ -79,7 +76,6 @@ impl Animation for SwimAnimation {
skeleton_attr.hand.2 + foot * -3.0,
);
next.l_hand.ori = Quaternion::rotation_x(0.8 + foot * -0.6) * Quaternion::rotation_y(0.2);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(
skeleton_attr.hand.0,
@ -87,7 +83,6 @@ impl Animation for SwimAnimation {
skeleton_attr.hand.2 + foot * 3.0,
);
next.r_hand.ori = Quaternion::rotation_x(0.8 + foot * 0.6) * Quaternion::rotation_y(-0.2);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(
-skeleton_attr.foot.0,
@ -95,7 +90,6 @@ impl Animation for SwimAnimation {
-5.0 + skeleton_attr.foot.2 + foot * 6.5,
);
next.l_foot.ori = Quaternion::rotation_x(-1.40 + foot * 0.6);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(
skeleton_attr.foot.0,
@ -103,11 +97,10 @@ impl Animation for SwimAnimation {
-5.0 + skeleton_attr.foot.2 + foot * -6.5,
);
next.r_foot.ori = Quaternion::rotation_x(-1.40 + foot * -0.6);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.l_shoulder.ori = Quaternion::rotation_x(short * 0.15);
@ -115,7 +108,7 @@ impl Animation for SwimAnimation {
next.r_shoulder.offset = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.r_shoulder.ori = Quaternion::rotation_x(short * -0.15);
@ -139,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) * Quaternion::rotation_y(0.0);
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();

View File

@ -76,15 +76,12 @@ impl Animation for WieldAnimation {
next.l_foot.offset = Vec3::new(-3.4, -2.5, 9.0);
next.l_foot.ori = Quaternion::rotation_x(ultra_slow_cos * 0.035 - 0.2);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 3.5, 9.0);
next.r_foot.ori = Quaternion::rotation_x(ultra_slow * 0.035);
next.r_foot.scale = Vec3::one();
next.chest.ori =
Quaternion::rotation_y(ultra_slow_cos * 0.04) * Quaternion::rotation_z(0.15);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.ori =
@ -96,22 +93,20 @@ impl Animation for WieldAnimation {
next.back.scale = Vec3::one() * 1.02;
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.ori = Quaternion::rotation_z(0.3);
next.shorts.scale = Vec3::one();
}
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Sword(_)) => {
next.l_hand.offset = Vec3::new(-0.25, -5.0, -5.0);
next.l_hand.offset = Vec3::new(-0.25, -5.0, -2.0);
next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.offset = Vec3::new(1.25, -5.5, -8.0);
next.r_hand.offset = Vec3::new(1.25, -5.5, -5.0);
next.r_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 0.0, -6.0);
next.main.offset = Vec3::new(0.0, 0.0, -3.0);
next.main.ori = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.15)
@ -134,7 +129,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(-0.8);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(ultra_slow_cos * 0.1 + 0.2)
@ -153,7 +147,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.15)
@ -174,7 +167,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(3.14 + 0.3)
* Quaternion::rotation_z(0.9);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-14.0, 1.8, 3.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2)
@ -210,7 +202,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2)
@ -252,7 +243,6 @@ impl Animation for WieldAnimation {
next.main.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(3.14)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.1)

View File

@ -0,0 +1,156 @@
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
use std::f32::consts::PI;
use vek::*;
pub struct FlyAnimation;
impl Animation for FlyAnimation {
type Dependency = (f32, f64);
type Skeleton = DragonSkeleton;
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 12.0;
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 * 3.5 + PI).sin();
let wingl = (anim_time as f32 * 2.0 + PI).sin();
let wingr = (anim_time as f32 * 2.0).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();
next.head_upper.offset = Vec3::new(
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + wave_ultra_slow * 0.20,
);
next.head_upper.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
next.head_upper.scale = Vec3::one() * 1.05;
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + wave_ultra_slow * 0.20,
);
next.head_lower.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
next.head_lower.scale = Vec3::one() * 1.05;
next.jaw.offset = Vec3::new(
0.0,
skeleton_attr.jaw.0 - wave_ultra_slow_cos * 0.12,
skeleton_attr.jaw.1 + wave_slow * 0.2,
);
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.03);
next.jaw.scale = Vec3::one() * 1.05;
next.tail_front.offset = Vec3::new(
0.0,
skeleton_attr.tail_front.0,
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_rear.offset = Vec3::new(
0.0,
skeleton_attr.tail_rear.0,
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.chest_front.offset = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1,
);
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.ori = Quaternion::rotation_y(center * 0.05);
next.chest_rear.scale = Vec3::one();
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.ori = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.ori = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.ori = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.ori = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_br.scale = Vec3::one();
next.wing_in_l.offset = Vec3::new(
-skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_l.ori = Quaternion::rotation_y(0.4 + wingl * 0.6);
next.wing_in_l.scale = Vec3::one();
next.wing_in_r.offset = Vec3::new(
skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_r.ori = Quaternion::rotation_y(-0.4 + wingr * 0.6);
next.wing_in_r.scale = Vec3::one();
next.wing_out_l.offset = Vec3::new(
-skeleton_attr.wing_out.0,
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.2));
next.wing_out_l.scale = Vec3::one();
next.wing_out_r.offset = Vec3::new(
skeleton_attr.wing_out.0,
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.2));
next.wing_out_r.scale = Vec3::one();
next
}
}

View File

@ -1,5 +1,5 @@
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -10,64 +10,139 @@ impl Animation for IdleAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f64,
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
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();
next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_front.ori = Quaternion::rotation_x(0.0);
next.chest_front.scale = Vec3::one() * 1.01;
let dragon_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_rear.ori = Quaternion::rotation_x(0.0);
next.chest_rear.scale = Vec3::one() * 1.01;
next.head_upper.offset = Vec3::new(
0.0,
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.scale = Vec3::one();
next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_front.ori = Quaternion::rotation_x(0.0);
next.tail_front.scale = Vec3::one() * 1.01;
next.head_lower.offset = Vec3::new(
0.0,
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.scale = Vec3::one() * 1.05;
next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_rear.ori = Quaternion::rotation_x(0.0);
next.tail_rear.scale = Vec3::one() * 1.01;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.ori = Quaternion::rotation_x(slow * 0.04);
next.jaw.scale = Vec3::one() * 1.05;
next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_l.ori = Quaternion::rotation_x(0.0);
next.wing_in_l.scale = Vec3::one() * 1.01;
next.chest_front.offset = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1,
);
next.chest_front.ori = Quaternion::rotation_y(slow * 0.01);
next.chest_front.scale = Vec3::one() * 1.05;
next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_r.ori = Quaternion::rotation_x(0.0);
next.wing_in_r.scale = Vec3::one() * 1.01;
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.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_l.ori = Quaternion::rotation_x(0.0);
next.wing_out_l.scale = Vec3::one() * 1.01;
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.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_r.ori = Quaternion::rotation_x(0.0);
next.wing_out_r.scale = Vec3::one() * 1.01;
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.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_l.offset = Vec3::new(
-skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_l.ori = Quaternion::rotation_y(0.8);
next.wing_in_l.scale = Vec3::one();
next.wing_in_r.offset = Vec3::new(
skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_r.ori = Quaternion::rotation_y(-0.8);
next.wing_in_r.scale = Vec3::one();
next.wing_out_l.offset = Vec3::new(
-skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_l.ori = Quaternion::rotation_y(-2.0);
next.wing_out_l.scale = Vec3::one();
next.wing_out_r.offset = Vec3::new(
skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_r.ori = Quaternion::rotation_y(2.0);
next.wing_out_r.scale = Vec3::one();
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.ori = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() * 1.01;
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.ori = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() * 1.01;
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() * 1.01;
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() * 1.01;
next.foot_br.scale = Vec3::one();
next
}
}

View File

@ -1,73 +0,0 @@
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
//use std::f32::consts::PI;
use vek::*;
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = (f32, f64);
type Skeleton = DragonSkeleton;
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_front.ori = Quaternion::rotation_x(0.0);
next.chest_front.scale = Vec3::one() * 1.01;
next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_rear.ori = Quaternion::rotation_x(0.0);
next.chest_rear.scale = Vec3::one() * 1.01;
next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_front.ori = Quaternion::rotation_x(0.0);
next.tail_front.scale = Vec3::one() * 1.01;
next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_rear.ori = Quaternion::rotation_x(0.0);
next.tail_rear.scale = Vec3::one() * 1.01;
next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_l.ori = Quaternion::rotation_x(0.0);
next.wing_in_l.scale = Vec3::one() * 1.01;
next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_r.ori = Quaternion::rotation_x(0.0);
next.wing_in_r.scale = Vec3::one() * 1.01;
next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_l.ori = Quaternion::rotation_x(0.0);
next.wing_out_l.scale = Vec3::one() * 1.01;
next.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_r.ori = Quaternion::rotation_x(0.0);
next.wing_out_r.scale = Vec3::one() * 1.01;
next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fl.ori = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() * 1.01;
next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fr.ori = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() * 1.01;
next.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() * 1.01;
next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() * 1.01;
next
}
}

View File

@ -1,18 +1,20 @@
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};
use vek::Vec3;
#[derive(Clone)]
#[derive(Clone, Default)]
pub struct DragonSkeleton {
head: Bone,
head_upper: Bone,
head_lower: Bone,
jaw: Bone,
chest_front: Bone,
chest_rear: Bone,
tail_front: Bone,
@ -28,61 +30,63 @@ pub struct DragonSkeleton {
}
impl DragonSkeleton {
pub fn new() -> Self {
Self {
head: Bone::default(),
chest_front: Bone::default(),
chest_rear: Bone::default(),
tail_front: Bone::default(),
tail_rear: Bone::default(),
wing_in_l: Bone::default(),
wing_in_r: Bone::default(),
wing_out_l: Bone::default(),
wing_out_r: Bone::default(),
foot_fl: Bone::default(),
foot_fr: Bone::default(),
foot_bl: Bone::default(),
foot_br: Bone::default(),
}
}
pub fn new() -> Self { Self::default() }
}
impl Skeleton for DragonSkeleton {
type Attr = SkeletonAttr;
fn bone_count(&self) -> usize { 13 }
fn bone_count(&self) -> usize { 15 }
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
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(self.head.compute_base_matrix() * chest_front_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
* head_upper_mat
* self.jaw.compute_base_matrix(),
),
FigureBoneData::new(chest_front_mat),
FigureBoneData::new(self.chest_rear.compute_base_matrix() * chest_front_mat),
FigureBoneData::new(tail_front_mat),
FigureBoneData::new(self.tail_rear.compute_base_matrix() * tail_front_mat),
FigureBoneData::new(wing_in_l_mat),
FigureBoneData::new(wing_in_r_mat),
FigureBoneData::new(self.wing_out_l.compute_base_matrix() * wing_in_l_mat),
FigureBoneData::new(self.wing_out_r.compute_base_matrix() * wing_in_r_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(),
FigureBoneData::default(),
FigureBoneData::default(),
],
Vec3::default(),
)
}
fn interpolate(&mut self, target: &Self, dt: f32) {
self.head.interpolate(&target.head, 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);
@ -98,7 +102,20 @@ impl Skeleton for DragonSkeleton {
}
}
pub struct SkeletonAttr;
pub struct SkeletonAttr {
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 {
type Error = ();
@ -112,9 +129,64 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
}
impl Default for SkeletonAttr {
fn default() -> Self { Self }
fn default() -> Self {
Self {
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::dragon::Body> for SkeletonAttr {
fn from(_body: &'a comp::dragon::Body) -> Self { Self }
fn from(body: &'a comp::dragon::Body) -> Self {
use comp::dragon::Species::*;
Self {
head_upper: match (body.species, body.body_type) {
(Reddragon, _) => (2.5, 4.5),
},
head_lower: match (body.species, body.body_type) {
(Reddragon, _) => (7.5, 3.5),
},
jaw: match (body.species, body.body_type) {
(Reddragon, _) => (6.5, -5.0),
},
chest_front: match (body.species, body.body_type) {
(Reddragon, _) => (0.0, 14.0),
},
chest_rear: match (body.species, body.body_type) {
(Reddragon, _) => (-12.5, 0.0),
},
tail_front: match (body.species, body.body_type) {
(Reddragon, _) => (-6.5, 1.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),
},
}
}
}

View File

@ -1,5 +1,5 @@
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct RunAnimation;
@ -10,64 +10,159 @@ impl Animation for RunAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
(_velocity, _global_time): Self::Dependency,
_anim_time: f64,
(_velocity, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let lab = 14;
next.chest_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_front.ori = Quaternion::rotation_x(0.0);
next.chest_front.scale = Vec3::one() * 1.01;
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow = (anim_time as f32 * 4.5).sin();
next.chest_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.chest_rear.ori = Quaternion::rotation_x(0.0);
next.chest_rear.scale = Vec3::one() * 1.01;
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);
next.tail_front.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_front.ori = Quaternion::rotation_x(0.0);
next.tail_front.scale = Vec3::one() * 1.01;
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();
next.tail_rear.offset = Vec3::new(0.0, 4.5, 2.0);
next.tail_rear.ori = Quaternion::rotation_x(0.0);
next.tail_rear.scale = Vec3::one() * 1.01;
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();
next.wing_in_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_l.ori = Quaternion::rotation_x(0.0);
next.wing_in_l.scale = Vec3::one() * 1.01;
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();
next.wing_in_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_in_r.ori = Quaternion::rotation_x(0.0);
next.wing_in_r.scale = Vec3::one() * 1.01;
let dragon_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,
);
next.wing_out_l.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_l.ori = Quaternion::rotation_x(0.0);
next.wing_out_l.scale = Vec3::one() * 1.01;
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.wing_out_r.offset = Vec3::new(0.0, 4.5, 2.0);
next.wing_out_r.ori = Quaternion::rotation_x(0.0);
next.wing_out_r.scale = Vec3::one() * 1.01;
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();
next.foot_fl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fl.ori = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() * 1.01;
next.jaw.offset = Vec3::new(
0.0,
skeleton_attr.jaw.0 - wave_ultra_slow_cos * 0.12,
skeleton_attr.jaw.1 + wave_slow * 0.2,
);
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.03);
next.jaw.scale = Vec3::one() * 1.05;
next.foot_fr.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_fr.ori = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() * 1.01;
next.tail_front.offset = Vec3::new(
0.0,
skeleton_attr.tail_front.0,
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.foot_bl.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() * 1.01;
next.tail_rear.offset = Vec3::new(
0.0,
skeleton_attr.tail_rear.0,
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.chest_front.offset = Vec3::new(
0.0,
skeleton_attr.chest_front.0 + horichest * 1.25,
skeleton_attr.chest_front.1 + vertchest * -1.6 + 1.0,
);
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.ori = Quaternion::rotation_y(horichest * -0.09);
next.chest_rear.scale = Vec3::one();
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + horilf * 2.5,
skeleton_attr.feet_f.2 + vertlf * 5.0 * skeleton_attr.height - 0.5,
);
next.foot_fl.ori = Quaternion::rotation_x(horilf * 0.4);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + horirfoffset * 2.5,
skeleton_attr.feet_f.2 + vertrfoffset * 5.0 * skeleton_attr.height - 0.5,
);
next.foot_fr.ori = Quaternion::rotation_x(horirfoffset * 0.4);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + horilboffset * 3.0,
skeleton_attr.feet_b.2 + vertlboffset * 5.0 * skeleton_attr.height - 0.5,
);
next.foot_bl.ori = Quaternion::rotation_x(horilboffset * 0.35);
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + horirb * 3.0,
skeleton_attr.feet_b.2 + vertrb * 5.0 * skeleton_attr.height - 0.5,
);
next.foot_br.ori = Quaternion::rotation_x(horirb * 0.35);
next.foot_br.scale = Vec3::one();
next.wing_in_l.offset = Vec3::new(
-skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_l.ori = Quaternion::rotation_y(0.8);
next.wing_in_l.scale = Vec3::one();
next.wing_in_r.offset = Vec3::new(
skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_r.ori = Quaternion::rotation_y(-0.8);
next.wing_in_r.scale = Vec3::one();
next.wing_out_l.offset = Vec3::new(
-skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_l.ori = Quaternion::rotation_y(-2.0);
next.wing_out_l.scale = Vec3::one();
next.wing_out_r.offset = Vec3::new(
skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2 - 1.4,
);
next.wing_out_r.ori = Quaternion::rotation_y(2.0);
next.wing_out_r.scale = Vec3::one();
next.foot_br.offset = Vec3::new(0.0, 4.5, 2.0);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() * 1.01;
next
}
}

View File

@ -410,24 +410,85 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
None,
None,
],
Body::Dragon(body) => [
Some(mesh_dragon_head(body.head, generate_mesh)),
Some(mesh_dragon_chest_front(body.chest_front, generate_mesh)),
Some(mesh_dragon_chest_rear(body.chest_rear, generate_mesh)),
Some(mesh_dragon_tail_front(body.tail_front, generate_mesh)),
Some(mesh_dragon_tail_rear(body.tail_rear, generate_mesh)),
Some(mesh_dragon_wing_in_l(body.wing_in_l, generate_mesh)),
Some(mesh_dragon_wing_in_r(body.wing_in_r, generate_mesh)),
Some(mesh_dragon_wing_out_l(body.wing_out_l, generate_mesh)),
Some(mesh_dragon_wing_out_r(body.wing_out_r, generate_mesh)),
Some(mesh_dragon_foot_fl(body.foot_fl, generate_mesh)),
Some(mesh_dragon_foot_fr(body.foot_fr, generate_mesh)),
Some(mesh_dragon_foot_bl(body.foot_bl, generate_mesh)),
Some(mesh_dragon_foot_br(body.foot_br, generate_mesh)),
None,
None,
None,
],
Body::Dragon(body) => {
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(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_center_spec.mesh_head_lower(
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,
generate_mesh,
)),
Some(dragon_center_spec.mesh_chest_rear(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_center_spec.mesh_tail_front(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_center_spec.mesh_tail_rear(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_lateral_spec.mesh_wing_in_l(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_lateral_spec.mesh_wing_in_r(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_lateral_spec.mesh_wing_out_l(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_lateral_spec.mesh_wing_out_r(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_lateral_spec.mesh_foot_fl(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_lateral_spec.mesh_foot_fr(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_lateral_spec.mesh_foot_bl(
body.species,
body.body_type,
generate_mesh,
)),
Some(dragon_lateral_spec.mesh_foot_br(
body.species,
body.body_type,
generate_mesh,
)),
None,
]
},
Body::BirdSmall(body) => [
Some(mesh_bird_small_head(body.head, generate_mesh)),
Some(mesh_bird_small_torso(body.torso, generate_mesh)),

View File

@ -6,7 +6,8 @@ use common::{
bird_medium::{BodyType as BMBodyType, Species as BMSpecies},
bird_small,
critter::{BodyType as CBodyType, Species as CSpecies},
dragon, fish_medium, fish_small,
dragon::{BodyType as DBodyType, Species as DSpecies},
fish_medium, fish_small,
golem::{BodyType as GBodyType, Species as GSpecies},
humanoid::{Body, BodyType, EyeColor, Race, Skin},
item::{
@ -1865,173 +1866,387 @@ pub fn mesh_fish_medium_fin_r(
)
}
pub fn mesh_dragon_head(
head: dragon::Head,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match head {
dragon::Head::Default => "npc.dragon.head",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
////
#[derive(Serialize, Deserialize)]
pub struct DragonCenterSpec(HashMap<(DSpecies, DBodyType), SidedDCenterVoxSpec>);
#[derive(Serialize, Deserialize)]
struct SidedDCenterVoxSpec {
upper: DragonCenterSubSpec,
lower: DragonCenterSubSpec,
jaw: DragonCenterSubSpec,
chest_front: DragonCenterSubSpec,
chest_rear: DragonCenterSubSpec,
tail_front: DragonCenterSubSpec,
tail_rear: DragonCenterSubSpec,
}
#[derive(Serialize, Deserialize)]
struct DragonCenterSubSpec {
offset: [f32; 3], // Should be relative to initial origin
center: VoxSimple,
}
pub fn mesh_dragon_chest_front(
chest_front: dragon::ChestFront,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match chest_front {
dragon::ChestFront::Default => "npc.dragon.chest_front",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
#[derive(Serialize, Deserialize)]
pub struct DragonLateralSpec(HashMap<(DSpecies, DBodyType), SidedDLateralVoxSpec>);
#[derive(Serialize, Deserialize)]
struct SidedDLateralVoxSpec {
wing_in_l: DragonLateralSubSpec,
wing_in_r: DragonLateralSubSpec,
wing_out_l: DragonLateralSubSpec,
wing_out_r: DragonLateralSubSpec,
foot_fl: DragonLateralSubSpec,
foot_fr: DragonLateralSubSpec,
foot_bl: DragonLateralSubSpec,
foot_br: DragonLateralSubSpec,
}
#[derive(Serialize, Deserialize)]
struct DragonLateralSubSpec {
offset: [f32; 3], // Should be relative to initial origin
lateral: VoxSimple,
}
pub fn mesh_dragon_chest_rear(
chest_rear: dragon::ChestRear,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match chest_rear {
dragon::ChestRear::Default => "npc.dragon.chest_rear",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
impl Asset for DragonCenterSpec {
const ENDINGS: &'static [&'static str] = &["ron"];
fn parse(buf_reader: BufReader<File>) -> Result<Self, assets::Error> {
ron::de::from_reader(buf_reader).map_err(assets::Error::parse_error)
}
}
pub fn mesh_dragon_tail_front(
tail_front: dragon::TailFront,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match tail_front {
dragon::TailFront::Default => "npc.dragon.tail_front",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
impl Asset for DragonLateralSpec {
const ENDINGS: &'static [&'static str] = &["ron"];
fn parse(buf_reader: BufReader<File>) -> Result<Self, assets::Error> {
ron::de::from_reader(buf_reader).map_err(assets::Error::parse_error)
}
}
pub fn mesh_dragon_tail_rear(
tail_rear: dragon::TailRear,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match tail_rear {
dragon::TailRear::Default => "npc.dragon.tail_rear",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
}
impl DragonCenterSpec {
pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> {
assets::load_watched::<Self>("voxygen.voxel.dragon_center_manifest", indicator).unwrap()
}
pub fn mesh_dragon_wing_in_l(
wing_in_l: dragon::WingInL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match wing_in_l {
dragon::WingInL::Default => "npc.dragon.wing_in_l",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
}
pub fn mesh_head_upper(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No upper head specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let central = graceful_load_segment(&spec.upper.center.0);
pub fn mesh_dragon_wing_in_r(
wing_in_r: dragon::WingInR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match wing_in_r {
dragon::WingInR::Default => "npc.dragon.wing_in_r",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
}
generate_mesh(&central, Vec3::from(spec.upper.offset))
}
pub fn mesh_dragon_wing_out_l(
wing_out_l: dragon::WingOutL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match wing_out_l {
dragon::WingOutL::Default => "npc.dragon.wing_out_l",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
}
pub fn mesh_head_lower(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No lower head specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let central = graceful_load_segment(&spec.lower.center.0);
pub fn mesh_dragon_wing_out_r(
wing_out_r: dragon::WingOutR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match wing_out_r {
dragon::WingOutR::Default => "npc.dragon.wing_out_r",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
}
generate_mesh(&central, Vec3::from(spec.lower.offset))
}
pub fn mesh_dragon_foot_fl(
foot_fl: dragon::FootFL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match foot_fl {
dragon::FootFL::Default => "npc.dragon.foot_fl",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
}
pub fn mesh_jaw(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No jaw specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let central = graceful_load_segment(&spec.jaw.center.0);
pub fn mesh_dragon_foot_fr(
foot_fr: dragon::FootFR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match foot_fr {
dragon::FootFR::Default => "npc.dragon.foot_fr",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
}
generate_mesh(&central, Vec3::from(spec.jaw.offset))
}
pub fn mesh_dragon_foot_bl(
foot_bl: dragon::FootBL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match foot_bl {
dragon::FootBL::Default => "npc.dragon.foot_bl",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
}
pub fn mesh_chest_front(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No chest front specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let center = graceful_load_segment(&spec.chest_front.center.0);
pub fn mesh_dragon_foot_br(
foot_br: dragon::FootBR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
match foot_br {
dragon::FootBR::Default => "npc.dragon.foot_br",
},
Vec3::new(-7.0, -6.0, -6.0),
generate_mesh,
)
generate_mesh(&center, Vec3::from(spec.chest_front.offset))
}
pub fn mesh_chest_rear(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No chest rear specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let center = graceful_load_segment(&spec.chest_rear.center.0);
generate_mesh(&center, Vec3::from(spec.chest_rear.offset))
}
pub fn mesh_tail_front(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No tail front specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let center = graceful_load_segment(&spec.tail_front.center.0);
generate_mesh(&center, Vec3::from(spec.tail_front.offset))
}
pub fn mesh_tail_rear(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No tail rear specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let center = graceful_load_segment(&spec.tail_rear.center.0);
generate_mesh(&center, Vec3::from(spec.tail_rear.offset))
}
}
impl DragonLateralSpec {
pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc<Self> {
assets::load_watched::<Self>("voxygen.voxel.dragon_lateral_manifest", indicator).unwrap()
}
pub fn mesh_wing_in_l(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No wing specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let lateral = graceful_load_segment(&spec.wing_in_l.lateral.0);
generate_mesh(&lateral, Vec3::from(spec.wing_in_l.offset))
}
pub fn mesh_wing_in_r(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No wing specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let lateral = graceful_load_segment(&spec.wing_in_r.lateral.0);
generate_mesh(&lateral, Vec3::from(spec.wing_in_r.offset))
}
pub fn mesh_wing_out_l(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No wing specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let lateral = graceful_load_segment(&spec.wing_out_l.lateral.0);
generate_mesh(&lateral, Vec3::from(spec.wing_out_l.offset))
}
pub fn mesh_wing_out_r(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No wing specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let lateral = graceful_load_segment(&spec.wing_out_r.lateral.0);
generate_mesh(&lateral, Vec3::from(spec.wing_out_r.offset))
}
pub fn mesh_foot_fl(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No foot specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let lateral = graceful_load_segment(&spec.foot_fl.lateral.0);
generate_mesh(&lateral, Vec3::from(spec.foot_fl.offset))
}
pub fn mesh_foot_fr(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No foot specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let lateral = graceful_load_segment(&spec.foot_fr.lateral.0);
generate_mesh(&lateral, Vec3::from(spec.foot_fr.offset))
}
pub fn mesh_foot_bl(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No foot specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let lateral = graceful_load_segment(&spec.foot_bl.lateral.0);
generate_mesh(&lateral, Vec3::from(spec.foot_bl.offset))
}
pub fn mesh_foot_br(
&self,
species: DSpecies,
body_type: DBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec,
None => {
error!(
"No foot specification exists for the combination of {:?} and {:?}",
species, body_type
);
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5), generate_mesh);
},
};
let lateral = graceful_load_segment(&spec.foot_br.lateral.0);
generate_mesh(&lateral, Vec3::from(spec.foot_br.offset))
}
}
////

View File

@ -1101,7 +1101,7 @@ impl FigureMgr {
skeleton_attr,
),
// In air
(false, _, false) => anim::dragon::JumpAnimation::update_skeleton(
(false, _, false) => anim::dragon::FlyAnimation::update_skeleton(
&DragonSkeleton::new(),
(vel.0.magnitude(), time),
state.state_time,