mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Initial fish work
This commit is contained in:
parent
ed9413e96a
commit
72d73ecd38
@ -700,16 +700,30 @@
|
|||||||
"fish_small": {
|
"fish_small": {
|
||||||
"body": {
|
"body": {
|
||||||
"keyword": "fish_small",
|
"keyword": "fish_small",
|
||||||
"names": []
|
"names": [
|
||||||
|
"Dagon"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"species": null
|
"species": {
|
||||||
|
"sardine": {
|
||||||
|
"keyword": "sardine",
|
||||||
|
"generic": "Sardine"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"fish_medium": {
|
"fish_medium": {
|
||||||
"body": {
|
"body": {
|
||||||
"keyword": "fish_medium",
|
"keyword": "fish_medium",
|
||||||
"names": []
|
"names": [
|
||||||
|
"Njord"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"species": null
|
"species": {
|
||||||
|
"marlin": {
|
||||||
|
"keyword": "marlin",
|
||||||
|
"generic": "Marlin"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"bird_small": {
|
"bird_small": {
|
||||||
"body": {
|
"body": {
|
||||||
|
46
assets/voxygen/voxel/fish_medium_central_manifest.ron
Normal file
46
assets/voxygen/voxel/fish_medium_central_manifest.ron
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
({
|
||||||
|
(Marlin, Male): (
|
||||||
|
head: (
|
||||||
|
offset: (-2.5, 0.0, -3.0),
|
||||||
|
central: ("npc.marlin.male.head"),
|
||||||
|
),
|
||||||
|
jaw: (
|
||||||
|
offset: (-4.0, 0.0, -1.5),
|
||||||
|
central: ("armor.empty"),
|
||||||
|
),
|
||||||
|
chest_front: (
|
||||||
|
offset: (-2.5, -5.0, -2.5),
|
||||||
|
central: ("npc.marlin.male.chest_front"),
|
||||||
|
),
|
||||||
|
chest_back: (
|
||||||
|
offset: (-2.5, -7.0, -3.5),
|
||||||
|
central: ("npc.marlin.male.chest_back"),
|
||||||
|
),
|
||||||
|
tail: (
|
||||||
|
offset: (-0.5, -11.0, -4.5),
|
||||||
|
central: ("npc.marlin.male.tail"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(Marlin, Female): (
|
||||||
|
head: (
|
||||||
|
offset: (-2.5, 0.0, -3.0),
|
||||||
|
central: ("npc.marlin.male.head"),
|
||||||
|
),
|
||||||
|
jaw: (
|
||||||
|
offset: (-4.0, 0.0, -1.5),
|
||||||
|
central: ("armor.empty"),
|
||||||
|
),
|
||||||
|
chest_front: (
|
||||||
|
offset: (-2.5, -5.0, -2.5),
|
||||||
|
central: ("npc.marlin.male.chest_front"),
|
||||||
|
),
|
||||||
|
chest_back: (
|
||||||
|
offset: (-2.5, -7.0, -3.5),
|
||||||
|
central: ("npc.marlin.male.chest_back"),
|
||||||
|
),
|
||||||
|
tail: (
|
||||||
|
offset: (-0.5, -11.0, -4.5),
|
||||||
|
central: ("npc.marlin.male.tail"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
})
|
22
assets/voxygen/voxel/fish_medium_lateral_manifest.ron
Normal file
22
assets/voxygen/voxel/fish_medium_lateral_manifest.ron
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
({
|
||||||
|
(Marlin, Male): (
|
||||||
|
fin_l: (
|
||||||
|
offset: (-3.0, -5.0, -4.0),
|
||||||
|
lateral: ("npc.marlin.male.fin_l"),
|
||||||
|
),
|
||||||
|
fin_r: (
|
||||||
|
offset: (0.0, -5.0, -4.0),
|
||||||
|
lateral: ("npc.marlin.male.fin_r"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(Marlin, Female): (
|
||||||
|
fin_l: (
|
||||||
|
offset: (-3.0, -5.0, -4.0),
|
||||||
|
lateral: ("npc.marlin.male.fin_l"),
|
||||||
|
),
|
||||||
|
fin_r: (
|
||||||
|
offset: (0.0, -5.0, -4.0),
|
||||||
|
lateral: ("npc.marlin.male.fin_r"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
})
|
30
assets/voxygen/voxel/fish_small_central_manifest.ron
Normal file
30
assets/voxygen/voxel/fish_small_central_manifest.ron
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
({
|
||||||
|
(Sardine, Male): (
|
||||||
|
head: (
|
||||||
|
offset: (-4.0, 0.0, -3.0),
|
||||||
|
central: ("npc.sardine.male.head"),
|
||||||
|
),
|
||||||
|
chest: (
|
||||||
|
offset: (-5.0, -7.5, -3.0),
|
||||||
|
central: ("npc.sardine.male.chest"),
|
||||||
|
),
|
||||||
|
tail: (
|
||||||
|
offset: (-1.0, -9.0, -1.5),
|
||||||
|
central: ("npc.sardine.male.tail"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(Sardine, Female): (
|
||||||
|
head: (
|
||||||
|
offset: (-4.0, 0.0, -3.0),
|
||||||
|
central: ("npc.sardine.male.head"),
|
||||||
|
),
|
||||||
|
chest: (
|
||||||
|
offset: (-5.0, -7.5, -3.0),
|
||||||
|
central: ("npc.sardine.male.chest"),
|
||||||
|
),
|
||||||
|
tail: (
|
||||||
|
offset: (-1.0, -9.0, -1.5),
|
||||||
|
central: ("npc.sardine.male.tail"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
})
|
22
assets/voxygen/voxel/fish_small_lateral_manifest.ron
Normal file
22
assets/voxygen/voxel/fish_small_lateral_manifest.ron
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
({
|
||||||
|
(Sardine, Male): (
|
||||||
|
fin_l: (
|
||||||
|
offset: (-1.5, -5.0, -3.0),
|
||||||
|
lateral: ("npc.sardine.male.fin_l"),
|
||||||
|
),
|
||||||
|
fin_r: (
|
||||||
|
offset: (-1.5, -5.0, -3.0),
|
||||||
|
lateral: ("npc.sardine.male.fin_r"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(Sardine, Female): (
|
||||||
|
fin_l: (
|
||||||
|
offset: (-1.5, -5.0, -3.0),
|
||||||
|
lateral: ("npc.sardine.male.fin_l"),
|
||||||
|
),
|
||||||
|
fin_r: (
|
||||||
|
offset: (-1.5, -5.0, -3.0),
|
||||||
|
lateral: ("npc.sardine.male.fin_r"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
})
|
BIN
assets/voxygen/voxel/npc/marlin/fin_l.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/marlin/fin_l.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/fin_r.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/marlin/fin_r.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/head.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/marlin/head.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/male/chest_back.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/male/chest_back.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/male/chest_front.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/male/chest_front.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/male/fin_l.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/male/fin_l.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/male/fin_r.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/male/fin_r.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/male/head.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/male/head.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/male/tail.vox
(Stored with Git LFS)
Normal file
BIN
assets/voxygen/voxel/npc/marlin/male/tail.vox
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/rear.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/marlin/rear.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/tail.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/marlin/tail.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/npc/marlin/torso.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/marlin/torso.vox
(Stored with Git LFS)
Binary file not shown.
@ -65,10 +65,10 @@ pub struct AllBodies<BodyMeta, SpeciesMeta> {
|
|||||||
pub quadruped_small: BodyData<BodyMeta, quadruped_small::AllSpecies<SpeciesMeta>>,
|
pub quadruped_small: BodyData<BodyMeta, quadruped_small::AllSpecies<SpeciesMeta>>,
|
||||||
pub quadruped_medium: BodyData<BodyMeta, quadruped_medium::AllSpecies<SpeciesMeta>>,
|
pub quadruped_medium: BodyData<BodyMeta, quadruped_medium::AllSpecies<SpeciesMeta>>,
|
||||||
pub bird_medium: BodyData<BodyMeta, bird_medium::AllSpecies<SpeciesMeta>>,
|
pub bird_medium: BodyData<BodyMeta, bird_medium::AllSpecies<SpeciesMeta>>,
|
||||||
pub fish_medium: BodyData<BodyMeta, ()>,
|
pub fish_medium: BodyData<BodyMeta, fish_medium::AllSpecies<SpeciesMeta>>,
|
||||||
pub dragon: BodyData<BodyMeta, dragon::AllSpecies<SpeciesMeta>>,
|
pub dragon: BodyData<BodyMeta, dragon::AllSpecies<SpeciesMeta>>,
|
||||||
pub bird_small: BodyData<BodyMeta, ()>,
|
pub bird_small: BodyData<BodyMeta, ()>,
|
||||||
pub fish_small: BodyData<BodyMeta, ()>,
|
pub fish_small: BodyData<BodyMeta, fish_small::AllSpecies<SpeciesMeta>>,
|
||||||
pub biped_large: BodyData<BodyMeta, biped_large::AllSpecies<SpeciesMeta>>,
|
pub biped_large: BodyData<BodyMeta, biped_large::AllSpecies<SpeciesMeta>>,
|
||||||
pub object: BodyData<BodyMeta, ()>,
|
pub object: BodyData<BodyMeta, ()>,
|
||||||
pub golem: BodyData<BodyMeta, golem::AllSpecies<SpeciesMeta>>,
|
pub golem: BodyData<BodyMeta, golem::AllSpecies<SpeciesMeta>>,
|
||||||
@ -87,6 +87,8 @@ impl<BodyMeta, SpeciesMeta> core::ops::Index<NpcKind> for AllBodies<BodyMeta, Sp
|
|||||||
NpcKind::Pig => &self.quadruped_small.body,
|
NpcKind::Pig => &self.quadruped_small.body,
|
||||||
NpcKind::Wolf => &self.quadruped_medium.body,
|
NpcKind::Wolf => &self.quadruped_medium.body,
|
||||||
NpcKind::Duck => &self.bird_medium.body,
|
NpcKind::Duck => &self.bird_medium.body,
|
||||||
|
NpcKind::Sardine => &self.fish_medium.body,
|
||||||
|
NpcKind::Marlin => &self.fish_small.body,
|
||||||
NpcKind::Ogre => &self.biped_large.body,
|
NpcKind::Ogre => &self.biped_large.body,
|
||||||
NpcKind::StoneGolem => &self.golem.body,
|
NpcKind::StoneGolem => &self.golem.body,
|
||||||
NpcKind::Archaeos => &self.theropod.body,
|
NpcKind::Archaeos => &self.theropod.body,
|
||||||
@ -231,10 +233,10 @@ impl Body {
|
|||||||
bird_medium::Species::Cockatrice => 1.8,
|
bird_medium::Species::Cockatrice => 1.8,
|
||||||
_ => 1.1,
|
_ => 1.1,
|
||||||
},
|
},
|
||||||
Body::FishMedium(_) => 1.1,
|
Body::FishMedium(_) => 0.8,
|
||||||
Body::Dragon(_) => 16.0,
|
Body::Dragon(_) => 16.0,
|
||||||
Body::BirdSmall(_) => 1.1,
|
Body::BirdSmall(_) => 1.1,
|
||||||
Body::FishSmall(_) => 0.9,
|
Body::FishSmall(_) => 0.6,
|
||||||
Body::BipedLarge(body) => match body.species {
|
Body::BipedLarge(body) => match body.species {
|
||||||
biped_large::Species::Slysaurok => 2.3,
|
biped_large::Species::Slysaurok => 2.3,
|
||||||
biped_large::Species::Occultsaurok => 2.8,
|
biped_large::Species::Occultsaurok => 2.8,
|
||||||
|
@ -6,86 +6,73 @@ make_proj_elim!(
|
|||||||
body,
|
body,
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
pub struct Body {
|
pub struct Body {
|
||||||
pub head: Head,
|
pub species: Species,
|
||||||
pub torso: Torso,
|
pub body_type: BodyType,
|
||||||
pub rear: Rear,
|
|
||||||
pub tail: Tail,
|
|
||||||
pub fin_l: FinL,
|
|
||||||
pub fin_r: FinR,
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
impl Body {
|
impl Body {
|
||||||
pub fn random() -> Self {
|
pub fn random() -> Self {
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
Self {
|
let species = *(&ALL_SPECIES).choose(&mut rng).unwrap();
|
||||||
head: *(&ALL_HEADS).choose(&mut rng).unwrap(),
|
Self::random_with(&mut rng, &species)
|
||||||
torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(),
|
}
|
||||||
rear: *(&ALL_REARS).choose(&mut rng).unwrap(),
|
|
||||||
tail: *(&ALL_TAILS).choose(&mut rng).unwrap(),
|
#[inline]
|
||||||
fin_l: *(&ALL_FIN_LS).choose(&mut rng).unwrap(),
|
pub fn random_with(rng: &mut impl rand::Rng, &species: &Species) -> Self {
|
||||||
fin_r: *(&ALL_FIN_RS).choose(&mut rng).unwrap(),
|
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::FishMedium(body) }
|
||||||
|
}
|
||||||
|
|
||||||
|
make_case_elim!(
|
||||||
|
species,
|
||||||
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
#[repr(u32)]
|
||||||
|
pub enum Species {
|
||||||
|
Marlin = 0,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Data representing per-species generic data.
|
||||||
|
///
|
||||||
|
/// NOTE: Deliberately don't (yet?) implement serialize.
|
||||||
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
|
pub struct AllSpecies<SpeciesMeta> {
|
||||||
|
pub marlin: 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::Marlin => &self.marlin,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_case_elim!(
|
pub const ALL_SPECIES: [Species; 1] = [Species::Marlin];
|
||||||
head,
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
||||||
#[repr(u32)]
|
|
||||||
pub enum Head {
|
|
||||||
Default = 0,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const ALL_HEADS: [Head; 1] = [Head::Default];
|
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||||
|
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||||
|
type Item = Species;
|
||||||
|
|
||||||
|
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
|
||||||
|
}
|
||||||
|
|
||||||
make_case_elim!(
|
make_case_elim!(
|
||||||
torso,
|
body_type,
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum Torso {
|
pub enum BodyType {
|
||||||
Default = 0,
|
Female = 0,
|
||||||
|
Male = 1,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
|
pub const ALL_BODY_TYPES: [BodyType; 2] = [BodyType::Female, BodyType::Male];
|
||||||
|
|
||||||
make_case_elim!(
|
|
||||||
rear,
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
||||||
#[repr(u32)]
|
|
||||||
pub enum Rear {
|
|
||||||
Default = 0,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
const ALL_REARS: [Rear; 1] = [Rear::Default];
|
|
||||||
|
|
||||||
make_case_elim!(
|
|
||||||
tail,
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
||||||
#[repr(u32)]
|
|
||||||
pub enum Tail {
|
|
||||||
Default = 0,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
const ALL_TAILS: [Tail; 1] = [Tail::Default];
|
|
||||||
|
|
||||||
make_case_elim!(
|
|
||||||
fin_l,
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
||||||
#[repr(u32)]
|
|
||||||
pub enum FinL {
|
|
||||||
Default = 0,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
const ALL_FIN_LS: [FinL; 1] = [FinL::Default];
|
|
||||||
|
|
||||||
make_case_elim!(
|
|
||||||
fin_r,
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
||||||
#[repr(u32)]
|
|
||||||
pub enum FinR {
|
|
||||||
Default = 0,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
const ALL_FIN_RS: [FinR; 1] = [FinR::Default];
|
|
||||||
|
@ -6,39 +6,73 @@ make_proj_elim!(
|
|||||||
body,
|
body,
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
pub struct Body {
|
pub struct Body {
|
||||||
pub torso: Torso,
|
pub species: Species,
|
||||||
pub tail: Tail,
|
pub body_type: BodyType,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
impl Body {
|
impl Body {
|
||||||
pub fn random() -> Self {
|
pub fn random() -> Self {
|
||||||
let mut rng = thread_rng();
|
let mut rng = thread_rng();
|
||||||
Self {
|
let species = *(&ALL_SPECIES).choose(&mut rng).unwrap();
|
||||||
torso: *(&ALL_TORSOS).choose(&mut rng).unwrap(),
|
Self::random_with(&mut rng, &species)
|
||||||
tail: *(&ALL_TAILS).choose(&mut rng).unwrap(),
|
}
|
||||||
|
|
||||||
|
#[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::FishSmall(body) }
|
||||||
|
}
|
||||||
|
|
||||||
|
make_case_elim!(
|
||||||
|
species,
|
||||||
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
|
#[repr(u32)]
|
||||||
|
pub enum Species {
|
||||||
|
Sardine = 0,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Data representing per-species generic data.
|
||||||
|
///
|
||||||
|
/// NOTE: Deliberately don't (yet?) implement serialize.
|
||||||
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
|
pub struct AllSpecies<SpeciesMeta> {
|
||||||
|
pub sardine: 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::Sardine => &self.sardine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_case_elim!(
|
pub const ALL_SPECIES: [Species; 1] = [Species::Sardine];
|
||||||
torso,
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
||||||
#[repr(u32)]
|
|
||||||
pub enum Torso {
|
|
||||||
Default = 0,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const ALL_TORSOS: [Torso; 1] = [Torso::Default];
|
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||||
|
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||||
|
type Item = Species;
|
||||||
|
|
||||||
|
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
|
||||||
|
}
|
||||||
|
|
||||||
make_case_elim!(
|
make_case_elim!(
|
||||||
tail,
|
body_type,
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
pub enum Tail {
|
pub enum BodyType {
|
||||||
Default = 0,
|
Female = 0,
|
||||||
|
Male = 1,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
pub const ALL_BODY_TYPES: [BodyType; 2] = [BodyType::Female, BodyType::Male];
|
||||||
const ALL_TAILS: [Tail; 1] = [Tail::Default];
|
|
||||||
|
@ -121,6 +121,8 @@ impl EntityInfo {
|
|||||||
Some(get_npc_name(&NPC_NAMES.quadruped_medium, body.species))
|
Some(get_npc_name(&NPC_NAMES.quadruped_medium, body.species))
|
||||||
},
|
},
|
||||||
Body::BirdMedium(body) => Some(get_npc_name(&NPC_NAMES.bird_medium, body.species)),
|
Body::BirdMedium(body) => Some(get_npc_name(&NPC_NAMES.bird_medium, body.species)),
|
||||||
|
Body::FishSmall(body) => Some(get_npc_name(&NPC_NAMES.fish_small, body.species)),
|
||||||
|
Body::FishMedium(body) => Some(get_npc_name(&NPC_NAMES.fish_medium, body.species)),
|
||||||
Body::Theropod(body) => Some(get_npc_name(&NPC_NAMES.theropod, body.species)),
|
Body::Theropod(body) => Some(get_npc_name(&NPC_NAMES.theropod, body.species)),
|
||||||
Body::QuadrupedSmall(body) => {
|
Body::QuadrupedSmall(body) => {
|
||||||
Some(get_npc_name(&NPC_NAMES.quadruped_small, body.species))
|
Some(get_npc_name(&NPC_NAMES.quadruped_small, body.species))
|
||||||
|
@ -13,6 +13,8 @@ pub enum NpcKind {
|
|||||||
Wolf,
|
Wolf,
|
||||||
Pig,
|
Pig,
|
||||||
Duck,
|
Duck,
|
||||||
|
Sardine,
|
||||||
|
Marlin,
|
||||||
Ogre,
|
Ogre,
|
||||||
Archaeos,
|
Archaeos,
|
||||||
StoneGolem,
|
StoneGolem,
|
||||||
@ -20,11 +22,13 @@ pub enum NpcKind {
|
|||||||
Crocodile,
|
Crocodile,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const ALL_NPCS: [NpcKind; 9] = [
|
pub const ALL_NPCS: [NpcKind; 11] = [
|
||||||
NpcKind::Humanoid,
|
NpcKind::Humanoid,
|
||||||
NpcKind::Wolf,
|
NpcKind::Wolf,
|
||||||
NpcKind::Pig,
|
NpcKind::Pig,
|
||||||
NpcKind::Duck,
|
NpcKind::Duck,
|
||||||
|
NpcKind::Sardine,
|
||||||
|
NpcKind::Marlin,
|
||||||
NpcKind::Ogre,
|
NpcKind::Ogre,
|
||||||
NpcKind::Archaeos,
|
NpcKind::Archaeos,
|
||||||
NpcKind::StoneGolem,
|
NpcKind::StoneGolem,
|
||||||
@ -93,6 +97,8 @@ pub fn kind_to_body(kind: NpcKind) -> Body {
|
|||||||
NpcKind::Pig => comp::quadruped_small::Body::random().into(),
|
NpcKind::Pig => comp::quadruped_small::Body::random().into(),
|
||||||
NpcKind::Wolf => comp::quadruped_medium::Body::random().into(),
|
NpcKind::Wolf => comp::quadruped_medium::Body::random().into(),
|
||||||
NpcKind::Duck => comp::bird_medium::Body::random().into(),
|
NpcKind::Duck => comp::bird_medium::Body::random().into(),
|
||||||
|
NpcKind::Sardine => comp::fish_small::Body::random().into(),
|
||||||
|
NpcKind::Marlin => comp::fish_medium::Body::random().into(),
|
||||||
NpcKind::Ogre => comp::biped_large::Body::random().into(),
|
NpcKind::Ogre => comp::biped_large::Body::random().into(),
|
||||||
NpcKind::Archaeos => comp::theropod::Body::random().into(),
|
NpcKind::Archaeos => comp::theropod::Body::random().into(),
|
||||||
NpcKind::StoneGolem => comp::golem::Body::random().into(),
|
NpcKind::StoneGolem => comp::golem::Body::random().into(),
|
||||||
@ -195,6 +201,22 @@ impl NpcBody {
|
|||||||
comp::bird_medium::Body::random_with,
|
comp::bird_medium::Body::random_with,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
.or_else(|| {
|
||||||
|
parse(
|
||||||
|
s,
|
||||||
|
NpcKind::Sardine,
|
||||||
|
&npc_names.fish_small,
|
||||||
|
comp::fish_small::Body::random_with,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.or_else(|| {
|
||||||
|
parse(
|
||||||
|
s,
|
||||||
|
NpcKind::Marlin,
|
||||||
|
&npc_names.fish_medium,
|
||||||
|
comp::fish_medium::Body::random_with,
|
||||||
|
)
|
||||||
|
})
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
parse(
|
parse(
|
||||||
s,
|
s,
|
||||||
|
@ -58,10 +58,10 @@ impl Body {
|
|||||||
quadruped_medium::Species::Horse => 180.0,
|
quadruped_medium::Species::Horse => 180.0,
|
||||||
},
|
},
|
||||||
Body::BirdMedium(_) => 80.0,
|
Body::BirdMedium(_) => 80.0,
|
||||||
Body::FishMedium(_) => 50.0,
|
Body::FishMedium(_) => 80.0,
|
||||||
Body::Dragon(_) => 250.0,
|
Body::Dragon(_) => 250.0,
|
||||||
Body::BirdSmall(_) => 75.0,
|
Body::BirdSmall(_) => 75.0,
|
||||||
Body::FishSmall(_) => 40.0,
|
Body::FishSmall(_) => 60.0,
|
||||||
Body::BipedLarge(_) => 75.0,
|
Body::BipedLarge(_) => 75.0,
|
||||||
Body::Object(_) => 40.0,
|
Body::Object(_) => 40.0,
|
||||||
Body::Golem(_) => 60.0,
|
Body::Golem(_) => 60.0,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
||||||
//use std::{f32::consts::PI, ops::Mul};
|
//use std::{f32::consts::PI, ops::Mul};
|
||||||
use super::super::vek::*;
|
use super::super::vek::*;
|
||||||
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
@ -15,36 +16,38 @@ impl Animation for IdleAnimation {
|
|||||||
fn update_skeleton_inner(
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
_global_time: Self::Dependency,
|
_global_time: Self::Dependency,
|
||||||
_anim_time: f64,
|
anim_time: f64,
|
||||||
_rate: &mut f32,
|
_rate: &mut f32,
|
||||||
_skeleton_attr: &SkeletonAttr,
|
s_a: &SkeletonAttr,
|
||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
next.head.scale = Vec3::one() / 10.88;
|
let slower = (anim_time as f32 * 1.0 + PI).sin();
|
||||||
next.torso.scale = Vec3::one() * 1.01;
|
let slow = (anim_time as f32 * 3.5 + PI).sin();
|
||||||
next.rear.scale = Vec3::one() * 0.98;
|
let slowalt = (anim_time as f32 * 3.5 + PI + 0.2).sin();
|
||||||
next.tail.scale = Vec3::one() / 11.0;
|
|
||||||
next.fin_l.scale = Vec3::one() / 11.0;
|
|
||||||
next.fin_r.scale = Vec3::one() / 10.5;
|
|
||||||
|
|
||||||
next.head.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
next.chest_front.scale = Vec3::one() / 11.0;
|
||||||
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
|
||||||
|
|
||||||
next.torso.position = Vec3::new(0.0, 4.5, 2.0);
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
next.torso.orientation = Quaternion::rotation_x(0.0);
|
next.head.orientation = Quaternion::rotation_z(slowalt * -0.1);
|
||||||
|
|
||||||
next.rear.position = Vec3::new(0.0, 3.1, -4.5);
|
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||||
next.rear.orientation = Quaternion::rotation_z(0.0);
|
next.jaw.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, -13.0, 8.0) / 11.0;
|
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1) / 11.0;
|
||||||
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
next.chest_front.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.fin_l.position = Vec3::new(0.0, -11.7, 11.0) / 11.0;
|
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
|
||||||
next.fin_l.orientation = Quaternion::rotation_y(0.0);
|
next.chest_back.orientation = Quaternion::rotation_z(slowalt * 0.1);
|
||||||
|
|
||||||
next.fin_r.position = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
next.fin_r.orientation = Quaternion::rotation_y(0.0);
|
next.tail.orientation = Quaternion::rotation_z(slow * 0.1);
|
||||||
|
|
||||||
|
next.fin_l.position = Vec3::new(-s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_l.orientation = Quaternion::rotation_z(slow * 0.1 - 0.1);
|
||||||
|
|
||||||
|
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_r.orientation = Quaternion::rotation_z(-slow * 0.1 + 0.1);
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,33 +17,31 @@ impl Animation for JumpAnimation {
|
|||||||
_global_time: Self::Dependency,
|
_global_time: Self::Dependency,
|
||||||
_anim_time: f64,
|
_anim_time: f64,
|
||||||
_rate: &mut f32,
|
_rate: &mut f32,
|
||||||
_skeleton_attr: &SkeletonAttr,
|
s_a: &SkeletonAttr,
|
||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
next.head.scale = Vec3::one() / 10.88;
|
next.chest_front.scale = Vec3::one() / 11.0;
|
||||||
next.torso.scale = Vec3::one() * 1.01;
|
|
||||||
next.rear.scale = Vec3::one() * 0.98;
|
|
||||||
next.tail.scale = Vec3::one() / 11.0;
|
|
||||||
next.fin_l.scale = Vec3::one() / 11.0;
|
|
||||||
next.fin_r.scale = Vec3::one() / 10.5;
|
|
||||||
|
|
||||||
next.head.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.torso.position = Vec3::new(0.0, 4.5, 2.0);
|
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||||
next.torso.orientation = Quaternion::rotation_x(0.0);
|
next.jaw.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.rear.position = Vec3::new(0.0, 3.1, -4.5);
|
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1) / 11.0;
|
||||||
next.rear.orientation = Quaternion::rotation_z(0.0);
|
next.chest_front.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, -13.0, 8.0) / 11.0;
|
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
|
||||||
|
next.chest_back.orientation = Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.fin_l.position = Vec3::new(0.0, -11.7, 11.0) / 11.0;
|
next.fin_l.position = Vec3::new(-s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
next.fin_l.orientation = Quaternion::rotation_y(0.0);
|
next.fin_l.orientation = Quaternion::rotation_y(0.0);
|
||||||
|
|
||||||
next.fin_r.position = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
next.fin_r.orientation = Quaternion::rotation_y(0.0);
|
next.fin_r.orientation = Quaternion::rotation_y(0.0);
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
pub mod idle;
|
pub mod idle;
|
||||||
pub mod jump;
|
pub mod jump;
|
||||||
pub mod run;
|
pub mod run;
|
||||||
|
pub mod swim;
|
||||||
|
pub mod swimidle;
|
||||||
|
|
||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
pub use self::{
|
||||||
|
idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, swim::SwimAnimation,
|
||||||
|
swimidle::SwimIdleAnimation,
|
||||||
|
};
|
||||||
|
|
||||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||||
use common::comp::{self};
|
use common::comp::{self};
|
||||||
@ -13,8 +18,9 @@ pub type Body = comp::fish_medium::Body;
|
|||||||
|
|
||||||
skeleton_impls!(struct FishMediumSkeleton {
|
skeleton_impls!(struct FishMediumSkeleton {
|
||||||
+ head,
|
+ head,
|
||||||
+ torso,
|
+ jaw,
|
||||||
+ rear,
|
+ chest_front,
|
||||||
|
+ chest_back,
|
||||||
+ tail,
|
+ tail,
|
||||||
+ fin_l,
|
+ fin_l,
|
||||||
+ fin_r,
|
+ fin_r,
|
||||||
@ -24,7 +30,7 @@ impl Skeleton for FishMediumSkeleton {
|
|||||||
type Attr = SkeletonAttr;
|
type Attr = SkeletonAttr;
|
||||||
type Body = Body;
|
type Body = Body;
|
||||||
|
|
||||||
const BONE_COUNT: usize = 6;
|
const BONE_COUNT: usize = 7;
|
||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
const COMPUTE_FN: &'static [u8] = b"fish_medium_compute_mats\0";
|
const COMPUTE_FN: &'static [u8] = b"fish_medium_compute_mats\0";
|
||||||
|
|
||||||
@ -34,22 +40,31 @@ impl Skeleton for FishMediumSkeleton {
|
|||||||
base_mat: Mat4<f32>,
|
base_mat: Mat4<f32>,
|
||||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||||
) -> Vec3<f32> {
|
) -> Vec3<f32> {
|
||||||
let torso_mat = base_mat * Mat4::<f32>::from(self.torso);
|
let chest_front_mat = base_mat * Mat4::<f32>::from(self.chest_front);
|
||||||
let rear_mat = torso_mat * Mat4::<f32>::from(self.rear);
|
let chest_back_mat = Mat4::<f32>::from(self.chest_back);
|
||||||
|
let head_mat = Mat4::<f32>::from(self.head);
|
||||||
|
|
||||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||||
make_bone(torso_mat * Mat4::<f32>::from(self.head)),
|
make_bone(chest_front_mat * head_mat),
|
||||||
make_bone(torso_mat),
|
make_bone(chest_front_mat * head_mat * Mat4::<f32>::from(self.jaw)),
|
||||||
make_bone(rear_mat),
|
make_bone(chest_front_mat),
|
||||||
make_bone(rear_mat * Mat4::<f32>::from(self.tail)),
|
make_bone(chest_front_mat * chest_back_mat),
|
||||||
make_bone(rear_mat * Mat4::<f32>::from(self.fin_l)),
|
make_bone(chest_front_mat * chest_back_mat * Mat4::<f32>::from(self.tail)),
|
||||||
make_bone(rear_mat * Mat4::<f32>::from(self.fin_r)),
|
make_bone(chest_front_mat * Mat4::<f32>::from(self.fin_l)),
|
||||||
|
make_bone(chest_front_mat * Mat4::<f32>::from(self.fin_r)),
|
||||||
];
|
];
|
||||||
Vec3::default()
|
Vec3::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SkeletonAttr;
|
pub struct SkeletonAttr {
|
||||||
|
head: (f32, f32),
|
||||||
|
jaw: (f32, f32),
|
||||||
|
chest_front: (f32, f32),
|
||||||
|
chest_back: (f32, f32),
|
||||||
|
tail: (f32, f32),
|
||||||
|
fin: (f32, f32, f32),
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
|
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
@ -63,9 +78,40 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SkeletonAttr {
|
impl Default for SkeletonAttr {
|
||||||
fn default() -> Self { Self }
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
head: (0.0, 0.0),
|
||||||
|
jaw: (0.0, 0.0),
|
||||||
|
chest_front: (0.0, 0.0),
|
||||||
|
chest_back: (0.0, 0.0),
|
||||||
|
tail: (0.0, 0.0),
|
||||||
|
fin: (0.0, 0.0, 0.0),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a Body> for SkeletonAttr {
|
impl<'a> From<&'a Body> for SkeletonAttr {
|
||||||
fn from(_body: &'a Body) -> Self { Self }
|
fn from(body: &'a Body) -> Self {
|
||||||
|
use comp::fish_medium::Species::*;
|
||||||
|
Self {
|
||||||
|
head: match (body.species, body.body_type) {
|
||||||
|
(Marlin, _) => (2.0, 1.5),
|
||||||
|
},
|
||||||
|
jaw: match (body.species, body.body_type) {
|
||||||
|
(Marlin, _) => (2.5, -3.0),
|
||||||
|
},
|
||||||
|
chest_front: match (body.species, body.body_type) {
|
||||||
|
(Marlin, _) => (0.0, 2.5),
|
||||||
|
},
|
||||||
|
chest_back: match (body.species, body.body_type) {
|
||||||
|
(Marlin, _) => (-1.0, 1.0),
|
||||||
|
},
|
||||||
|
tail: match (body.species, body.body_type) {
|
||||||
|
(Marlin, _) => (-7.0, 0.0),
|
||||||
|
},
|
||||||
|
fin: match (body.species, body.body_type) {
|
||||||
|
(Marlin, _) => (2.5, 1.0, 3.5),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,33 +17,31 @@ impl Animation for RunAnimation {
|
|||||||
_global_time: Self::Dependency,
|
_global_time: Self::Dependency,
|
||||||
_anim_time: f64,
|
_anim_time: f64,
|
||||||
_rate: &mut f32,
|
_rate: &mut f32,
|
||||||
_skeleton_attr: &SkeletonAttr,
|
s_a: &SkeletonAttr,
|
||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
next.head.scale = Vec3::one() / 10.88;
|
next.chest_front.scale = Vec3::one() / 11.0;
|
||||||
next.torso.scale = Vec3::one() * 1.01;
|
|
||||||
next.rear.scale = Vec3::one() * 0.98;
|
|
||||||
next.tail.scale = Vec3::one() / 11.0;
|
|
||||||
next.fin_l.scale = Vec3::one() / 11.0;
|
|
||||||
next.fin_r.scale = Vec3::one() / 10.5;
|
|
||||||
|
|
||||||
next.head.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.torso.position = Vec3::new(0.0, 4.5, 2.0);
|
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||||
next.torso.orientation = Quaternion::rotation_x(0.0);
|
next.jaw.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.rear.position = Vec3::new(0.0, 3.1, -4.5);
|
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1) / 11.0;
|
||||||
next.rear.orientation = Quaternion::rotation_z(0.0);
|
next.chest_front.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, -13.0, 8.0) / 11.0;
|
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
|
||||||
|
next.chest_back.orientation = Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
next.fin_l.position = Vec3::new(0.0, -11.7, 11.0) / 11.0;
|
next.fin_l.position = Vec3::new(-s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
next.fin_l.orientation = Quaternion::rotation_y(0.0);
|
next.fin_l.orientation = Quaternion::rotation_y(0.0);
|
||||||
|
|
||||||
next.fin_r.position = Vec3::new(0.0, 0.0, 12.0) / 11.0;
|
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
next.fin_r.orientation = Quaternion::rotation_y(0.0);
|
next.fin_r.orientation = Quaternion::rotation_y(0.0);
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -17,18 +17,26 @@ impl Animation for IdleAnimation {
|
|||||||
_global_time: Self::Dependency,
|
_global_time: Self::Dependency,
|
||||||
_anim_time: f64,
|
_anim_time: f64,
|
||||||
_rate: &mut f32,
|
_rate: &mut f32,
|
||||||
_skeleton_attr: &SkeletonAttr,
|
s_a: &SkeletonAttr,
|
||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
next.torso.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
next.head.scale = Vec3::one() / 11.0;
|
||||||
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
|
||||||
next.torso.scale = Vec3::one() / 10.88;
|
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, 4.5, 2.0);
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
next.tail.orientation = Quaternion::rotation_x(0.0);
|
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
next.tail.scale = Vec3::one() * 1.01;
|
|
||||||
|
|
||||||
|
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 11.0;
|
||||||
|
next.chest.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
|
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.fin_l.position = Vec3::new(-s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_l.orientation = Quaternion::rotation_y(0.0);
|
||||||
|
|
||||||
|
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_r.orientation = Quaternion::rotation_y(0.0);
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,18 +17,26 @@ impl Animation for JumpAnimation {
|
|||||||
_global_time: Self::Dependency,
|
_global_time: Self::Dependency,
|
||||||
_anim_time: f64,
|
_anim_time: f64,
|
||||||
_rate: &mut f32,
|
_rate: &mut f32,
|
||||||
_skeleton_attr: &SkeletonAttr,
|
s_a: &SkeletonAttr,
|
||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
next.torso.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
next.head.scale = Vec3::one() / 11.0;
|
||||||
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
|
||||||
next.torso.scale = Vec3::one() / 10.88;
|
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, 4.5, 2.0);
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
next.tail.orientation = Quaternion::rotation_x(0.0);
|
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
next.tail.scale = Vec3::one() * 1.01;
|
|
||||||
|
|
||||||
|
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 11.0;
|
||||||
|
next.chest.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
|
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.fin_l.position = Vec3::new(-s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_l.orientation = Quaternion::rotation_y(0.0);
|
||||||
|
|
||||||
|
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_r.orientation = Quaternion::rotation_y(0.0);
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
pub mod idle;
|
pub mod idle;
|
||||||
pub mod jump;
|
pub mod jump;
|
||||||
pub mod run;
|
pub mod run;
|
||||||
|
pub mod swim;
|
||||||
|
|
||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, swim::SwimAnimation};
|
||||||
|
|
||||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||||
use common::comp::{self};
|
use common::comp::{self};
|
||||||
@ -12,36 +13,46 @@ use core::convert::TryFrom;
|
|||||||
pub type Body = comp::fish_small::Body;
|
pub type Body = comp::fish_small::Body;
|
||||||
|
|
||||||
skeleton_impls!(struct FishSmallSkeleton {
|
skeleton_impls!(struct FishSmallSkeleton {
|
||||||
+ torso,
|
+ head,
|
||||||
|
+ chest,
|
||||||
+ tail,
|
+ tail,
|
||||||
|
+ fin_l,
|
||||||
|
+ fin_r,
|
||||||
});
|
});
|
||||||
|
|
||||||
impl Skeleton for FishSmallSkeleton {
|
impl Skeleton for FishSmallSkeleton {
|
||||||
type Attr = SkeletonAttr;
|
type Attr = SkeletonAttr;
|
||||||
type Body = Body;
|
type Body = Body;
|
||||||
|
|
||||||
const BONE_COUNT: usize = 2;
|
const BONE_COUNT: usize = 5;
|
||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
const COMPUTE_FN: &'static [u8] = b"fish_small_compute_mats\0";
|
const COMPUTE_FN: &'static [u8] = b"fish_small_compute_mats\0";
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_small_compute_mats")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_small_compute_mats")]
|
||||||
|
|
||||||
fn compute_matrices_inner(
|
fn compute_matrices_inner(
|
||||||
&self,
|
&self,
|
||||||
base_mat: Mat4<f32>,
|
base_mat: Mat4<f32>,
|
||||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||||
) -> Vec3<f32> {
|
) -> Vec3<f32> {
|
||||||
let torso_mat = base_mat * Mat4::<f32>::from(self.torso);
|
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
|
||||||
|
|
||||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||||
make_bone(torso_mat),
|
make_bone(chest_mat * Mat4::<f32>::from(self.head)),
|
||||||
make_bone(torso_mat * Mat4::<f32>::from(self.tail)),
|
make_bone(chest_mat),
|
||||||
|
make_bone(chest_mat * Mat4::<f32>::from(self.tail)),
|
||||||
|
make_bone(chest_mat * Mat4::<f32>::from(self.fin_l)),
|
||||||
|
make_bone(chest_mat * Mat4::<f32>::from(self.fin_r)),
|
||||||
];
|
];
|
||||||
Vec3::default()
|
Vec3::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SkeletonAttr;
|
pub struct SkeletonAttr {
|
||||||
|
head: (f32, f32),
|
||||||
|
chest: (f32, f32),
|
||||||
|
tail: (f32, f32),
|
||||||
|
fin: (f32, f32, f32),
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
|
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
|
||||||
type Error = ();
|
type Error = ();
|
||||||
@ -55,9 +66,32 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Default for SkeletonAttr {
|
impl Default for SkeletonAttr {
|
||||||
fn default() -> Self { Self }
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
head: (0.0, 0.0),
|
||||||
|
chest: (0.0, 0.0),
|
||||||
|
tail: (0.0, 0.0),
|
||||||
|
fin: (0.0, 0.0, 0.0),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<&'a Body> for SkeletonAttr {
|
impl<'a> From<&'a Body> for SkeletonAttr {
|
||||||
fn from(_body: &'a Body) -> Self { Self }
|
fn from(body: &'a Body) -> Self {
|
||||||
|
use comp::fish_small::Species::*;
|
||||||
|
Self {
|
||||||
|
head: match (body.species, body.body_type) {
|
||||||
|
(Sardine, _) => (1.5, 2.0),
|
||||||
|
},
|
||||||
|
chest: match (body.species, body.body_type) {
|
||||||
|
(Sardine, _) => (0.0, 5.0),
|
||||||
|
},
|
||||||
|
tail: match (body.species, body.body_type) {
|
||||||
|
(Sardine, _) => (-6.0, 0.0),
|
||||||
|
},
|
||||||
|
fin: match (body.species, body.body_type) {
|
||||||
|
(Sardine, _) => (3.5, 6.0, -1.0),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,18 +17,26 @@ impl Animation for RunAnimation {
|
|||||||
(_velocity, _global_time): Self::Dependency,
|
(_velocity, _global_time): Self::Dependency,
|
||||||
_anim_time: f64,
|
_anim_time: f64,
|
||||||
_rate: &mut f32,
|
_rate: &mut f32,
|
||||||
_skeleton_attr: &SkeletonAttr,
|
s_a: &SkeletonAttr,
|
||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
next.torso.position = Vec3::new(0.0, 7.5, 15.0) / 11.0;
|
next.head.scale = Vec3::one() / 11.0;
|
||||||
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
|
||||||
next.torso.scale = Vec3::one() / 10.88;
|
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, 4.5, 2.0);
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
next.tail.orientation = Quaternion::rotation_x(0.0);
|
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
next.tail.scale = Vec3::one() * 1.01;
|
|
||||||
|
|
||||||
|
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 11.0;
|
||||||
|
next.chest.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
|
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.fin_l.position = Vec3::new(-s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_l.orientation = Quaternion::rotation_y(0.0);
|
||||||
|
|
||||||
|
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_r.orientation = Quaternion::rotation_y(0.0);
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
78
voxygen/src/anim/src/fish_medium/swim.rs
Normal file
78
voxygen/src/anim/src/fish_medium/swim.rs
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
FishMediumSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
|
pub struct SwimAnimation;
|
||||||
|
|
||||||
|
type SwimAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
|
||||||
|
|
||||||
|
impl Animation for SwimAnimation {
|
||||||
|
type Dependency = SwimAnimationDependency;
|
||||||
|
type Skeleton = FishMediumSkeleton;
|
||||||
|
|
||||||
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const UPDATE_FN: &'static [u8] = b"fish_medium_swim\0";
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_medium_swim")]
|
||||||
|
|
||||||
|
fn update_skeleton_inner(
|
||||||
|
skeleton: &Self::Skeleton,
|
||||||
|
(velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
|
||||||
|
anim_time: f64,
|
||||||
|
rate: &mut f32,
|
||||||
|
s_a: &SkeletonAttr,
|
||||||
|
) -> Self::Skeleton {
|
||||||
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
|
let slower = (anim_time as f32 * 1.0 + PI).sin();
|
||||||
|
let slow = (anim_time as f32 * 3.5 + PI).sin();
|
||||||
|
let slowalt = (anim_time as f32 * 3.5 + PI + 0.2).sin();
|
||||||
|
let fast = (anim_time as f32 * 5.5 + PI).sin();
|
||||||
|
let fastalt = (anim_time as f32 * 5.5 + PI + 0.2).sin();
|
||||||
|
|
||||||
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
|
let last_ori = Vec2::from(last_ori);
|
||||||
|
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
||||||
|
.map(|o| o.magnitude_squared())
|
||||||
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
|
.reduce_and()
|
||||||
|
&& ori.angle_between(last_ori).is_finite()
|
||||||
|
{
|
||||||
|
ori.angle_between(last_ori).min(0.8)
|
||||||
|
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||||
|
} else {
|
||||||
|
0.0
|
||||||
|
} * 1.3;
|
||||||
|
let abstilt = tilt.abs();
|
||||||
|
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
|
||||||
|
|
||||||
|
let squash = if abstilt > 0.2 { 0.35 } else { 1.0 }; //condenses the body at strong turns
|
||||||
|
|
||||||
|
next.chest_front.scale = Vec3::one() / 11.0;
|
||||||
|
|
||||||
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
|
next.head.orientation = Quaternion::rotation_z(slowalt * -0.1 + tilt * -2.0);
|
||||||
|
|
||||||
|
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||||
|
next.jaw.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1) / 11.0;
|
||||||
|
next.chest_front.orientation =
|
||||||
|
Quaternion::rotation_x(velocity.z.abs() * -0.005 + abstilt * 1.0 + x_tilt);
|
||||||
|
|
||||||
|
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
|
||||||
|
next.chest_back.orientation = Quaternion::rotation_z(fastalt * 0.3 + tilt * 2.0);
|
||||||
|
|
||||||
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
|
next.tail.orientation = Quaternion::rotation_z(fast * 0.3 + tilt * 2.0);
|
||||||
|
|
||||||
|
next.fin_l.position = Vec3::new(-s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_l.orientation = Quaternion::rotation_z(fast * 0.3 - 0.1 + tilt * -0.5);
|
||||||
|
|
||||||
|
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_r.orientation = Quaternion::rotation_z(-fast * 0.3 + 0.1 + tilt * -0.5);
|
||||||
|
next
|
||||||
|
}
|
||||||
|
}
|
57
voxygen/src/anim/src/fish_medium/swimidle.rs
Normal file
57
voxygen/src/anim/src/fish_medium/swimidle.rs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
FishMediumSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
|
|
||||||
|
pub struct SwimIdleAnimation;
|
||||||
|
|
||||||
|
type SwimIdleAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
|
||||||
|
|
||||||
|
impl Animation for SwimIdleAnimation {
|
||||||
|
type Dependency = SwimIdleAnimationDependency;
|
||||||
|
type Skeleton = FishMediumSkeleton;
|
||||||
|
|
||||||
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const UPDATE_FN: &'static [u8] = b"fish_medium_swimidle\0";
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_medium_swimidle")]
|
||||||
|
|
||||||
|
fn update_skeleton_inner(
|
||||||
|
skeleton: &Self::Skeleton,
|
||||||
|
(velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
|
||||||
|
anim_time: f64,
|
||||||
|
rate: &mut f32,
|
||||||
|
s_a: &SkeletonAttr,
|
||||||
|
) -> Self::Skeleton {
|
||||||
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
|
let slower = (anim_time as f32 * 1.0 + PI).sin();
|
||||||
|
let slow = (anim_time as f32 * 3.5 + PI).sin();
|
||||||
|
let slowalt = (anim_time as f32 * 3.5 + PI + 0.2).sin();
|
||||||
|
|
||||||
|
next.chest_front.scale = Vec3::one() / 11.0;
|
||||||
|
|
||||||
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
|
next.head.orientation = Quaternion::rotation_z(slowalt * -0.1);
|
||||||
|
|
||||||
|
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
|
||||||
|
next.jaw.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1) / 11.0;
|
||||||
|
next.chest_front.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
|
||||||
|
next.chest_back.orientation = Quaternion::rotation_z(slowalt * 0.1);
|
||||||
|
|
||||||
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
|
next.tail.orientation = Quaternion::rotation_z(slow * 0.1);
|
||||||
|
|
||||||
|
next.fin_l.position = Vec3::new(-s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_l.orientation = Quaternion::rotation_z(slow * 0.1 - 0.1);
|
||||||
|
|
||||||
|
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_r.orientation = Quaternion::rotation_z(-slow * 0.1 + 0.1);
|
||||||
|
next
|
||||||
|
}
|
||||||
|
}
|
46
voxygen/src/anim/src/fish_small/swim.rs
Normal file
46
voxygen/src/anim/src/fish_small/swim.rs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
FishSmallSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct SwimAnimation;
|
||||||
|
|
||||||
|
type SwimAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
|
||||||
|
|
||||||
|
impl Animation for SwimAnimation {
|
||||||
|
type Dependency = SwimAnimationDependency;
|
||||||
|
type Skeleton = FishSmallSkeleton;
|
||||||
|
|
||||||
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const UPDATE_FN: &'static [u8] = b"fish_small_swim\0";
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_small_swim")]
|
||||||
|
|
||||||
|
fn update_skeleton_inner(
|
||||||
|
skeleton: &Self::Skeleton,
|
||||||
|
(velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
|
||||||
|
_anim_time: f64,
|
||||||
|
_rate: &mut f32,
|
||||||
|
s_a: &SkeletonAttr,
|
||||||
|
) -> Self::Skeleton {
|
||||||
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
|
next.head.scale = Vec3::one() / 11.0;
|
||||||
|
|
||||||
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
|
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 11.0;
|
||||||
|
next.chest.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
|
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||||
|
|
||||||
|
next.fin_l.position = Vec3::new(-s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_l.orientation = Quaternion::rotation_y(0.0);
|
||||||
|
|
||||||
|
next.fin_r.position = Vec3::new(s_a.fin.0, s_a.fin.1, s_a.fin.2);
|
||||||
|
next.fin_r.orientation = Quaternion::rotation_y(0.0);
|
||||||
|
next
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,8 @@ use common::{
|
|||||||
bird_medium::{self, BodyType as BMBodyType, Species as BMSpecies},
|
bird_medium::{self, BodyType as BMBodyType, Species as BMSpecies},
|
||||||
bird_small,
|
bird_small,
|
||||||
dragon::{self, BodyType as DBodyType, Species as DSpecies},
|
dragon::{self, BodyType as DBodyType, Species as DSpecies},
|
||||||
fish_medium, fish_small,
|
fish_medium::{self, BodyType as FMBodyType, Species as FMSpecies},
|
||||||
|
fish_small::{self, BodyType as FSBodyType, Species as FSSpecies},
|
||||||
golem::{self, BodyType as GBodyType, Species as GSpecies},
|
golem::{self, BodyType as GBodyType, Species as GSpecies},
|
||||||
humanoid::{self, Body, BodyType, EyeColor, Skin, Species},
|
humanoid::{self, Body, BodyType, EyeColor, Skin, Species},
|
||||||
object,
|
object,
|
||||||
@ -2086,17 +2087,257 @@ impl TheropodLateralSpec {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
////
|
////
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct FishMediumCentralSpec(HashMap<(FMSpecies, FMBodyType), SidedFMCentralVoxSpec>);
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct SidedFMCentralVoxSpec {
|
||||||
|
head: FishMediumCentralSubSpec,
|
||||||
|
jaw: FishMediumCentralSubSpec,
|
||||||
|
chest_front: FishMediumCentralSubSpec,
|
||||||
|
chest_back: FishMediumCentralSubSpec,
|
||||||
|
tail: FishMediumCentralSubSpec,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct FishMediumCentralSubSpec {
|
||||||
|
offset: [f32; 3], // Should be relative to initial origin
|
||||||
|
central: VoxSimple,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct FishMediumLateralSpec(HashMap<(FMSpecies, FMBodyType), SidedFMLateralVoxSpec>);
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct SidedFMLateralVoxSpec {
|
||||||
|
fin_l: FishMediumLateralSubSpec,
|
||||||
|
fin_r: FishMediumLateralSubSpec,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct FishMediumLateralSubSpec {
|
||||||
|
offset: [f32; 3], // Should be relative to initial origin
|
||||||
|
lateral: VoxSimple,
|
||||||
|
}
|
||||||
|
|
||||||
make_vox_spec!(
|
make_vox_spec!(
|
||||||
fish_medium::Body,
|
fish_medium::Body,
|
||||||
struct FishMediumSpec {},
|
struct FishMediumSpec {
|
||||||
|FigureKey { body, .. }, _spec| {
|
central: FishMediumCentralSpec = "voxygen.voxel.fish_medium_central_manifest",
|
||||||
|
lateral: FishMediumLateralSpec = "voxygen.voxel.fish_medium_lateral_manifest",
|
||||||
|
},
|
||||||
|
|FigureKey { body, .. }, spec| {
|
||||||
[
|
[
|
||||||
Some(mesh_fish_medium_head(body.head)),
|
Some(spec.central.asset.mesh_head(
|
||||||
Some(mesh_fish_medium_torso(body.torso)),
|
body.species,
|
||||||
Some(mesh_fish_medium_rear(body.rear)),
|
body.body_type,
|
||||||
Some(mesh_fish_medium_tail(body.tail)),
|
)),
|
||||||
Some(mesh_fish_medium_fin_l(body.fin_l)),
|
Some(spec.central.asset.mesh_jaw(
|
||||||
Some(mesh_fish_medium_fin_r(body.fin_r)),
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
Some(spec.central.asset.mesh_chest_front(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
Some(spec.central.asset.mesh_chest_back(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
Some(spec.central.asset.mesh_tail(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
Some(spec.lateral.asset.mesh_fin_l(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
Some(spec.lateral.asset.mesh_fin_r(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
]
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
impl FishMediumCentralSpec {
|
||||||
|
fn mesh_head(&self, species: FMSpecies, body_type: FMBodyType) -> BoneMeshes {
|
||||||
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
|
Some(spec) => spec,
|
||||||
|
None => {
|
||||||
|
error!(
|
||||||
|
"No head specification exists for the combination of {:?} and {:?}",
|
||||||
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let central = graceful_load_segment(&spec.head.central.0);
|
||||||
|
|
||||||
|
(central, Vec3::from(spec.head.offset))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mesh_jaw(&self, species: FMSpecies, body_type: FMBodyType) -> BoneMeshes {
|
||||||
|
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));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let central = graceful_load_segment(&spec.jaw.central.0);
|
||||||
|
|
||||||
|
(central, Vec3::from(spec.jaw.offset))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mesh_chest_front(&self, species: FMSpecies, body_type: FMBodyType) -> BoneMeshes {
|
||||||
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
|
Some(spec) => spec,
|
||||||
|
None => {
|
||||||
|
error!(
|
||||||
|
"No front chest specification exists for the combination of {:?} and {:?}",
|
||||||
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let central = graceful_load_segment(&spec.chest_front.central.0);
|
||||||
|
|
||||||
|
(central, Vec3::from(spec.chest_front.offset))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mesh_chest_back(&self, species: FMSpecies, body_type: FMBodyType) -> BoneMeshes {
|
||||||
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
|
Some(spec) => spec,
|
||||||
|
None => {
|
||||||
|
error!(
|
||||||
|
"No back chest specification exists for the combination of {:?} and {:?}",
|
||||||
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let central = graceful_load_segment(&spec.chest_back.central.0);
|
||||||
|
|
||||||
|
(central, Vec3::from(spec.chest_back.offset))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mesh_tail(&self, species: FMSpecies, body_type: FMBodyType) -> BoneMeshes {
|
||||||
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
|
Some(spec) => spec,
|
||||||
|
None => {
|
||||||
|
error!(
|
||||||
|
"No tail specification exists for the combination of {:?} and {:?}",
|
||||||
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let central = graceful_load_segment(&spec.tail.central.0);
|
||||||
|
|
||||||
|
(central, Vec3::from(spec.tail.offset))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl FishMediumLateralSpec {
|
||||||
|
fn mesh_fin_l(&self, species: FMSpecies, body_type: FMBodyType) -> BoneMeshes {
|
||||||
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
|
Some(spec) => spec,
|
||||||
|
None => {
|
||||||
|
error!(
|
||||||
|
"No fin specification exists for the combination of {:?} and {:?}",
|
||||||
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let lateral = graceful_load_segment(&spec.fin_l.lateral.0);
|
||||||
|
|
||||||
|
(lateral, Vec3::from(spec.fin_l.offset))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mesh_fin_r(&self, species: FMSpecies, body_type: FMBodyType) -> BoneMeshes {
|
||||||
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
|
Some(spec) => spec,
|
||||||
|
None => {
|
||||||
|
error!(
|
||||||
|
"No fin specification exists for the combination of {:?} and {:?}",
|
||||||
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let lateral = graceful_load_segment(&spec.fin_r.lateral.0);
|
||||||
|
|
||||||
|
(lateral, Vec3::from(spec.fin_r.offset))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct FishSmallCentralSpec(HashMap<(FSSpecies, FSBodyType), SidedFSCentralVoxSpec>);
|
||||||
|
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct SidedFSCentralVoxSpec {
|
||||||
|
head: FishSmallCentralSubSpec,
|
||||||
|
chest: FishSmallCentralSubSpec,
|
||||||
|
tail: FishSmallCentralSubSpec,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct FishSmallCentralSubSpec {
|
||||||
|
offset: [f32; 3], // Should be relative to initial origin
|
||||||
|
central: VoxSimple,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct FishSmallLateralSpec(HashMap<(FSSpecies, FSBodyType), SidedFSLateralVoxSpec>);
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct SidedFSLateralVoxSpec {
|
||||||
|
fin_l: FishSmallLateralSubSpec,
|
||||||
|
fin_r: FishSmallLateralSubSpec,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
struct FishSmallLateralSubSpec {
|
||||||
|
offset: [f32; 3], // Should be relative to initial origin
|
||||||
|
lateral: VoxSimple,
|
||||||
|
}
|
||||||
|
|
||||||
|
make_vox_spec!(
|
||||||
|
fish_small::Body,
|
||||||
|
struct FishSmallSpec {
|
||||||
|
central: FishSmallCentralSpec = "voxygen.voxel.fish_small_central_manifest",
|
||||||
|
lateral: FishSmallLateralSpec = "voxygen.voxel.fish_small_lateral_manifest",
|
||||||
|
},
|
||||||
|
|FigureKey { body, .. }, spec| {
|
||||||
|
[
|
||||||
|
Some(spec.central.asset.mesh_head(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
Some(spec.central.asset.mesh_chest(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
Some(spec.central.asset.mesh_tail(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
Some(spec.lateral.asset.mesh_fin_l(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
Some(spec.lateral.asset.mesh_fin_r(
|
||||||
|
body.species,
|
||||||
|
body.body_type,
|
||||||
|
)),
|
||||||
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
@ -2111,58 +2352,88 @@ make_vox_spec!(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
fn mesh_fish_medium_head(head: fish_medium::Head) -> BoneMeshes {
|
impl FishSmallCentralSpec {
|
||||||
load_mesh(
|
fn mesh_head(&self, species: FSSpecies, body_type: FSBodyType) -> BoneMeshes {
|
||||||
match head {
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
fish_medium::Head::Default => "npc.marlin.head",
|
Some(spec) => spec,
|
||||||
},
|
None => {
|
||||||
Vec3::new(-7.0, -6.0, -6.0),
|
error!(
|
||||||
)
|
"No head specification exists for the combination of {:?} and {:?}",
|
||||||
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let central = graceful_load_segment(&spec.head.central.0);
|
||||||
|
|
||||||
|
(central, Vec3::from(spec.head.offset))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mesh_chest(&self, species: FSSpecies, body_type: FSBodyType) -> BoneMeshes {
|
||||||
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
|
Some(spec) => spec,
|
||||||
|
None => {
|
||||||
|
error!(
|
||||||
|
"No chest specification exists for the combination of {:?} and {:?}",
|
||||||
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let central = graceful_load_segment(&spec.chest.central.0);
|
||||||
|
|
||||||
|
(central, Vec3::from(spec.chest.offset))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mesh_tail(&self, species: FSSpecies, body_type: FSBodyType) -> BoneMeshes {
|
||||||
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
|
Some(spec) => spec,
|
||||||
|
None => {
|
||||||
|
error!(
|
||||||
|
"No tail specification exists for the combination of {:?} and {:?}",
|
||||||
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let central = graceful_load_segment(&spec.tail.central.0);
|
||||||
|
|
||||||
|
(central, Vec3::from(spec.tail.offset))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mesh_fish_medium_torso(torso: fish_medium::Torso) -> BoneMeshes {
|
impl FishSmallLateralSpec {
|
||||||
load_mesh(
|
fn mesh_fin_l(&self, species: FSSpecies, body_type: FSBodyType) -> BoneMeshes {
|
||||||
match torso {
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
fish_medium::Torso::Default => "npc.marlin.torso",
|
Some(spec) => spec,
|
||||||
},
|
None => {
|
||||||
Vec3::new(-7.0, -6.0, -6.0),
|
error!(
|
||||||
)
|
"No fin specification exists for the combination of {:?} and {:?}",
|
||||||
}
|
species, body_type
|
||||||
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let lateral = graceful_load_segment(&spec.fin_l.lateral.0);
|
||||||
|
|
||||||
fn mesh_fish_medium_rear(rear: fish_medium::Rear) -> BoneMeshes {
|
(lateral, Vec3::from(spec.fin_l.offset))
|
||||||
load_mesh(
|
}
|
||||||
match rear {
|
|
||||||
fish_medium::Rear::Default => "npc.marlin.rear",
|
|
||||||
},
|
|
||||||
Vec3::new(-7.0, -6.0, -6.0),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mesh_fish_medium_tail(tail: fish_medium::Tail) -> BoneMeshes {
|
fn mesh_fin_r(&self, species: FSSpecies, body_type: FSBodyType) -> BoneMeshes {
|
||||||
load_mesh(
|
let spec = match self.0.get(&(species, body_type)) {
|
||||||
match tail {
|
Some(spec) => spec,
|
||||||
fish_medium::Tail::Default => "npc.marlin.tail",
|
None => {
|
||||||
},
|
error!(
|
||||||
Vec3::new(-7.0, -6.0, -6.0),
|
"No fin specification exists for the combination of {:?} and {:?}",
|
||||||
)
|
species, body_type
|
||||||
}
|
);
|
||||||
|
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||||
|
},
|
||||||
|
};
|
||||||
|
let lateral = graceful_load_segment(&spec.fin_r.lateral.0);
|
||||||
|
|
||||||
fn mesh_fish_medium_fin_l(fin_l: fish_medium::FinL) -> BoneMeshes {
|
(lateral, Vec3::from(spec.fin_r.offset))
|
||||||
load_mesh(
|
}
|
||||||
match fin_l {
|
|
||||||
fish_medium::FinL::Default => "npc.marlin.fin_l",
|
|
||||||
},
|
|
||||||
Vec3::new(-7.0, -6.0, -6.0),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mesh_fish_medium_fin_r(fin_r: fish_medium::FinR) -> BoneMeshes {
|
|
||||||
load_mesh(
|
|
||||||
match fin_r {
|
|
||||||
fish_medium::FinR::Default => "npc.marlin.fin_r",
|
|
||||||
},
|
|
||||||
Vec3::new(-7.0, -6.0, -6.0),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////
|
////
|
||||||
@ -2583,49 +2854,7 @@ fn mesh_bird_small_wing_r(wing_r: bird_small::WingR) -> BoneMeshes {
|
|||||||
Vec3::new(-7.0, -6.0, -6.0),
|
Vec3::new(-7.0, -6.0, -6.0),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
////
|
|
||||||
make_vox_spec!(
|
|
||||||
fish_small::Body,
|
|
||||||
struct FishSmallSpec {},
|
|
||||||
|FigureKey { body, .. }, _spec| {
|
|
||||||
[
|
|
||||||
Some(mesh_fish_small_torso(body.torso)),
|
|
||||||
Some(mesh_fish_small_tail(body.tail)),
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
]
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
fn mesh_fish_small_torso(torso: fish_small::Torso) -> BoneMeshes {
|
|
||||||
load_mesh(
|
|
||||||
match torso {
|
|
||||||
fish_small::Torso::Default => "npc.cardinalfish.torso",
|
|
||||||
},
|
|
||||||
Vec3::new(-7.0, -6.0, -6.0),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mesh_fish_small_tail(tail: fish_small::Tail) -> BoneMeshes {
|
|
||||||
load_mesh(
|
|
||||||
match tail {
|
|
||||||
fish_small::Tail::Default => "npc.cardinalfish.tail",
|
|
||||||
},
|
|
||||||
Vec3::new(-7.0, -6.0, -6.0),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
////
|
////
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct BipedLargeCentralSpec(HashMap<(BLSpecies, BLBodyType), SidedBLCentralVoxSpec>);
|
struct BipedLargeCentralSpec(HashMap<(BLSpecies, BLBodyType), SidedBLCentralVoxSpec>);
|
||||||
|
@ -2203,11 +2203,18 @@ impl FigureMgr {
|
|||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
|
// Idle Water
|
||||||
// TODO!
|
(_, false, true) => anim::fish_medium::SwimIdleAnimation::update_skeleton(
|
||||||
_ => anim::fish_medium::IdleAnimation::update_skeleton(
|
|
||||||
&FishMediumSkeleton::default(),
|
&FishMediumSkeleton::default(),
|
||||||
time,
|
(vel.0, ori, state.last_ori, time, state.avg_vel),
|
||||||
|
state.state_time,
|
||||||
|
&mut state_animation_rate,
|
||||||
|
skeleton_attr,
|
||||||
|
),
|
||||||
|
// Swim
|
||||||
|
(_, true, true) => anim::fish_medium::SwimAnimation::update_skeleton(
|
||||||
|
&FishMediumSkeleton::default(),
|
||||||
|
(vel.0, ori, state.last_ori, time, state.avg_vel),
|
||||||
state.state_time,
|
state.state_time,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
@ -2598,11 +2605,10 @@ impl FigureMgr {
|
|||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
|
// Swim
|
||||||
// TODO!
|
(_, _, true) => anim::fish_small::SwimAnimation::update_skeleton(
|
||||||
_ => anim::fish_small::IdleAnimation::update_skeleton(
|
|
||||||
&FishSmallSkeleton::default(),
|
&FishSmallSkeleton::default(),
|
||||||
time,
|
(vel.0, ori, state.last_ori, time, state.avg_vel),
|
||||||
state.state_time,
|
state.state_time,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use crate::{column::ColumnSample, sim::SimChunk, IndexRef, CONFIG};
|
use crate::{column::ColumnSample, sim::SimChunk, IndexRef, CONFIG};
|
||||||
use common::{
|
use common::{
|
||||||
comp::{
|
comp::{
|
||||||
biped_large, bird_medium, quadruped_low, quadruped_medium, quadruped_small, theropod,
|
biped_large, bird_medium, fish_medium, quadruped_low, quadruped_medium, quadruped_small,
|
||||||
Alignment,
|
theropod, Alignment,
|
||||||
},
|
},
|
||||||
generation::{ChunkSupplement, EntityInfo},
|
generation::{ChunkSupplement, EntityInfo},
|
||||||
terrain::Block,
|
terrain::Block,
|
||||||
@ -761,6 +761,21 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
|
|||||||
close(c.temp, CONFIG.desert_temp + 0.2, 0.3) * BASE_DENSITY * 5.0
|
close(c.temp, CONFIG.desert_temp + 0.2, 0.3) * BASE_DENSITY * 5.0
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
// Underwater
|
||||||
|
Entry {
|
||||||
|
make_entity: |pos, rng| {
|
||||||
|
EntityInfo::at(pos)
|
||||||
|
.with_body(
|
||||||
|
fish_medium::Body::random_with(rng, &fish_medium::Species::Marlin).into(),
|
||||||
|
)
|
||||||
|
.with_alignment(Alignment::Wild)
|
||||||
|
},
|
||||||
|
group_size: 3..5,
|
||||||
|
is_underwater: true,
|
||||||
|
get_density: |c, col| {
|
||||||
|
close(c.temp, CONFIG.temperate_temp, 1.0) * col.tree_density * BASE_DENSITY * 5.0
|
||||||
|
},
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
for y in 0..vol.size_xy().y as i32 {
|
for y in 0..vol.size_xy().y as i32 {
|
||||||
|
Loading…
Reference in New Issue
Block a user