From 584e2b45c713f6166fa08aca7b401df6b21e5207 Mon Sep 17 00:00:00 2001 From: Adam Fogle Date: Sat, 5 Oct 2019 17:11:39 -0400 Subject: [PATCH] Code cleanup, formatting changes, and fixed the cloth belt's offset. --- .../voxel/humanoid_armor_belt_manifest.ron | 6 +- .../voxel/humanoid_armor_chest_manifest.ron | 14 +- .../voxel/humanoid_armor_foot_manifest.ron | 8 +- .../voxel/humanoid_armor_hand_manifest.ron | 8 +- .../voxel/humanoid_armor_pants_manifest.ron | 12 +- .../humanoid_armor_shoulder_manifest.ron | 12 +- common/src/comp/body/humanoid.rs | 18 +- voxygen/src/scene/figure/cache.rs | 92 ++----- voxygen/src/scene/figure/load.rs | 253 ++++++------------ 9 files changed, 137 insertions(+), 286 deletions(-) diff --git a/assets/voxygen/voxel/humanoid_armor_belt_manifest.ron b/assets/voxygen/voxel/humanoid_armor_belt_manifest.ron index 5ec512d9b9..b39172abea 100644 --- a/assets/voxygen/voxel/humanoid_armor_belt_manifest.ron +++ b/assets/voxygen/voxel/humanoid_armor_belt_manifest.ron @@ -2,11 +2,11 @@ Dark:( vox_spec: ("armor.belt.dark", (-4.0, -3.5, 2.0)), recolor: false, - color: (0,0,0) + color: None ), Cloth:( - vox_spec: ("armor.belt.cloth_turq", (-4.0, -3.5, 2.0)), + vox_spec: ("armor.belt.cloth_turq", (-4.0, -3.5, -6.0)), recolor: false, - color: (0,0,0) + color: None ) }) \ No newline at end of file diff --git a/assets/voxygen/voxel/humanoid_armor_chest_manifest.ron b/assets/voxygen/voxel/humanoid_armor_chest_manifest.ron index 8010e9aee6..224df905d4 100644 --- a/assets/voxygen/voxel/humanoid_armor_chest_manifest.ron +++ b/assets/voxygen/voxel/humanoid_armor_chest_manifest.ron @@ -2,36 +2,36 @@ Blue: ( vox_spec: ("armor.chest.grayscale", (-7.0, -3.5, 2.0)), recolor: true, - color: (44, 74, 109) + color: Some((44, 74, 109)) ), Brown: ( vox_spec: ("armor.chest.grayscale", (-7.0, -3.5, 2.0)), recolor: true, - color: (90, 49, 43) + color: Some((90, 49, 43)) ), Dark: ( vox_spec: ("armor.chest.grayscale", (-7.0, -3.5, 2.0)), recolor: true, - color: (73, 63, 59) + color: Some((73, 63, 59)) ), Green: ( vox_spec: ("armor.chest.grayscale", (-7.0, -3.5, 2.0)), recolor: true, - color: (59, 95, 67) + color: Some((59, 95, 67)) ), Orange: ( vox_spec: ("armor.chest.grayscale", (-7.0, -3.5, 2.0)), recolor: true, - color: (109, 58, 58) + color: Some((109, 58, 58)) ), Midnight: ( vox_spec: ("armor.chest.grayscale", (-7.0, -3.5, 2.0)), recolor: true, - color: (29, 26, 33) + color: Some((29, 26, 33)) ), Kimono: ( vox_spec: ("armor.chest.cloth_red_kimono", (-7.0, -3.5, 2.0)), recolor: false, - color: (0,0,0) + color: None ) }) \ No newline at end of file diff --git a/assets/voxygen/voxel/humanoid_armor_foot_manifest.ron b/assets/voxygen/voxel/humanoid_armor_foot_manifest.ron index c478925049..2cf5ab1c8b 100644 --- a/assets/voxygen/voxel/humanoid_armor_foot_manifest.ron +++ b/assets/voxygen/voxel/humanoid_armor_foot_manifest.ron @@ -3,21 +3,21 @@ Bare: ( vox_spec: ("armor.foot.cloth_sandals", (-2.5, -3.5, -9.0)), recolor: false, - color: (0,0,0) + color: None ), Dark: ( vox_spec: ("armor.foot.dark-0", (-2.5, -3.5, -9.0)), recolor: false, - color: (0,0,0) + color: None ), Sandal: ( vox_spec: ("armor.foot.cloth_sandals", (-2.5, -3.5, -9.0)), recolor: false, - color: (0,0,0) + color: None ), Jester: ( vox_spec: ("armor.foot.dark_jester-elf_shoe", (-2.5, -3.5, -9.0)), recolor: false, - color: (0,0,0) + color: None ) }) \ No newline at end of file diff --git a/assets/voxygen/voxel/humanoid_armor_hand_manifest.ron b/assets/voxygen/voxel/humanoid_armor_hand_manifest.ron index 53bfa59651..012854aa92 100644 --- a/assets/voxygen/voxel/humanoid_armor_hand_manifest.ron +++ b/assets/voxygen/voxel/humanoid_armor_hand_manifest.ron @@ -3,24 +3,24 @@ left: ( vox_spec: ("armor.hand.bare_left", (-1.5, -1.5, -7.0)), recolor: false, - color: (0,0,0) + color: None ), right: ( vox_spec: ("armor.hand.bare_right", (-1.5, -1.5, -7.0)), recolor: false, - color: (0,0,0) + color: None ) ), Cloth: ( left: ( vox_spec: ("armor.hand.cloth_basic_left", (-1.5, -1.5, -7.0)), recolor: false, - color: (0,0,0) + color: None ), right: ( vox_spec: ("armor.hand.cloth_basic_right", (-1.5, -1.5, -7.0)), recolor: false, - color: (0,0,0) + color: None ) ) }) \ No newline at end of file diff --git a/assets/voxygen/voxel/humanoid_armor_pants_manifest.ron b/assets/voxygen/voxel/humanoid_armor_pants_manifest.ron index 97bce59095..dc1b09267a 100644 --- a/assets/voxygen/voxel/humanoid_armor_pants_manifest.ron +++ b/assets/voxygen/voxel/humanoid_armor_pants_manifest.ron @@ -2,31 +2,31 @@ Blue: ( vox_spec: ("armor.pants.grayscale", (-5.0, -3.5, 1.0)), recolor: true, - color: (28, 66, 109) + color: Some((28, 66, 109)) ), Brown: ( vox_spec: ("armor.pants.grayscale", (-5.0, -3.5, 1.0)), recolor: true, - color: (54, 30, 26) + color: Some((54, 30, 26)) ), Dark: ( vox_spec: ("armor.pants.grayscale", (-5.0, -3.5, 1.0)), recolor: true, - color: (24, 19, 17) + color: Some((24, 19, 17)) ), Green: ( vox_spec: ("armor.pants.grayscale", (-5.0, -3.5, 1.0)), recolor: true, - color: (49, 95, 59) + color: Some((49, 95, 59)) ), Orange: ( vox_spec: ("armor.pants.grayscale", (-5.0, -3.5, 1.0)), recolor: true, - color: (148, 52, 33) + color: Some((148, 52, 33)) ), Kimono: ( vox_spec: ("armor.pants.cloth_red_kimono", (-5.0, -3.5, 1.0)), recolor: false, - color: (0,0,0) + color: None ) }) \ No newline at end of file diff --git a/assets/voxygen/voxel/humanoid_armor_shoulder_manifest.ron b/assets/voxygen/voxel/humanoid_armor_shoulder_manifest.ron index 745a723a53..91f730f33f 100644 --- a/assets/voxygen/voxel/humanoid_armor_shoulder_manifest.ron +++ b/assets/voxygen/voxel/humanoid_armor_shoulder_manifest.ron @@ -4,36 +4,36 @@ left: ( vox_spec: ("armor.shoulder.brown_left", (-3.0, -3.5, 0.1)), recolor: false, - color: (0,0,0) + color: None ), right: ( vox_spec: ("armor.shoulder.brown_right", (-2.0, -3.5, 0.1)), recolor: false, - color: (0,0,0) + color: None ) ), Brown1: ( left: ( vox_spec: ("armor.shoulder.brown_left", (-3.0, -3.5, 0.1)), recolor: false, - color: (0,0,0) + color: None ), right: ( vox_spec: ("armor.shoulder.brown_right", (-2.0, -3.5, 0.1)), recolor: false, - color: (0,0,0) + color: None ) ), Chain: ( left: ( vox_spec: ("armor.shoulder.chain_left", (-3.0, -3.5, 0.1)), recolor: false, - color: (0,0,0) + color: None ), right: ( vox_spec: ("armor.shoulder.chain_right", (-2.0, -3.5, 0.1)), recolor: false, - color: (0,0,0) + color: None ) ) }) \ No newline at end of file diff --git a/common/src/comp/body/humanoid.rs b/common/src/comp/body/humanoid.rs index a8b1106f33..e2e2c09772 100644 --- a/common/src/comp/body/humanoid.rs +++ b/common/src/comp/body/humanoid.rs @@ -410,10 +410,7 @@ pub enum Belt { Dark, Cloth, } -pub const ALL_BELTS: [Belt; 2] = [ - Belt::Dark, - Belt::Cloth, -]; +pub const ALL_BELTS: [Belt; 2] = [Belt::Dark, Belt::Cloth]; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum Pants { @@ -447,12 +444,7 @@ pub enum Foot { Sandal, Jester, } -pub const ALL_FEET: [Foot; 4] = [ - Foot::Bare, - Foot::Dark, - Foot::Sandal, - Foot::Jester, -]; +pub const ALL_FEET: [Foot; 4] = [Foot::Bare, Foot::Dark, Foot::Sandal, Foot::Jester]; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum Shoulder { @@ -460,11 +452,7 @@ pub enum Shoulder { Brown1, Chain, } -pub const ALL_SHOULDERS: [Shoulder; 3] = [ - Shoulder::None, - Shoulder::Brown1, - Shoulder::Chain, -]; +pub const ALL_SHOULDERS: [Shoulder; 3] = [Shoulder::None, Shoulder::Brown1, Shoulder::Chain]; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum Eyebrows { diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index 99ce3911dd..5063b50a14 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -113,39 +113,21 @@ impl FigureModelCache { CameraMode::FirstPerson => None, }, match camera_mode { - CameraMode::ThirdPerson => Some( - humanoid_armor_chest_spec.mesh_chest( - body.chest, - body.race, - body.skin, - body.hair_color, - body.eye_color, - ) - ), + CameraMode::ThirdPerson => { + Some(humanoid_armor_chest_spec.mesh_chest(&body)) + } CameraMode::FirstPerson => None, }, match camera_mode { - CameraMode::ThirdPerson => Some( - humanoid_armor_belt_spec.mesh_belt( - body.belt, - body.race, - body.skin, - body.hair_color, - body.eye_color, - ) - ), + CameraMode::ThirdPerson => { + Some(humanoid_armor_belt_spec.mesh_belt(&body)) + } CameraMode::FirstPerson => None, }, match camera_mode { - CameraMode::ThirdPerson => Some( - humanoid_armor_pants_spec.mesh_pants( - body.pants, - body.race, - body.skin, - body.hair_color, - body.eye_color, - ) - ), + CameraMode::ThirdPerson => { + Some(humanoid_armor_pants_spec.mesh_pants(&body)) + } CameraMode::FirstPerson => None, }, if camera_mode == CameraMode::FirstPerson @@ -155,13 +137,7 @@ impl FigureModelCache { { None } else { - Some(humanoid_armor_hand_spec.mesh_left_hand( - body.hand, - body.race, - body.skin, - body.hair_color, - body.eye_color, - )) + Some(humanoid_armor_hand_spec.mesh_left_hand(&body)) }, if character_state .map(|cs| cs.movement.is_roll()) @@ -169,36 +145,18 @@ impl FigureModelCache { { None } else { - Some(humanoid_armor_hand_spec.mesh_right_hand( - body.hand, - body.race, - body.skin, - body.hair_color, - body.eye_color, - )) + Some(humanoid_armor_hand_spec.mesh_right_hand(&body)) }, match camera_mode { - CameraMode::ThirdPerson => Some( - humanoid_armor_foot_spec.mesh_left_foot( - body.foot, - body.race, - body.skin, - body.hair_color, - body.eye_color, - ) - ), + CameraMode::ThirdPerson => { + Some(humanoid_armor_foot_spec.mesh_left_foot(&body)) + } CameraMode::FirstPerson => None, }, match camera_mode { - CameraMode::ThirdPerson => Some( - humanoid_armor_foot_spec.mesh_right_foot( - body.foot, - body.race, - body.skin, - body.hair_color, - body.eye_color, - ) - ), + CameraMode::ThirdPerson => { + Some(humanoid_armor_foot_spec.mesh_right_foot(&body)) + } CameraMode::FirstPerson => None, }, if camera_mode != CameraMode::FirstPerson @@ -216,25 +174,13 @@ impl FigureModelCache { }, match camera_mode { CameraMode::ThirdPerson => Some( - humanoid_armor_shoulder_spec.mesh_left_shoulder( - body.shoulder, - body.race, - body.skin, - body.hair_color, - body.eye_color, - ) + humanoid_armor_shoulder_spec.mesh_left_shoulder(&body), ), CameraMode::FirstPerson => None, }, match camera_mode { CameraMode::ThirdPerson => Some( - humanoid_armor_shoulder_spec.mesh_right_shoulder( - body.shoulder, - body.race, - body.skin, - body.hair_color, - body.eye_color, - ) + humanoid_armor_shoulder_spec.mesh_right_shoulder(&body), ), CameraMode::FirstPerson => None, }, diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 9fbe4a5ed4..f0c0a70627 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -2,6 +2,7 @@ use crate::{ mesh::Meshable, render::{FigurePipeline, Mesh}, }; +use common::comp::humanoid::Body; use common::{ assets::{self, watch::ReloadIndicator, Asset}, comp::{ @@ -88,17 +89,17 @@ struct VoxSpec(String, [T; 3]); // Armor can have the color modified. #[derive(Serialize, Deserialize)] -struct ArmorVoxSpec{ +struct ArmorVoxSpec { vox_spec: VoxSpec, recolor: bool, - color: [u8; 3] + color: Option<[u8; 3]>, } // For use by armor with a left and right component #[derive(Serialize, Deserialize)] -struct SidedArmorVoxSpec{ +struct SidedArmorVoxSpec { left: ArmorVoxSpec, - right: ArmorVoxSpec + right: ArmorVoxSpec, } // All reliant on humanoid::Race and humanoid::BodyType @@ -264,62 +265,43 @@ impl Asset for HumArmorFootSpec { impl HumArmorShoulderSpec { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { - assets::load_watched::("voxygen.voxel.humanoid_armor_shoulder_manifest", indicator).unwrap() + assets::load_watched::("voxygen.voxel.humanoid_armor_shoulder_manifest", indicator) + .unwrap() } - pub fn mesh_left_shoulder( - &self, - shoulder: Shoulder, - race: Race, - skin: u8, - hair_color: u8, - eye_color: u8, - ) -> Mesh { - let spec = match self.0.get(&shoulder) { + pub fn mesh_left_shoulder(&self, body: &Body) -> Mesh { + let spec = match self.0.get(&body.shoulder) { Some(spec) => spec, None => { - error!( - "No shoulder specification exists for {:?}", - shoulder - ); + error!("No shoulder specification exists for {:?}", body.shoulder); return load_mesh("not_found", Vec3::new(-3.0, -3.5, 0.1)); } }; let shoulder_segment = color_segment( graceful_load_mat_segment(&spec.left.vox_spec.0), - race.skin_color(skin), - race.hair_color(hair_color), - race.eye_color(eye_color), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), ); generate_mesh(&shoulder_segment, Vec3::from(spec.left.vox_spec.1)) } - pub fn mesh_right_shoulder( - &self, - shoulder: Shoulder, - race: Race, - skin: u8, - hair_color: u8, - eye_color: u8, - ) -> Mesh { - let spec = match self.0.get(&shoulder) { + pub fn mesh_right_shoulder(&self, body: &Body) -> Mesh { + let spec = match self.0.get(&body.shoulder) { Some(spec) => spec, None => { - error!( - "No shoulder specification exists for {:?}", - shoulder - ); + error!("No shoulder specification exists for {:?}", body.shoulder); return load_mesh("not_found", Vec3::new(-2.0, -3.5, 0.1)); } }; - + let shoulder_segment = color_segment( graceful_load_mat_segment(&spec.right.vox_spec.0), - race.skin_color(skin), - race.hair_color(hair_color), - race.eye_color(eye_color), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), ); generate_mesh(&shoulder_segment, Vec3::from(spec.right.vox_spec.1)) @@ -328,36 +310,30 @@ impl HumArmorShoulderSpec { impl HumArmorChestSpec { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { - assets::load_watched::("voxygen.voxel.humanoid_armor_chest_manifest", indicator).unwrap() + assets::load_watched::("voxygen.voxel.humanoid_armor_chest_manifest", indicator) + .unwrap() } - pub fn mesh_chest( - &self, - chest: Chest, - race: Race, - skin: u8, - hair_color: u8, - eye_color: u8, - ) -> Mesh { - let spec = match self.0.get(&chest) { + pub fn mesh_chest(&self, body: &Body) -> Mesh { + let spec = match self.0.get(&body.chest) { Some(spec) => spec, None => { - error!( - "No chest specification exists for {:?}", - chest - ); + error!("No chest specification exists for {:?}", body.chest); return load_mesh("not_found", Vec3::new(-7.0, -3.5, 2.0)); } }; - let chest_color = Vec3::from(spec.color); + let chest_color = Vec3::from(match spec.color { + Some(color_array) => color_array, + _ => [0, 0, 0], + }); let color = |mat_segment| { color_segment( mat_segment, - race.skin_color(skin), - race.hair_color(hair_color), - race.eye_color(eye_color), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), ) }; @@ -368,13 +344,10 @@ impl HumArmorChestSpec { if spec.recolor { chest_armor = chest_armor.map_rgb(|rgb| recolor_grey(rgb, Rgb::from(chest_color))) } - + let chest = DynaUnionizer::new() .add(color(bare_chest), Vec3::new(0, 0, 0)) - .add( - color(chest_armor), - Vec3::new(0, 0, 0), - ) + .add(color(chest_armor), Vec3::new(0, 0, 0)) .unify() .0; @@ -384,62 +357,43 @@ impl HumArmorChestSpec { impl HumArmorHandSpec { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { - assets::load_watched::("voxygen.voxel.humanoid_armor_hand_manifest", indicator).unwrap() + assets::load_watched::("voxygen.voxel.humanoid_armor_hand_manifest", indicator) + .unwrap() } - pub fn mesh_left_hand( - &self, - hand: Hand, - race: Race, - skin: u8, - hair_color: u8, - eye_color: u8, - ) -> Mesh { - let spec = match self.0.get(&hand) { + pub fn mesh_left_hand(&self, body: &Body) -> Mesh { + let spec = match self.0.get(&body.hand) { Some(spec) => spec, None => { - error!( - "No hand specification exists for {:?}", - hand - ); + error!("No hand specification exists for {:?}", body.hand); return load_mesh("not_found", Vec3::new(-1.5, -1.5, -7.0)); } }; let hand_segment = color_segment( graceful_load_mat_segment(&spec.left.vox_spec.0), - race.skin_color(skin), - race.hair_color(hair_color), - race.eye_color(eye_color), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), ); generate_mesh(&hand_segment, Vec3::from(spec.left.vox_spec.1)) } - - pub fn mesh_right_hand( - &self, - hand: Hand, - race: Race, - skin: u8, - hair_color: u8, - eye_color: u8, - ) -> Mesh { - let spec = match self.0.get(&hand) { + + pub fn mesh_right_hand(&self, body: &Body) -> Mesh { + let spec = match self.0.get(&body.hand) { Some(spec) => spec, None => { - error!( - "No hand specification exists for {:?}", - hand - ); + error!("No hand specification exists for {:?}", body.hand); return load_mesh("not_found", Vec3::new(-1.5, -1.5, -7.0)); } }; let hand_segment = color_segment( graceful_load_mat_segment(&spec.left.vox_spec.0), - race.skin_color(skin), - race.hair_color(hair_color), - race.eye_color(eye_color), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), ); generate_mesh(&hand_segment, Vec3::from(spec.left.vox_spec.1)) @@ -448,33 +402,24 @@ impl HumArmorHandSpec { impl HumArmorBeltSpec { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { - assets::load_watched::("voxygen.voxel.humanoid_armor_belt_manifest", indicator).unwrap() + assets::load_watched::("voxygen.voxel.humanoid_armor_belt_manifest", indicator) + .unwrap() } - pub fn mesh_belt( - &self, - belt: Belt, - race: Race, - skin: u8, - hair_color: u8, - eye_color: u8, - ) -> Mesh { - let spec = match self.0.get(&belt) { + pub fn mesh_belt(&self, body: &Body) -> Mesh { + let spec = match self.0.get(&body.belt) { Some(spec) => spec, None => { - error!( - "No belt specification exists for {:?}", - belt - ); + error!("No belt specification exists for {:?}", body.belt); return load_mesh("not_found", Vec3::new(-4.0, -3.5, 2.0)); } }; let belt_segment = color_segment( graceful_load_mat_segment(&spec.vox_spec.0), - race.skin_color(skin), - race.hair_color(hair_color), - race.eye_color(eye_color), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), ); generate_mesh(&belt_segment, Vec3::from(spec.vox_spec.1)) @@ -483,36 +428,30 @@ impl HumArmorBeltSpec { impl HumArmorPantsSpec { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { - assets::load_watched::("voxygen.voxel.humanoid_armor_pants_manifest", indicator).unwrap() + assets::load_watched::("voxygen.voxel.humanoid_armor_pants_manifest", indicator) + .unwrap() } - pub fn mesh_pants( - &self, - pants: Pants, - race: Race, - skin: u8, - hair_color: u8, - eye_color: u8, - ) -> Mesh { - let spec = match self.0.get(&pants) { + pub fn mesh_pants(&self, body: &Body) -> Mesh { + let spec = match self.0.get(&body.pants) { Some(spec) => spec, None => { - error!( - "No pants specification exists for {:?}", - pants - ); + error!("No pants specification exists for {:?}", body.pants); return load_mesh("not_found", Vec3::new(-5.0, -3.5, 1.0)); } }; - let pants_color = Vec3::from(spec.color); + let pants_color = Vec3::from(match spec.color { + Some(color_array) => color_array, + _ => [0, 0, 0], + }); let color = |mat_segment| { color_segment( mat_segment, - race.skin_color(skin), - race.hair_color(hair_color), - race.eye_color(eye_color), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), ) }; @@ -523,13 +462,10 @@ impl HumArmorPantsSpec { if spec.recolor { pants_armor = pants_armor.map_rgb(|rgb| recolor_grey(rgb, Rgb::from(pants_color))) } - + let pants = DynaUnionizer::new() .add(color(bare_pants), Vec3::new(0, 0, 0)) - .add( - color(pants_armor), - Vec3::new(0, 0, 0), - ) + .add(color(pants_armor), Vec3::new(0, 0, 0)) .unify() .0; @@ -539,62 +475,43 @@ impl HumArmorPantsSpec { impl HumArmorFootSpec { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { - assets::load_watched::("voxygen.voxel.humanoid_armor_foot_manifest", indicator).unwrap() + assets::load_watched::("voxygen.voxel.humanoid_armor_foot_manifest", indicator) + .unwrap() } - pub fn mesh_left_foot( - &self, - foot: Foot, - race: Race, - skin: u8, - hair_color: u8, - eye_color: u8, - ) -> Mesh { - let spec = match self.0.get(&foot) { + pub fn mesh_left_foot(&self, body: &Body) -> Mesh { + let spec = match self.0.get(&body.foot) { Some(spec) => spec, None => { - error!( - "No foot specification exists for {:?}", - foot - ); + error!("No foot specification exists for {:?}", body.foot); return load_mesh("not_found", Vec3::new(-2.5, -3.5, -9.0)); } }; let foot_segment = color_segment( graceful_load_mat_segment(&spec.vox_spec.0), - race.skin_color(skin), - race.hair_color(hair_color), - race.eye_color(eye_color), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), ); generate_mesh(&foot_segment, Vec3::from(spec.vox_spec.1)) } - pub fn mesh_right_foot( - &self, - foot: Foot, - race: Race, - skin: u8, - hair_color: u8, - eye_color: u8, - ) -> Mesh { - let spec = match self.0.get(&foot) { + pub fn mesh_right_foot(&self, body: &Body) -> Mesh { + let spec = match self.0.get(&body.foot) { Some(spec) => spec, None => { - error!( - "No foot specification exists for {:?}", - foot - ); + error!("No foot specification exists for {:?}", body.foot); return load_mesh("not_found", Vec3::new(-2.5, -3.5, -9.0)); } }; let foot_segment = color_segment( graceful_load_mat_segment(&spec.vox_spec.0), - race.skin_color(skin), - race.hair_color(hair_color), - race.eye_color(eye_color), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), ); generate_mesh(&foot_segment, Vec3::from(spec.vox_spec.1))