New dragon model, added jaw, splitted head into upper/lower

This commit is contained in:
Snowram 2020-05-06 02:04:56 +02:00 committed by jshipsey
parent f671a60fff
commit 35e1a8ae60
66 changed files with 234 additions and 68 deletions

View File

@ -1,45 +1,61 @@
({
(Reddragon, Male): (
head: (
offset: (-4.5, -2.0, -7.5),
center: ("npc.reddragon.male.head"),
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, -6.0),
offset: (-6.5, -6.0, -7.5),
center: ("npc.reddragon.male.chest_front"),
),
chest_rear: (
offset: (-6.5, -7.0, -6.0),
offset: (-6.5, -7.0, -7.0),
center: ("npc.reddragon.male.chest_rear"),
),
tail_front: (
offset: (-2.5, -5.5, -3.0),
offset: (-2.5, -6.0, -3.5),
center: ("npc.reddragon.male.tail_front"),
),
tail_rear: (
offset: (-1.5, -7.0, -2.5),
offset: (-3.5, -8.0, -3.0),
center: ("npc.reddragon.male.tail_rear"),
)
),
(Reddragon, Female): (
head: (
offset: (-4.5, -2.0, -7.5),
center: ("npc.reddragon.female.head"),
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, -6.0),
offset: (-6.5, -6.0, -7.5),
center: ("npc.reddragon.female.chest_front"),
),
chest_rear: (
offset: (-6.5, -7.0, -6.0),
offset: (-6.5, -7.0, -7.0),
center: ("npc.reddragon.female.chest_rear"),
),
tail_front: (
offset: (-2.5, -5.5, -3.0),
offset: (-2.5, -6.0, -3.5),
center: ("npc.reddragon.female.tail_front"),
),
tail_rear: (
offset: (-1.5, -7.0, -2.5),
offset: (-3.5, -8.0, -3.0),
center: ("npc.reddragon.female.tail_rear"),
)
),

View File

@ -1,69 +1,69 @@
({
(Reddragon, Male): (
wing_in_l: (
offset: (-0.5, -3.5, -27.0),
offset: (-0.5, -3.5, -44.0),
lateral: ("npc.reddragon.male.wing_in_l"),
),
wing_in_r: (
offset: (-0.5, -3.5, -27.0),
offset: (-0.5, -3.5, -44.0),
lateral: ("npc.reddragon.male.wing_in_r"),
),
wing_out_l: (
offset: (-0.5, -3.5, -27.0),
offset: (-0.5, -3.5, -38.0),
lateral: ("npc.reddragon.male.wing_out_l"),
),
wing_out_r: (
offset: (-0.5, -3.5, -27.0),
offset: (-0.5, -3.5, -38.0),
lateral: ("npc.reddragon.male.wing_out_r"),
),
foot_fl: (
offset: (-2.5, -4.0, -1.5),
offset: (-6.5, -4.0, -1.5),
lateral: ("npc.reddragon.male.foot_fl"),
),
foot_fr: (
offset: (-2.5, -4.0, -1.5),
offset: (-6.5, -4.0, -1.5),
lateral: ("npc.reddragon.male.foot_fr"),
),
foot_bl: (
offset: (-2.5, -4.0, -3.0),
offset: (-6.5, -4.0, -3.0),
lateral: ("npc.reddragon.male.foot_bl"),
),
foot_br: (
offset: (-2.5, -4.0, -3.0),
offset: (-6.5, -4.0, -3.0),
lateral: ("npc.reddragon.male.foot_br"),
)
),
(Reddragon, Female): (
wing_in_l: (
offset: (-0.5, -3.5, -27.0),
offset: (-0.5, -3.5, -44.0),
lateral: ("npc.reddragon.female.wing_in_l"),
),
wing_in_r: (
offset: (-0.5, -3.5, -27.0),
offset: (-0.5, -3.5, -44.0),
lateral: ("npc.reddragon.female.wing_in_r"),
),
wing_out_l: (
offset: (-0.5, -3.5, -27.0),
offset: (-0.5, -3.5, -38.0),
lateral: ("npc.reddragon.female.wing_out_l"),
),
wing_out_r: (
offset: (-0.5, -3.5, -27.0),
offset: (-0.5, -3.5, -38.0),
lateral: ("npc.reddragon.female.wing_out_r"),
),
foot_fl: (
offset: (-2.5, -4.0, -1.5),
offset: (-6.5, -4.0, -1.5),
lateral: ("npc.reddragon.female.foot_fl"),
),
foot_fr: (
offset: (-2.5, -4.0, -1.5),
offset: (-6.5, -4.0, -1.5),
lateral: ("npc.reddragon.female.foot_fr"),
),
foot_bl: (
offset: (-2.5, -4.0, -3.0),
offset: (-6.5, -4.0, -3.0),
lateral: ("npc.reddragon.female.foot_bl"),
),
foot_br: (
offset: (-2.5, -4.0, -3.0),
offset: (-6.5, -4.0, -3.0),
lateral: ("npc.reddragon.female.foot_br"),
)
),

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -17,6 +17,11 @@ impl Animation for FlyAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let lab = 12.0; //14.0
let footl = (anim_time as f32 * lab as f32 + PI).sin();

View File

@ -18,7 +18,12 @@ impl Animation for FlyAnimation {
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 * 4.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let vertlf = (anim_time as f32 * lab as f32 + PI * 1.8).sin().max(0.15);
let vertrfoffset = (anim_time as f32 * lab as f32 + PI * 0.80).sin().max(0.15);
let vertlboffset = (anim_time as f32 * lab as f32).sin().max(0.15);
@ -52,13 +57,27 @@ impl Animation for FlyAnimation {
* 0.125,
);
next.head.offset = Vec3::new(
let wave = (anim_time as f32 * 14.0).sin();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_stop = (anim_time as f32 * 5.0).min(PI / 2.0).sin();
next.head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) * 1.05;
next.head_upper.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
next.head_upper.scale = Vec3::one() * 1.05;
next.head_lower.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) * 1.05;
next.head_lower.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
next.head_lower.scale = Vec3::one() * 1.05;
next.jaw.offset = Vec3::new(
0.0,
skeleton_attr.head.0 + 0.5,
skeleton_attr.head.1 + center * 0.5 - 1.0,
skeleton_attr.jaw.0 - wave_ultra_slow_cos * 0.12,
skeleton_attr.jaw.1 + wave_slow * 0.2,
);
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0 + center * 0.03);
next.head.scale = Vec3::one();
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.jaw.scale = Vec3::one() * 0.98;
next.tail_front.offset = Vec3::new(
0.0,

View File

@ -1,5 +1,5 @@
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
use std::ops::Mul;
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -17,10 +17,12 @@ impl Animation for IdleAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let duck_head_look = Vec2::new(
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
@ -33,10 +35,31 @@ impl Animation for IdleAnimation {
* 0.25,
);
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.ori = Quaternion::rotation_z(duck_head_look.x)
* Quaternion::rotation_x(-duck_head_look.y.abs() + wave_slow_cos * 0.03);
next.head.scale = Vec3::one();
next.head_upper.offset = Vec3::new(
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + wave_ultra_slow * 0.4,
) * 1.05;
next.head_upper.ori =
Quaternion::rotation_z(0.8 * look.x) * Quaternion::rotation_x(0.8 * look.y);
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.4 * look.x) * Quaternion::rotation_x(-0.4 * look.y);
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.05);
next.jaw.scale = Vec3::one() * 0.98;
next.chest_front.offset = Vec3::new(
0.0,

View File

@ -11,9 +11,17 @@ use common::comp::{self};
use vek::Vec3;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const HEAD_X: f32 = 4.0;
const HEAD_UPPER_X: f32 = 11.5;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const HEAD_Z: f32 = 11.0;
const HEAD_UPPER_Z: f32 = 18.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const HEAD_LOWER_X: f32 = -4.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const HEAD_LOWER_Z: f32 = -2.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const JAW_X: f32 = 7.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const JAW_Z: f32 = -5.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const CHEST_F_X: f32 = 0.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
@ -23,11 +31,11 @@ const CHEST_R_X: f32 = -13.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const CHEST_R_Z: f32 = 0.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const TAIL_F_X: f32 = -11.5;
const TAIL_F_X: f32 = -13.5;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const TAIL_F_Z: f32 = 16.5;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const TAIL_R_X: f32 = -25.5;
const TAIL_R_X: f32 = -28.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
const TAIL_R_Z: f32 = 0.0;
#[const_tweaker::tweak(min = -40.0, max = 40.0, step = 0.5)]
@ -57,7 +65,9 @@ const FEET_B_Z: f32 = 3.0;
#[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,
@ -81,7 +91,13 @@ impl Skeleton for DragonSkeleton {
fn bone_count(&self) -> usize { 13 }
<<<<<<< HEAD
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
=======
fn compute_matrices(&self) -> [FigureBoneData; 16] {
let head_upper_mat = self.head_upper.compute_base_matrix();
let head_lower_mat = self.head_lower.compute_base_matrix();
>>>>>>> New dragon model, added jaw, splitted head into upper/lower
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();
@ -112,7 +128,9 @@ impl Skeleton for DragonSkeleton {
)
=======
[
FigureBoneData::new(self.head.compute_base_matrix() * chest_front_mat),
FigureBoneData::new(head_upper_mat),
FigureBoneData::new(head_upper_mat * head_lower_mat),
FigureBoneData::new(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(chest_rear_mat * self.tail_front.compute_base_matrix()),
@ -126,14 +144,14 @@ impl Skeleton for DragonSkeleton {
FigureBoneData::new(self.foot_bl.compute_base_matrix()),
FigureBoneData::new(self.foot_br.compute_base_matrix()),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
]
>>>>>>> Symmetry of dragon skeleton
}
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);
@ -150,7 +168,9 @@ impl Skeleton for DragonSkeleton {
}
pub struct SkeletonAttr {
head: (f32, f32),
head_upper: (f32, f32),
head_lower: (f32, f32),
jaw: (f32, f32),
chest_front: (f32, f32),
chest_rear: (f32, f32),
tail_front: (f32, f32),
@ -176,7 +196,9 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
impl Default for SkeletonAttr {
fn default() -> Self {
Self {
head: (0.0, 0.0),
head_upper: (0.0, 0.0),
head_lower: (0.0, 0.0),
jaw: (0.0, 0.0),
chest_front: (0.0, 0.0),
chest_rear: (0.0, 0.0),
tail_front: (0.0, 0.0),
@ -194,8 +216,14 @@ impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
fn from(body: &'a comp::dragon::Body) -> Self {
use comp::dragon::Species::*;
Self {
head: match (body.species, body.body_type) {
(Reddragon, _) => (*HEAD_X, *HEAD_Z),
head_upper: match (body.species, body.body_type) {
(Reddragon, _) => (*HEAD_UPPER_X, *HEAD_UPPER_Z),
},
head_lower: match (body.species, body.body_type) {
(Reddragon, _) => (*HEAD_LOWER_X, *HEAD_LOWER_Z),
},
jaw: match (body.species, body.body_type) {
(Reddragon, _) => (*JAW_X, *JAW_Z),
},
chest_front: match (body.species, body.body_type) {
(Reddragon, _) => (*CHEST_F_X, *CHEST_F_Z),

View File

@ -18,6 +18,12 @@ impl Animation for RunAnimation {
let mut next = (*skeleton).clone();
let lab = 14;
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let vertlf = (anim_time as f32 * lab as f32 + PI * 1.8).sin().max(0.15);
let vertrfoffset = (anim_time as f32 * lab as f32 + PI * 0.80).sin().max(0.15);
let vertlboffset = (anim_time as f32 * lab as f32).sin().max(0.15);
@ -51,14 +57,31 @@ impl Animation for RunAnimation {
* 0.125,
);
next.head.offset = Vec3::new(
next.head_upper.offset = Vec3::new(
0.0,
skeleton_attr.head.0 + horichest * 0.9,
skeleton_attr.head.1 + verthead * -0.9,
skeleton_attr.head_upper.0 + horichest * 1.8,
skeleton_attr.head_upper.1 + verthead * -1.8,
) * 1.05;
next.head.ori =
next.head_upper.ori =
Quaternion::rotation_x(wolf_look.y) * Quaternion::rotation_z(wolf_look.x);
next.head.scale = Vec3::one() * 1.05;
next.head_upper.scale = Vec3::one() * 1.05;
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0 + horichest * 1.8,
skeleton_attr.head_lower.1 + verthead * -1.8,
) * 1.05;
next.head_lower.ori =
Quaternion::rotation_x(wolf_look.y) * Quaternion::rotation_z(wolf_look.x);
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.05);
next.jaw.scale = Vec3::one() * 0.98;
next.tail_front.offset = Vec3::new(
0.0,

View File

@ -417,7 +417,17 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
DragonLateralSpec::load_watched(manifest_indicator);
[
Some(dragon_center_spec.mesh_head(
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,
@ -483,8 +493,6 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
generate_mesh,
)),
None,
None,
None,
]
},
Body::BirdSmall(body) => [

View File

@ -1873,7 +1873,9 @@ pub struct DragonCenterSpec(HashMap<(DSpecies, DBodyType), SidedDCenterVoxSpec>)
#[derive(Serialize, Deserialize)]
struct SidedDCenterVoxSpec {
head: DragonCenterSubSpec,
upper: DragonCenterSubSpec,
lower: DragonCenterSubSpec,
jaw: DragonCenterSubSpec,
chest_front: DragonCenterSubSpec,
chest_rear: DragonCenterSubSpec,
tail_front: DragonCenterSubSpec,
@ -1927,7 +1929,7 @@ impl DragonCenterSpec {
.unwrap()
}
pub fn mesh_head(
pub fn mesh_head_upper(
&self,
species: DSpecies,
body_type: DBodyType,
@ -1937,15 +1939,57 @@ impl DragonCenterSpec {
Some(spec) => spec,
None => {
error!(
"No head specification exists for the combination of {:?} and {:?}",
"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 center = graceful_load_segment(&spec.head.center.0);
let central = graceful_load_segment(&spec.upper.center.0);
generate_mesh(&center, Vec3::from(spec.head.offset))
generate_mesh(&central, Vec3::from(spec.upper.offset))
}
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);
generate_mesh(&central, Vec3::from(spec.lower.offset))
}
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);
generate_mesh(&central, Vec3::from(spec.jaw.offset))
}
pub fn mesh_chest_front(