From ea2c646df3c62e1c41f4b50f7a22e0e7499d0fc7 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Mon, 6 Apr 2020 22:55:16 -0400 Subject: [PATCH] initial cape implementation --- assets/voxygen/voxel/armor/back/short-0.vox | 4 +- .../voxel/humanoid_armor_back_manifest.ron | 2 +- voxygen/src/anim/biped_large/mod.rs | 3 +- voxygen/src/anim/bird_medium/mod.rs | 3 +- voxygen/src/anim/bird_small/mod.rs | 3 +- voxygen/src/anim/character/jump.rs | 4 + voxygen/src/anim/character/mod.rs | 5 +- voxygen/src/anim/character/run.rs | 4 + voxygen/src/anim/character/stand.rs | 6 +- voxygen/src/anim/critter/mod.rs | 3 +- voxygen/src/anim/dragon/mod.rs | 3 +- voxygen/src/anim/fish_medium/mod.rs | 3 +- voxygen/src/anim/fish_small/mod.rs | 3 +- voxygen/src/anim/fixture/mod.rs | 3 +- voxygen/src/anim/mod.rs | 2 +- voxygen/src/anim/object/mod.rs | 3 +- voxygen/src/anim/quadruped_medium/mod.rs | 3 +- voxygen/src/anim/quadruped_small/mod.rs | 3 +- voxygen/src/scene/figure/cache.rs | 11 +- voxygen/src/scene/figure/load.rs | 103 ++++++++---------- 20 files changed, 96 insertions(+), 78 deletions(-) diff --git a/assets/voxygen/voxel/armor/back/short-0.vox b/assets/voxygen/voxel/armor/back/short-0.vox index b9c5362a58..135b2afb14 100644 --- a/assets/voxygen/voxel/armor/back/short-0.vox +++ b/assets/voxygen/voxel/armor/back/short-0.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9c9e63b1debc909844e95ad7eb8b16c3dc94d1362b541fca7028f24dc2398fbd -size 44573 +oid sha256:d6d796f4f333329f6b84d63748bd217e055a3f0b4e22342eef59566e8fff0daf +size 1456 diff --git a/assets/voxygen/voxel/humanoid_armor_back_manifest.ron b/assets/voxygen/voxel/humanoid_armor_back_manifest.ron index 142a876de6..6601f0e9ab 100644 --- a/assets/voxygen/voxel/humanoid_armor_back_manifest.ron +++ b/assets/voxygen/voxel/humanoid_armor_back_manifest.ron @@ -5,7 +5,7 @@ ), map: { Short0: ( - vox_spec: ("armor.back.short-0", (10.0, 10.0, 10.0)), + vox_spec: ("armor.back.short-0", (-5.0, -1.0, -11.0)), color: None ), }, diff --git a/voxygen/src/anim/biped_large/mod.rs b/voxygen/src/anim/biped_large/mod.rs index 282c094876..0a066963a4 100644 --- a/voxygen/src/anim/biped_large/mod.rs +++ b/voxygen/src/anim/biped_large/mod.rs @@ -47,7 +47,7 @@ impl BipedLargeSkeleton { impl Skeleton for BipedLargeSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { let upper_torso_mat = self.upper_torso.compute_base_matrix(); let shoulder_l_mat = self.shoulder_l.compute_base_matrix(); let shoulder_r_mat = self.shoulder_r.compute_base_matrix(); @@ -80,6 +80,7 @@ impl Skeleton for BipedLargeSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/bird_medium/mod.rs b/voxygen/src/anim/bird_medium/mod.rs index 8e15bdaef2..0d134a31cb 100644 --- a/voxygen/src/anim/bird_medium/mod.rs +++ b/voxygen/src/anim/bird_medium/mod.rs @@ -27,7 +27,7 @@ impl BirdMediumSkeleton { impl Skeleton for BirdMediumSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { let torso_mat = self.torso.compute_base_matrix(); [ @@ -49,6 +49,7 @@ impl Skeleton for BirdMediumSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/bird_small/mod.rs b/voxygen/src/anim/bird_small/mod.rs index 763bb2fac8..b2989c9cee 100644 --- a/voxygen/src/anim/bird_small/mod.rs +++ b/voxygen/src/anim/bird_small/mod.rs @@ -31,7 +31,7 @@ impl BirdSmallSkeleton { impl Skeleton for BirdSmallSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { let torso_mat = self.torso.compute_base_matrix(); [ @@ -53,6 +53,7 @@ impl Skeleton for BirdSmallSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index ba90251487..82d09590c3 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -36,6 +36,10 @@ impl Animation for JumpAnimation { next.belt.ori = Quaternion::rotation_z(0.0); next.belt.scale = Vec3::one(); + next.back.offset = Vec3::new(0.0, -2.8, 7.25); + next.back.ori = Quaternion::rotation_z(0.0); + next.back.scale = Vec3::one() * 1.02; + next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); next.shorts.ori = Quaternion::rotation_z(0.0); next.shorts.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 26cf805191..8dc6e083f3 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -37,6 +37,7 @@ pub struct CharacterSkeleton { head: Bone, chest: Bone, belt: Bone, + back: Bone, shorts: Bone, l_hand: Bone, r_hand: Bone, @@ -61,7 +62,7 @@ impl CharacterSkeleton { impl Skeleton for CharacterSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { let chest_mat = self.chest.compute_base_matrix(); let torso_mat = self.torso.compute_base_matrix(); let l_hand_mat = self.l_hand.compute_base_matrix(); @@ -77,6 +78,7 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::new(torso_mat * chest_mat * head_mat), FigureBoneData::new(torso_mat * chest_mat), FigureBoneData::new(torso_mat * chest_mat * self.belt.compute_base_matrix()), + FigureBoneData::new(torso_mat * chest_mat * self.back.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * self.shorts.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * control_mat * l_control_mat * l_hand_mat), FigureBoneData::new(torso_mat * chest_mat * control_mat * r_control_mat * r_hand_mat), @@ -99,6 +101,7 @@ impl Skeleton for CharacterSkeleton { self.head.interpolate(&target.head, dt); self.chest.interpolate(&target.chest, dt); self.belt.interpolate(&target.belt, dt); + self.back.interpolate(&target.back, dt); self.shorts.interpolate(&target.shorts, dt); self.l_hand.interpolate(&target.l_hand, dt); self.r_hand.interpolate(&target.r_hand, dt); diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index 27643664a1..594b4634d2 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -90,6 +90,10 @@ impl Animation for RunAnimation { next.belt.ori = Quaternion::rotation_z(short * 0.25); next.belt.scale = Vec3::one(); + next.back.offset = Vec3::new(0.0, -2.8, 7.25); + next.back.ori = Quaternion::rotation_z(0.0); + next.back.scale = Vec3::one() * 1.02; + next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); next.shorts.ori = Quaternion::rotation_z(short * 0.4); next.shorts.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/stand.rs b/voxygen/src/anim/character/stand.rs index 74b77ff306..97f9660e39 100644 --- a/voxygen/src/anim/character/stand.rs +++ b/voxygen/src/anim/character/stand.rs @@ -50,6 +50,10 @@ impl Animation for StandAnimation { next.belt.ori = Quaternion::rotation_z(head_look.x * -0.1); next.belt.scale = Vec3::one() + breathe * -0.05; + next.back.offset = Vec3::new(0.0, -2.8, 7.25); + next.back.ori = Quaternion::rotation_z(0.0); + next.back.scale = Vec3::one() * 1.02; + next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); //2 next.shorts.ori = Quaternion::rotation_x(head_look.x * -0.2); next.shorts.scale = Vec3::one() + breathe * -0.05; @@ -101,7 +105,7 @@ impl Animation for StandAnimation { next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); next.lantern.ori = Quaternion::rotation_x(0.0); - next.lantern.scale = Vec3::one() * 0.0; + next.lantern.scale = Vec3::one() * 5.0; next.torso.offset = Vec3::new(0.0, -0.1, 0.1) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(0.0); diff --git a/voxygen/src/anim/critter/mod.rs b/voxygen/src/anim/critter/mod.rs index 4a2c05ef6d..3c0538b5e4 100644 --- a/voxygen/src/anim/critter/mod.rs +++ b/voxygen/src/anim/critter/mod.rs @@ -32,7 +32,7 @@ impl CritterSkeleton { impl Skeleton for CritterSkeleton { type Attr = CritterAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { [ FigureBoneData::new(self.head.compute_base_matrix()), FigureBoneData::new(self.chest.compute_base_matrix()), @@ -52,6 +52,7 @@ impl Skeleton for CritterSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/dragon/mod.rs b/voxygen/src/anim/dragon/mod.rs index 131d78dc24..5121b7f7c0 100644 --- a/voxygen/src/anim/dragon/mod.rs +++ b/voxygen/src/anim/dragon/mod.rs @@ -49,7 +49,7 @@ impl DragonSkeleton { impl Skeleton for DragonSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { let chest_front_mat = self.chest_front.compute_base_matrix(); let wing_in_l_mat = self.wing_in_l.compute_base_matrix(); let wing_in_r_mat = self.wing_in_r.compute_base_matrix(); @@ -74,6 +74,7 @@ impl Skeleton for DragonSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/fish_medium/mod.rs b/voxygen/src/anim/fish_medium/mod.rs index 5912719299..919a08918c 100644 --- a/voxygen/src/anim/fish_medium/mod.rs +++ b/voxygen/src/anim/fish_medium/mod.rs @@ -35,7 +35,7 @@ impl FishMediumSkeleton { impl Skeleton for FishMediumSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { let torso_mat = self.torso.compute_base_matrix(); let rear_mat = self.rear.compute_base_matrix(); @@ -58,6 +58,7 @@ impl Skeleton for FishMediumSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/fish_small/mod.rs b/voxygen/src/anim/fish_small/mod.rs index e1b47513f7..1b652c61c5 100644 --- a/voxygen/src/anim/fish_small/mod.rs +++ b/voxygen/src/anim/fish_small/mod.rs @@ -27,7 +27,7 @@ impl FishSmallSkeleton { impl Skeleton for FishSmallSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { let torso_mat = self.torso.compute_base_matrix(); [ @@ -49,6 +49,7 @@ impl Skeleton for FishSmallSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/fixture/mod.rs b/voxygen/src/anim/fixture/mod.rs index a243b923a4..9b45c2fca8 100644 --- a/voxygen/src/anim/fixture/mod.rs +++ b/voxygen/src/anim/fixture/mod.rs @@ -13,7 +13,7 @@ impl FixtureSkeleton { impl Skeleton for FixtureSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { [ FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()), @@ -33,6 +33,7 @@ impl Skeleton for FixtureSkeleton { FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()), + FigureBoneData::new(vek::Mat4::identity()), ] } diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index 13eaff91f1..82950e49da 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -52,7 +52,7 @@ impl Bone { pub trait Skeleton: Send + Sync + 'static { type Attr; - fn compute_matrices(&self) -> [FigureBoneData; 18]; + fn compute_matrices(&self) -> [FigureBoneData; 19]; /// Change the current skeleton to be more like `target`. fn interpolate(&mut self, target: &Self, dt: f32); diff --git a/voxygen/src/anim/object/mod.rs b/voxygen/src/anim/object/mod.rs index b9befc2522..e2b587139e 100644 --- a/voxygen/src/anim/object/mod.rs +++ b/voxygen/src/anim/object/mod.rs @@ -15,7 +15,7 @@ const SCALE: f32 = 1.0 / 11.0; impl Skeleton for ObjectSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { [ FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), @@ -35,6 +35,7 @@ impl Skeleton for ObjectSkeleton { FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), + FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), ] } diff --git a/voxygen/src/anim/quadruped_medium/mod.rs b/voxygen/src/anim/quadruped_medium/mod.rs index a30eaa0203..3be2ef9599 100644 --- a/voxygen/src/anim/quadruped_medium/mod.rs +++ b/voxygen/src/anim/quadruped_medium/mod.rs @@ -31,7 +31,7 @@ impl QuadrupedMediumSkeleton { impl Skeleton for QuadrupedMediumSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { let ears_mat = self.ears.compute_base_matrix(); let head_upper_mat = self.head_upper.compute_base_matrix(); let head_lower_mat = self.head_lower.compute_base_matrix(); @@ -55,6 +55,7 @@ impl Skeleton for QuadrupedMediumSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/quadruped_small/mod.rs b/voxygen/src/anim/quadruped_small/mod.rs index a277b5aff8..c76b1e6a92 100644 --- a/voxygen/src/anim/quadruped_small/mod.rs +++ b/voxygen/src/anim/quadruped_small/mod.rs @@ -26,7 +26,7 @@ impl QuadrupedSmallSkeleton { impl Skeleton for QuadrupedSmallSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 18] { + fn compute_matrices(&self) -> [FigureBoneData; 19] { [ FigureBoneData::new(self.head.compute_base_matrix()), FigureBoneData::new(self.chest.compute_base_matrix()), @@ -46,6 +46,7 @@ impl Skeleton for QuadrupedSmallSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index 26961df98c..fb12fe9740 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -30,6 +30,7 @@ struct CharacterCacheKey { shoulder: Option, chest: Option, belt: Option, + back: Option, hand: Option, pants: Option, foot: Option, @@ -49,6 +50,7 @@ impl CharacterCacheKey { shoulder: loadout.shoulder.clone(), chest: loadout.chest.clone(), belt: loadout.belt.clone(), + back: loadout.back.clone(), hand: loadout.hand.clone(), pants: loadout.pants.clone(), foot: loadout.foot.clone(), @@ -118,6 +120,8 @@ impl FigureModelCache { HumArmorHandSpec::load_watched(&mut self.manifest_indicator); let humanoid_armor_belt_spec = HumArmorBeltSpec::load_watched(&mut self.manifest_indicator); + let humanoid_armor_back_spec = + HumArmorBackSpec::load_watched(&mut self.manifest_indicator); let humanoid_armor_pants_spec = HumArmorPantsSpec::load_watched(&mut self.manifest_indicator); let humanoid_armor_foot_spec = @@ -158,6 +162,12 @@ impl FigureModelCache { }, CameraMode::FirstPerson => None, }, + match camera_mode { + CameraMode::ThirdPerson => { + Some(humanoid_armor_back_spec.mesh_back(&body, loadout)) + }, + CameraMode::FirstPerson => None, + }, match camera_mode { CameraMode::ThirdPerson => Some( humanoid_armor_pants_spec.mesh_pants(&body, loadout), @@ -227,7 +237,6 @@ impl FigureModelCache { Some(mesh_lantern()), None, None, - None, ] }, Body::QuadrupedSmall(body) => { diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index c3cc21f428..bcae0fbf7c 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -251,14 +251,14 @@ pub struct HumArmorHandSpec(ArmorVoxSpecMap); #[derive(Serialize, Deserialize)] pub struct HumArmorBeltSpec(ArmorVoxSpecMap); #[derive(Serialize, Deserialize)] +pub struct HumArmorBackSpec(ArmorVoxSpecMap); +#[derive(Serialize, Deserialize)] pub struct HumArmorPantsSpec(ArmorVoxSpecMap); #[derive(Serialize, Deserialize)] pub struct HumArmorFootSpec(ArmorVoxSpecMap); #[derive(Serialize, Deserialize)] pub struct HumMainWeaponSpec(HashMap); #[derive(Serialize, Deserialize)] -pub struct HumArmorBackSpec(ArmorVoxSpecMap); -#[derive(Serialize, Deserialize)] pub struct HumArmorLanternSpec(ArmorVoxSpecMap); #[derive(Serialize, Deserialize)] pub struct HumArmorHeadSpec(ArmorVoxSpecMap); @@ -293,6 +293,13 @@ impl Asset for HumArmorBeltSpec { ron::de::from_reader(buf_reader).map_err(assets::Error::parse_error) } } +impl Asset for HumArmorBackSpec { + const ENDINGS: &'static [&'static str] = &["ron"]; + + fn parse(buf_reader: BufReader) -> Result { + ron::de::from_reader(buf_reader).map_err(assets::Error::parse_error) + } +} impl Asset for HumArmorPantsSpec { const ENDINGS: &'static [&'static str] = &["ron"]; @@ -307,13 +314,6 @@ impl Asset for HumArmorFootSpec { ron::de::from_reader(buf_reader).map_err(assets::Error::parse_error) } } -impl Asset for HumArmorBackSpec { - const ENDINGS: &'static [&'static str] = &["ron"]; - - fn parse(buf_reader: BufReader) -> Result { - ron::de::from_reader(buf_reader).map_err(assets::Error::parse_error) - } -} impl Asset for HumArmorLanternSpec { const ENDINGS: &'static [&'static str] = &["ron"]; @@ -536,6 +536,40 @@ impl HumArmorBeltSpec { generate_mesh(&belt_segment, Vec3::from(spec.vox_spec.1)) } } +// Cape +impl HumArmorBackSpec { + pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { + assets::load_watched::("voxygen.voxel.humanoid_armor_back_manifest", indicator) + .unwrap() + } + + pub fn mesh_back(&self, body: &Body, loadout: &Loadout) -> Mesh { + let spec = if let Some(ItemKind::Armor { + kind: Armor::Back(back), + .. + }) = loadout.back.as_ref().map(|i| &i.kind) + { + match self.0.map.get(&back) { + Some(spec) => spec, + None => { + error!("No back specification exists for {:?}", back); + return load_mesh("not_found", Vec3::new(-4.0, -3.5, 2.0)); + }, + } + } else { + &self.0.default + }; + + let back_segment = color_segment( + graceful_load_mat_segment(&spec.vox_spec.0), + body.race.skin_color(body.skin), + body.race.hair_color(body.hair_color), + body.race.eye_color(body.eye_color), + ); + + generate_mesh(&back_segment, Vec3::from(spec.vox_spec.1)) + } +} // Legs impl HumArmorPantsSpec { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { @@ -659,57 +693,6 @@ impl HumMainWeaponSpec { generate_mesh(&tool_kind_segment, Vec3::from(spec.vox_spec.1)) } } -// Back -impl HumArmorBackSpec { - pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc { - assets::load_watched::("voxygen.voxel.humanoid_armor_back_manifest", indicator) - .unwrap() - } - - pub fn mesh_back(&self, body: &Body, loadout: &Loadout) -> Mesh { - let spec = if let Some(ItemKind::Armor { - kind: Armor::Back(back), - .. - }) = loadout.back.as_ref().map(|i| &i.kind) - { - match self.0.map.get(&back) { - Some(spec) => spec, - None => { - error!("No back-armor specification exists for {:?}", back); - return load_mesh("not_found", Vec3::new(-5.0, -3.5, 1.0)); - }, - } - } else { - &self.0.default - }; - - let color = |mat_segment| { - color_segment( - mat_segment, - body.race.skin_color(body.skin), - body.race.hair_color(body.hair_color), - body.race.eye_color(body.eye_color), - ) - }; - - let bare_back = graceful_load_mat_segment("armor.empty"); - - let mut back_armor = graceful_load_mat_segment(&spec.vox_spec.0); - - if let Some(color) = spec.color { - let back_color = Vec3::from(color); - back_armor = back_armor.map_rgb(|rgb| recolor_grey(rgb, Rgb::from(back_color))); - } - - let back = DynaUnionizer::new() - .add(color(bare_back), Vec3::new(0, 0, 0)) - .add(color(back_armor), Vec3::new(0, 0, 0)) - .unify() - .0; - - generate_mesh(&back, Vec3::from(spec.vox_spec.1)) - } -} // Lantern impl HumArmorLanternSpec { pub fn load_watched(indicator: &mut ReloadIndicator) -> Arc {