diff --git a/common/src/comp/body/biped_large.rs b/common/src/comp/body/biped_large.rs index 3891c0a4f8..5e11487e88 100644 --- a/common/src/comp/body/biped_large.rs +++ b/common/src/comp/body/biped_large.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Ogre, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::BipedLarge(body) } } diff --git a/common/src/comp/body/biped_small.rs b/common/src/comp/body/biped_small.rs index 945586f393..67a23a0fe2 100644 --- a/common/src/comp/body/biped_small.rs +++ b/common/src/comp/body/biped_small.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Gnome, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::BipedSmall(body) } } diff --git a/common/src/comp/body/bird_large.rs b/common/src/comp/body/bird_large.rs index 629317082a..f32ec2c8cd 100644 --- a/common/src/comp/body/bird_large.rs +++ b/common/src/comp/body/bird_large.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Phoenix, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::BirdLarge(body) } } diff --git a/common/src/comp/body/bird_medium.rs b/common/src/comp/body/bird_medium.rs index 5eb7dbee65..b9ff1b9b2f 100644 --- a/common/src/comp/body/bird_medium.rs +++ b/common/src/comp/body/bird_medium.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Duck, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::BirdMedium(body) } } diff --git a/common/src/comp/body/dragon.rs b/common/src/comp/body/dragon.rs index 07c3991a44..c14a8e6bd6 100644 --- a/common/src/comp/body/dragon.rs +++ b/common/src/comp/body/dragon.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Reddragon, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::Dragon(body) } } diff --git a/common/src/comp/body/fish_medium.rs b/common/src/comp/body/fish_medium.rs index 924bf09f36..72bf540d6f 100644 --- a/common/src/comp/body/fish_medium.rs +++ b/common/src/comp/body/fish_medium.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Marlin, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::FishMedium(body) } } diff --git a/common/src/comp/body/fish_small.rs b/common/src/comp/body/fish_small.rs index 952a3f5412..c148f0351e 100644 --- a/common/src/comp/body/fish_small.rs +++ b/common/src/comp/body/fish_small.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Clownfish, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::FishSmall(body) } } diff --git a/common/src/comp/body/golem.rs b/common/src/comp/body/golem.rs index a0549a5595..7a5233835f 100644 --- a/common/src/comp/body/golem.rs +++ b/common/src/comp/body/golem.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::StoneGolem, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::Golem(body) } } diff --git a/common/src/comp/body/humanoid.rs b/common/src/comp/body/humanoid.rs index dc63f8fd9c..d96c83375d 100644 --- a/common/src/comp/body/humanoid.rs +++ b/common/src/comp/body/humanoid.rs @@ -65,6 +65,22 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Danari, + body_type: BodyType::Female, + hair_style: 0, + beard: 0, + accessory: 0, + hair_color: 0, + skin: 0, + eye_color: 0, + eyes: 0, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::Humanoid(body) } } diff --git a/common/src/comp/body/object.rs b/common/src/comp/body/object.rs index ccdf3bc3bb..bedf30a111 100644 --- a/common/src/comp/body/object.rs +++ b/common/src/comp/body/object.rs @@ -89,6 +89,10 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { Body::Arrow } +} + pub const ALL_OBJECTS: [Body; 67] = [ Body::Arrow, Body::Bomb, diff --git a/common/src/comp/body/quadruped_low.rs b/common/src/comp/body/quadruped_low.rs index f2c14091e2..ef4defcef8 100644 --- a/common/src/comp/body/quadruped_low.rs +++ b/common/src/comp/body/quadruped_low.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Crocodile, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::QuadrupedLow(body) } } diff --git a/common/src/comp/body/quadruped_medium.rs b/common/src/comp/body/quadruped_medium.rs index 192e7559b5..20498f9b38 100644 --- a/common/src/comp/body/quadruped_medium.rs +++ b/common/src/comp/body/quadruped_medium.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Grolgar, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::QuadrupedMedium(body) } } diff --git a/common/src/comp/body/quadruped_small.rs b/common/src/comp/body/quadruped_small.rs index 1d4f294e64..13be59b94e 100644 --- a/common/src/comp/body/quadruped_small.rs +++ b/common/src/comp/body/quadruped_small.rs @@ -25,6 +25,15 @@ impl Body { } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Pig, + body_type: BodyType::Female, + } + } +} + impl From for super::Body { fn from(body: Body) -> Self { super::Body::QuadrupedSmall(body) } } diff --git a/common/src/comp/body/ship.rs b/common/src/comp/body/ship.rs index f880683d47..4e17ce9258 100644 --- a/common/src/comp/body/ship.rs +++ b/common/src/comp/body/ship.rs @@ -54,6 +54,10 @@ impl Body { pub fn mass(&self) -> Mass { Mass((self.hull_vol() + self.balloon_vol()) * self.density().0) } } +impl Default for Body { + fn default() -> Self { Body::DefaultAirship } +} + /// Terrain is 11.0 scale relative to small-scale voxels, /// airship scale is multiplied by 11 to reach terrain scale. pub const AIRSHIP_SCALE: f32 = 11.0; diff --git a/common/src/comp/body/theropod.rs b/common/src/comp/body/theropod.rs index 5f1abcda53..97467edf65 100644 --- a/common/src/comp/body/theropod.rs +++ b/common/src/comp/body/theropod.rs @@ -25,6 +25,15 @@ impl From for super::Body { fn from(body: Body) -> Self { super::Body::Theropod(body) } } +impl Default for Body { + fn default() -> Self { + Self { + species: Species::Archaeos, + body_type: BodyType::Female, + } + } +} + #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[repr(u32)] pub enum Species { diff --git a/voxygen/anim/src/character/idle.rs b/voxygen/anim/src/character/idle.rs index 4b8464241d..ad17581bd3 100644 --- a/voxygen/anim/src/character/idle.rs +++ b/voxygen/anim/src/character/idle.rs @@ -42,7 +42,6 @@ impl Animation for IdleAnimation { next.back.scale = Vec3::one() * 1.02; next.hold.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.65; - next.torso.scale = Vec3::one() / 11.0 * s_a.scaler; next.shoulder_l.scale = Vec3::one() * 1.1; next.shoulder_r.scale = Vec3::one() * 1.1; @@ -135,7 +134,7 @@ impl Animation for IdleAnimation { next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2); next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1); - next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler; + next.torso.position = Vec3::new(0.0, 0.0, 0.0); next.second.scale = match hands { (Some(Hands::One), Some(Hands::One)) => Vec3::one(), diff --git a/voxygen/anim/src/character/mod.rs b/voxygen/anim/src/character/mod.rs index ad446fcff1..8d5d5b2eee 100644 --- a/voxygen/anim/src/character/mod.rs +++ b/voxygen/anim/src/character/mod.rs @@ -70,12 +70,14 @@ skeleton_impls!(struct CharacterSkeleton { control_l, control_r, :: // Begin non-bone fields + body: Body, holding_lantern: bool, }); impl CharacterSkeleton { - pub fn new(holding_lantern: bool) -> Self { + pub fn new(body: Body, holding_lantern: bool) -> Self { Self { + body, holding_lantern, ..Self::default() } @@ -97,7 +99,10 @@ impl Skeleton for CharacterSkeleton { base_mat: Mat4, buf: &mut [FigureBoneData; super::MAX_BONE_COUNT], ) -> Vec3 { - let torso_mat = base_mat * Mat4::::from(self.torso); + let torso_mat = base_mat + * Mat4::::from(self.torso) + * Mat4::scaling_3d(1.0 / 11.0) + * Mat4::scaling_3d(SkeletonAttr::from(&self.body).scaler); let chest_mat = torso_mat * Mat4::::from(self.chest); let head_mat = chest_mat * Mat4::::from(self.head); let shorts_mat = chest_mat * Mat4::::from(self.shorts); diff --git a/voxygen/anim/src/character/run.rs b/voxygen/anim/src/character/run.rs index 561c28b9c8..39b42ae707 100644 --- a/voxygen/anim/src/character/run.rs +++ b/voxygen/anim/src/character/run.rs @@ -273,8 +273,7 @@ impl Animation for RunAnimation { * Quaternion::rotation_y(tilt * 4.0 * fast + tilt * 3.0 + fast2 * speednorm * 0.25); } - next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler; - next.torso.scale = Vec3::one() / 11.0 * s_a.scaler; + next.torso.position = Vec3::new(0.0, 0.0, 0.0); match hands { (Some(Hands::One), _) => match active_tool_kind { diff --git a/voxygen/anim/src/character/sit.rs b/voxygen/anim/src/character/sit.rs index b620143c9c..d731a5e843 100644 --- a/voxygen/anim/src/character/sit.rs +++ b/voxygen/anim/src/character/sit.rs @@ -85,7 +85,7 @@ impl Animation for SitAnimation { next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); next.shoulder_r.orientation = Quaternion::rotation_x(0.0); - next.torso.position = Vec3::new(0.0, -0.2, stop * -0.16) * s_a.scaler; + next.torso.position = Vec3::new(0.0, -0.2, stop * -0.16); if skeleton.holding_lantern { next.hand_r.position = Vec3::new( diff --git a/voxygen/anim/src/character/stand.rs b/voxygen/anim/src/character/stand.rs index f1829e666e..faf40345f2 100644 --- a/voxygen/anim/src/character/stand.rs +++ b/voxygen/anim/src/character/stand.rs @@ -44,7 +44,7 @@ impl Animation for StandAnimation { next.back.scale = Vec3::one() * 1.02; next.hold.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.65; - next.torso.scale = Vec3::one() / 11.0 * s_a.scaler; + next.torso.scale = Vec3::one(); next.shoulder_l.scale = Vec3::one() * 1.1; next.shoulder_r.scale = Vec3::one() * 1.1; @@ -162,7 +162,7 @@ impl Animation for StandAnimation { * Quaternion::rotation_y(fast2 * 0.1); } - next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler; + next.torso.position = Vec3::new(0.0, 0.0, 0.0); next.second.scale = Vec3::one(); next.second.scale = match hands { (Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(), diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index f0411c9d72..b66a2f4330 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -773,7 +773,10 @@ impl FigureMgr { .character_states .entry(entity) .or_insert_with(|| { - FigureState::new(renderer, CharacterSkeleton::new(holding_lantern)) + FigureState::new( + renderer, + CharacterSkeleton::new(*body, holding_lantern), + ) }); // Average velocity relative to the current ground @@ -795,7 +798,7 @@ impl FigureMgr { ) { // Standing (true, false, false) => anim::character::StandAnimation::update_skeleton( - &CharacterSkeleton::new(holding_lantern), + &CharacterSkeleton::new(*body, holding_lantern), (active_tool_kind, second_tool_kind, hands, time, rel_avg_vel), state.state_time, &mut state_animation_rate, @@ -803,7 +806,7 @@ impl FigureMgr { ), // Running (true, true, false) => anim::character::RunAnimation::update_skeleton( - &CharacterSkeleton::new(holding_lantern), + &CharacterSkeleton::new(*body, holding_lantern), ( active_tool_kind, second_tool_kind, @@ -822,7 +825,7 @@ impl FigureMgr { ), // In air (false, _, false) => anim::character::JumpAnimation::update_skeleton( - &CharacterSkeleton::new(holding_lantern), + &CharacterSkeleton::new(*body, holding_lantern), ( active_tool_kind, second_tool_kind, @@ -839,7 +842,7 @@ impl FigureMgr { ), // Swim (_, _, true) => anim::character::SwimAnimation::update_skeleton( - &CharacterSkeleton::new(holding_lantern), + &CharacterSkeleton::new(*body, holding_lantern), ( active_tool_kind, second_tool_kind,