From a7c23ea5be0982c091dd92aa5eab2ca774e77203 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 28 Jun 2020 16:56:30 -0400 Subject: [PATCH] custom scaling by species --- voxygen/src/anim/src/quadruped_low/idle.rs | 4 ++-- voxygen/src/anim/src/quadruped_low/mod.rs | 12 ++++++++++++ voxygen/src/anim/src/quadruped_low/run.rs | 4 ++-- voxygen/src/anim/src/quadruped_medium/idle.rs | 4 ++-- voxygen/src/anim/src/quadruped_medium/mod.rs | 13 +++++++++++++ voxygen/src/anim/src/quadruped_medium/run.rs | 8 ++++---- 6 files changed, 35 insertions(+), 10 deletions(-) diff --git a/voxygen/src/anim/src/quadruped_low/idle.rs b/voxygen/src/anim/src/quadruped_low/idle.rs index 5b01dec9aa..806ed63b32 100644 --- a/voxygen/src/anim/src/quadruped_low/idle.rs +++ b/voxygen/src/anim/src/quadruped_low/idle.rs @@ -60,9 +60,9 @@ impl Animation for IdleAnimation { next.jaw.ori = Quaternion::rotation_x(slow * 0.04); next.jaw.scale = Vec3::one() * 0.98; - next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) / 6.0; + next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) *skeleton_attr.scaler/11.0; next.chest.ori = Quaternion::rotation_y(slow * 0.01); - next.chest.scale = Vec3::one() / 6.0; + next.chest.scale = Vec3::one() *skeleton_attr.scaler/11.0; next.tail_front.offset = Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1); diff --git a/voxygen/src/anim/src/quadruped_low/mod.rs b/voxygen/src/anim/src/quadruped_low/mod.rs index 1e0e3a1bd6..dde2eb5903 100644 --- a/voxygen/src/anim/src/quadruped_low/mod.rs +++ b/voxygen/src/anim/src/quadruped_low/mod.rs @@ -93,6 +93,7 @@ pub struct SkeletonAttr { feet_f: (f32, f32, f32), feet_b: (f32, f32, f32), lean: (f32, f32), + scaler: f32, } impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr { @@ -118,6 +119,7 @@ impl Default for SkeletonAttr { feet_f: (0.0, 0.0, 0.0), feet_b: (0.0, 0.0, 0.0), lean: (0.0, 0.0), + scaler: 0.0, } } } @@ -210,6 +212,16 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr { (Pangolin, _) => (0.4, 0.0), _ => (0.0, 1.0), }, + scaler: match (body.species, body.body_type) { + (Crocodile, _) => (1.3), + (Alligator, _) => (1.5), + (Salamander, _) => (1.4), + (Monitor, _) => (1.1), + (Asp, _) => (1.2), + (Tortoise, _) => (1.0), + (Rocksnapper, _) => (1.2), + (Pangolin, _) => (1.3), + }, } } } diff --git a/voxygen/src/anim/src/quadruped_low/run.rs b/voxygen/src/anim/src/quadruped_low/run.rs index f8c3283008..f4ef483e03 100644 --- a/voxygen/src/anim/src/quadruped_low/run.rs +++ b/voxygen/src/anim/src/quadruped_low/run.rs @@ -132,11 +132,11 @@ impl Animation for RunAnimation { * Quaternion::rotation_x(-0.04); next.tail_rear.scale = Vec3::one(); - next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) / 6.0; + next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) *skeleton_attr.scaler/11.0; next.chest.ori = Quaternion::rotation_z(short * 0.12) * Quaternion::rotation_y(shortalt * 0.12) * Quaternion::rotation_x(skeleton_attr.lean.0); - next.chest.scale = Vec3::one() / 6.0; + next.chest.scale = Vec3::one() *skeleton_attr.scaler/11.0; next.foot_fl.offset = Vec3::new( -skeleton_attr.feet_f.0, diff --git a/voxygen/src/anim/src/quadruped_medium/idle.rs b/voxygen/src/anim/src/quadruped_medium/idle.rs index fc8923709b..acfa57698e 100644 --- a/voxygen/src/anim/src/quadruped_medium/idle.rs +++ b/voxygen/src/anim/src/quadruped_medium/idle.rs @@ -85,9 +85,9 @@ impl Animation for IdleAnimation { 0.0, skeleton_attr.torso_front.0, skeleton_attr.torso_front.1 + slower * 0.3, - ) / 8.0; + ) *skeleton_attr.scaler/11.0; next.torso_front.ori = Quaternion::rotation_y(slow * 0.02); - next.torso_front.scale = Vec3::one() / 8.0; + next.torso_front.scale = Vec3::one() *skeleton_attr.scaler/11.0; next.torso_back.offset = Vec3::new( 0.0, diff --git a/voxygen/src/anim/src/quadruped_medium/mod.rs b/voxygen/src/anim/src/quadruped_medium/mod.rs index 2bcfc6ae17..624f8bad8f 100644 --- a/voxygen/src/anim/src/quadruped_medium/mod.rs +++ b/voxygen/src/anim/src/quadruped_medium/mod.rs @@ -127,6 +127,7 @@ pub struct SkeletonAttr { leg_b: (f32, f32, f32), feet_f: (f32, f32, f32), feet_b: (f32, f32, f32), + scaler: f32, } impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr { @@ -154,6 +155,7 @@ impl Default for SkeletonAttr { leg_b: (0.0, 0.0, 0.0), feet_f: (0.0, 0.0, 0.0), feet_b: (0.0, 0.0, 0.0), + scaler: 0.0, } } } @@ -283,6 +285,17 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr { (Frostfang, _) => (0.0, -1.5, -3.5), (Mouflon, _) => (-1.0, -1.5, -2.5), }, + scaler: match (body.species, body.body_type) { + (Grolgar, _) => (1.3), + (Saber, _) => (1.1), + (Tuskram, _) => (1.2), + (Lion, _) => (1.3), + (Tarasque, _) => (1.3), + (Tiger, _) => (1.2), + (Wolf, _) => (1.0), + (Frostfang, _) => (1.0), + (Mouflon, _) => (1.0), + }, } } } diff --git a/voxygen/src/anim/src/quadruped_medium/run.rs b/voxygen/src/anim/src/quadruped_medium/run.rs index efd1e62f8a..ec309d1589 100644 --- a/voxygen/src/anim/src/quadruped_medium/run.rs +++ b/voxygen/src/anim/src/quadruped_medium/run.rs @@ -134,9 +134,9 @@ impl Animation for RunAnimation { 0.0, skeleton_attr.torso_front.0, skeleton_attr.torso_front.1 + shortalt * 0.8, - ) / 8.0; + ) *skeleton_attr.scaler/11.0; next.torso_front.ori = Quaternion::rotation_x(short * 0.03); - next.torso_front.scale = Vec3::one() / 8.0; + next.torso_front.scale = Vec3::one() *skeleton_attr.scaler/11.0; next.torso_back.offset = Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1); @@ -238,9 +238,9 @@ impl Animation for RunAnimation { 0.0, skeleton_attr.torso_front.0, skeleton_attr.torso_front.1 + shortalt * 2.0, - ) / 8.0; + ) *skeleton_attr.scaler/11.0; next.torso_front.ori = Quaternion::rotation_x(short * 0.13); - next.torso_front.scale = Vec3::one() / 8.0; + next.torso_front.scale = Vec3::one() *skeleton_attr.scaler/11.0; next.torso_back.offset = Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1);