Fixed figure update rate at a distance

This commit is contained in:
Joshua Barretto 2020-04-24 19:52:44 +01:00
parent 39b88dbcb1
commit ebd1537769
4 changed files with 788 additions and 355 deletions

View File

@ -1,25 +1,25 @@
use super::load::*; use super::load::*;
use crate::{ use crate::{
anim::{self, Skeleton}, anim::{self, Skeleton},
mesh::Meshable,
render::{FigurePipeline, Mesh, Model, Renderer}, render::{FigurePipeline, Mesh, Model, Renderer},
scene::camera::CameraMode, scene::camera::CameraMode,
mesh::Meshable,
}; };
use common::{ use common::{
figure::Segment,
assets::watch::ReloadIndicator, assets::watch::ReloadIndicator,
comp::{ comp::{
item::{tool::ToolKind, ItemKind}, item::{tool::ToolKind, ItemKind},
Body, CharacterState, Item, Loadout, Body, CharacterState, Item, Loadout,
}, },
figure::Segment,
vol::BaseVol, vol::BaseVol,
}; };
use vek::*;
use hashbrown::{hash_map::Entry, HashMap}; use hashbrown::{hash_map::Entry, HashMap};
use std::{ use std::{
convert::TryInto, convert::TryInto,
mem::{discriminant, Discriminant}, mem::{discriminant, Discriminant},
}; };
use vek::*;
#[derive(PartialEq, Eq, Hash, Clone)] #[derive(PartialEq, Eq, Hash, Clone)]
enum FigureKey { enum FigureKey {
@ -90,26 +90,18 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
) -> [Option<Mesh<FigurePipeline>>; 16] { ) -> [Option<Mesh<FigurePipeline>>; 16] {
match body { match body {
Body::Humanoid(body) => { Body::Humanoid(body) => {
let humanoid_head_spec = let humanoid_head_spec = HumHeadSpec::load_watched(manifest_indicator);
HumHeadSpec::load_watched(manifest_indicator);
let humanoid_armor_shoulder_spec = let humanoid_armor_shoulder_spec =
HumArmorShoulderSpec::load_watched(manifest_indicator); HumArmorShoulderSpec::load_watched(manifest_indicator);
let humanoid_armor_chest_spec = let humanoid_armor_chest_spec = HumArmorChestSpec::load_watched(manifest_indicator);
HumArmorChestSpec::load_watched(manifest_indicator); let humanoid_armor_hand_spec = HumArmorHandSpec::load_watched(manifest_indicator);
let humanoid_armor_hand_spec = let humanoid_armor_belt_spec = HumArmorBeltSpec::load_watched(manifest_indicator);
HumArmorHandSpec::load_watched(manifest_indicator); let humanoid_armor_back_spec = HumArmorBackSpec::load_watched(manifest_indicator);
let humanoid_armor_belt_spec =
HumArmorBeltSpec::load_watched(manifest_indicator);
let humanoid_armor_back_spec =
HumArmorBackSpec::load_watched(manifest_indicator);
let humanoid_armor_lantern_spec = let humanoid_armor_lantern_spec =
HumArmorLanternSpec::load_watched(manifest_indicator); HumArmorLanternSpec::load_watched(manifest_indicator);
let humanoid_armor_pants_spec = let humanoid_armor_pants_spec = HumArmorPantsSpec::load_watched(manifest_indicator);
HumArmorPantsSpec::load_watched(manifest_indicator); let humanoid_armor_foot_spec = HumArmorFootSpec::load_watched(manifest_indicator);
let humanoid_armor_foot_spec = let humanoid_main_weapon_spec = HumMainWeaponSpec::load_watched(manifest_indicator);
HumArmorFootSpec::load_watched(manifest_indicator);
let humanoid_main_weapon_spec =
HumMainWeaponSpec::load_watched(manifest_indicator);
// TODO: This is bad code, maybe this method should return Option<_> // TODO: This is bad code, maybe this method should return Option<_>
let default_loadout = Loadout::default(); let default_loadout = Loadout::default();
@ -117,26 +109,26 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
[ [
match camera_mode { match camera_mode {
CameraMode::ThirdPerson => { CameraMode::ThirdPerson => Some(humanoid_head_spec.mesh_head(
Some(humanoid_head_spec.mesh_head( body.race,
body.race, body.body_type,
body.body_type, body.hair_color,
body.hair_color, body.hair_style,
body.hair_style, body.beard,
body.beard, body.eye_color,
body.eye_color, body.skin,
body.skin, body.eyebrows,
body.eyebrows, body.accessory,
body.accessory, generate_mesh,
generate_mesh, )),
))
},
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
match camera_mode { match camera_mode {
CameraMode::ThirdPerson => Some( CameraMode::ThirdPerson => Some(humanoid_armor_chest_spec.mesh_chest(
humanoid_armor_chest_spec.mesh_chest(&body, loadout, generate_mesh), &body,
), loadout,
generate_mesh,
)),
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
match camera_mode { match camera_mode {
@ -152,63 +144,69 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
match camera_mode { match camera_mode {
CameraMode::ThirdPerson => Some( CameraMode::ThirdPerson => Some(humanoid_armor_pants_spec.mesh_pants(
humanoid_armor_pants_spec.mesh_pants(&body, loadout, generate_mesh), &body,
), loadout,
generate_mesh,
)),
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
if camera_mode == CameraMode::FirstPerson if camera_mode == CameraMode::FirstPerson
&& character_state && character_state.map(|cs| cs.is_dodge()).unwrap_or_default()
.map(|cs| cs.is_dodge())
.unwrap_or_default()
{ {
None None
} else { } else {
Some( Some(humanoid_armor_hand_spec.mesh_left_hand(&body, loadout, generate_mesh))
humanoid_armor_hand_spec.mesh_left_hand(&body, loadout, generate_mesh),
)
}, },
if character_state.map(|cs| cs.is_dodge()).unwrap_or_default() { if character_state.map(|cs| cs.is_dodge()).unwrap_or_default() {
None None
} else { } else {
Some( Some(humanoid_armor_hand_spec.mesh_right_hand(
humanoid_armor_hand_spec &body,
.mesh_right_hand(&body, loadout, generate_mesh), loadout,
) generate_mesh,
))
}, },
match camera_mode { match camera_mode {
CameraMode::ThirdPerson => Some( CameraMode::ThirdPerson => Some(humanoid_armor_foot_spec.mesh_left_foot(
humanoid_armor_foot_spec.mesh_left_foot(&body, loadout, generate_mesh), &body,
), loadout,
generate_mesh,
)),
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
match camera_mode { match camera_mode {
CameraMode::ThirdPerson => Some( CameraMode::ThirdPerson => Some(humanoid_armor_foot_spec.mesh_right_foot(
humanoid_armor_foot_spec &body,
.mesh_right_foot(&body, loadout, generate_mesh), loadout,
), generate_mesh,
)),
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
match camera_mode { match camera_mode {
CameraMode::ThirdPerson => Some( CameraMode::ThirdPerson => {
humanoid_armor_shoulder_spec Some(humanoid_armor_shoulder_spec.mesh_left_shoulder(
.mesh_left_shoulder(&body, loadout, generate_mesh), &body,
), loadout,
generate_mesh,
))
},
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
match camera_mode { match camera_mode {
CameraMode::ThirdPerson => Some( CameraMode::ThirdPerson => {
humanoid_armor_shoulder_spec Some(humanoid_armor_shoulder_spec.mesh_right_shoulder(
.mesh_right_shoulder(&body, loadout, generate_mesh), &body,
), loadout,
generate_mesh,
))
},
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
Some(mesh_glider(generate_mesh)), Some(mesh_glider(generate_mesh)),
if camera_mode != CameraMode::FirstPerson if camera_mode != CameraMode::FirstPerson
|| character_state || character_state
.map(|cs| { .map(|cs| cs.is_attack() || cs.is_block() || cs.is_wield())
cs.is_attack() || cs.is_block() || cs.is_wield()
})
.unwrap_or_default() .unwrap_or_default()
{ {
Some(humanoid_main_weapon_spec.mesh_main_weapon( Some(humanoid_main_weapon_spec.mesh_main_weapon(
@ -230,30 +228,36 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
QuadrupedSmallLateralSpec::load_watched(manifest_indicator); QuadrupedSmallLateralSpec::load_watched(manifest_indicator);
[ [
Some( Some(quadruped_small_central_spec.mesh_head(
quadruped_small_central_spec body.species,
.mesh_head(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
Some( )),
quadruped_small_central_spec Some(quadruped_small_central_spec.mesh_chest(
.mesh_chest(body.species, body.body_type, generate_mesh), body.species,
), body.body_type,
Some( generate_mesh,
quadruped_small_lateral_spec )),
.mesh_foot_lf(body.species, body.body_type, generate_mesh), Some(quadruped_small_lateral_spec.mesh_foot_lf(
), body.species,
Some( body.body_type,
quadruped_small_lateral_spec generate_mesh,
.mesh_foot_rf(body.species, body.body_type, generate_mesh), )),
), Some(quadruped_small_lateral_spec.mesh_foot_rf(
Some( body.species,
quadruped_small_lateral_spec body.body_type,
.mesh_foot_lb(body.species, body.body_type, generate_mesh), generate_mesh,
), )),
Some( Some(quadruped_small_lateral_spec.mesh_foot_lb(
quadruped_small_lateral_spec body.species,
.mesh_foot_rb(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
)),
Some(quadruped_small_lateral_spec.mesh_foot_rb(
body.species,
body.body_type,
generate_mesh,
)),
None, None,
None, None,
None, None,
@ -273,50 +277,61 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
QuadrupedMediumLateralSpec::load_watched(manifest_indicator); QuadrupedMediumLateralSpec::load_watched(manifest_indicator);
[ [
Some( Some(quadruped_medium_central_spec.mesh_head_upper(
quadruped_medium_central_spec body.species,
.mesh_head_upper(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
Some( )),
quadruped_medium_central_spec Some(quadruped_medium_central_spec.mesh_head_lower(
.mesh_head_lower(body.species, body.body_type, generate_mesh), body.species,
), body.body_type,
Some( generate_mesh,
quadruped_medium_central_spec )),
.mesh_jaw(body.species, body.body_type, generate_mesh), Some(quadruped_medium_central_spec.mesh_jaw(
), body.species,
Some( body.body_type,
quadruped_medium_central_spec generate_mesh,
.mesh_tail(body.species, body.body_type, generate_mesh), )),
), Some(quadruped_medium_central_spec.mesh_tail(
Some( body.species,
quadruped_medium_central_spec body.body_type,
.mesh_torso_f(body.species, body.body_type, generate_mesh), generate_mesh,
), )),
Some( Some(quadruped_medium_central_spec.mesh_torso_f(
quadruped_medium_central_spec body.species,
.mesh_torso_b(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
Some( )),
quadruped_medium_central_spec Some(quadruped_medium_central_spec.mesh_torso_b(
.mesh_ears(body.species, body.body_type, generate_mesh), body.species,
), body.body_type,
Some( generate_mesh,
quadruped_medium_lateral_spec )),
.mesh_foot_lf(body.species, body.body_type, generate_mesh), Some(quadruped_medium_central_spec.mesh_ears(
), body.species,
Some( body.body_type,
quadruped_medium_lateral_spec generate_mesh,
.mesh_foot_rf(body.species, body.body_type, generate_mesh), )),
), Some(quadruped_medium_lateral_spec.mesh_foot_lf(
Some( body.species,
quadruped_medium_lateral_spec body.body_type,
.mesh_foot_lb(body.species, body.body_type, generate_mesh), generate_mesh,
), )),
Some( Some(quadruped_medium_lateral_spec.mesh_foot_rf(
quadruped_medium_lateral_spec body.species,
.mesh_foot_rb(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
)),
Some(quadruped_medium_lateral_spec.mesh_foot_lb(
body.species,
body.body_type,
generate_mesh,
)),
Some(quadruped_medium_lateral_spec.mesh_foot_rb(
body.species,
body.body_type,
generate_mesh,
)),
None, None,
None, None,
None, None,
@ -325,38 +340,47 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
] ]
}, },
Body::BirdMedium(body) => { Body::BirdMedium(body) => {
let bird_medium_center_spec = BirdMediumCenterSpec::load_watched(manifest_indicator); let bird_medium_center_spec =
let bird_medium_lateral_spec = BirdMediumLateralSpec::load_watched(manifest_indicator); BirdMediumCenterSpec::load_watched(manifest_indicator);
let bird_medium_lateral_spec =
BirdMediumLateralSpec::load_watched(manifest_indicator);
[ [
Some( Some(bird_medium_center_spec.mesh_head(
bird_medium_center_spec body.species,
.mesh_head(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
Some( )),
bird_medium_center_spec Some(bird_medium_center_spec.mesh_torso(
.mesh_torso(body.species, body.body_type, generate_mesh), body.species,
), body.body_type,
Some( generate_mesh,
bird_medium_center_spec )),
.mesh_tail(body.species, body.body_type, generate_mesh), Some(bird_medium_center_spec.mesh_tail(
), body.species,
Some( body.body_type,
bird_medium_lateral_spec generate_mesh,
.mesh_wing_l(body.species, body.body_type, generate_mesh), )),
), Some(bird_medium_lateral_spec.mesh_wing_l(
Some( body.species,
bird_medium_lateral_spec body.body_type,
.mesh_wing_r(body.species, body.body_type, generate_mesh), generate_mesh,
), )),
Some( Some(bird_medium_lateral_spec.mesh_wing_r(
bird_medium_lateral_spec body.species,
.mesh_foot_l(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
Some( )),
bird_medium_lateral_spec Some(bird_medium_lateral_spec.mesh_foot_l(
.mesh_foot_r(body.species, body.body_type, generate_mesh), body.species,
), body.body_type,
generate_mesh,
)),
Some(bird_medium_lateral_spec.mesh_foot_r(
body.species,
body.body_type,
generate_mesh,
)),
None, None,
None, None,
None, None,
@ -441,54 +465,67 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
None, None,
], ],
Body::BipedLarge(body) => { Body::BipedLarge(body) => {
let biped_large_center_spec = BipedLargeCenterSpec::load_watched(manifest_indicator); let biped_large_center_spec =
let biped_large_lateral_spec = BipedLargeLateralSpec::load_watched(manifest_indicator); BipedLargeCenterSpec::load_watched(manifest_indicator);
let biped_large_lateral_spec =
BipedLargeLateralSpec::load_watched(manifest_indicator);
[ [
Some( Some(biped_large_center_spec.mesh_head(
biped_large_center_spec body.species,
.mesh_head(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
Some( )),
biped_large_center_spec Some(biped_large_center_spec.mesh_torso_upper(
.mesh_torso_upper(body.species, body.body_type, generate_mesh), body.species,
), body.body_type,
Some( generate_mesh,
biped_large_center_spec )),
.mesh_torso_lower(body.species, body.body_type, generate_mesh), Some(biped_large_center_spec.mesh_torso_lower(
), body.species,
Some( body.body_type,
biped_large_lateral_spec generate_mesh,
.mesh_shoulder_l(body.species, body.body_type, generate_mesh), )),
), Some(biped_large_lateral_spec.mesh_shoulder_l(
Some( body.species,
biped_large_lateral_spec body.body_type,
.mesh_shoulder_r(body.species, body.body_type, generate_mesh), generate_mesh,
), )),
Some( Some(biped_large_lateral_spec.mesh_shoulder_r(
biped_large_lateral_spec body.species,
.mesh_hand_l(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
Some( )),
biped_large_lateral_spec Some(biped_large_lateral_spec.mesh_hand_l(
.mesh_hand_r(body.species, body.body_type, generate_mesh), body.species,
), body.body_type,
Some( generate_mesh,
biped_large_lateral_spec )),
.mesh_leg_l(body.species, body.body_type, generate_mesh), Some(biped_large_lateral_spec.mesh_hand_r(
), body.species,
Some( body.body_type,
biped_large_lateral_spec generate_mesh,
.mesh_leg_r(body.species, body.body_type, generate_mesh), )),
), Some(biped_large_lateral_spec.mesh_leg_l(
Some( body.species,
biped_large_lateral_spec body.body_type,
.mesh_foot_l(body.species, body.body_type, generate_mesh), generate_mesh,
), )),
Some( Some(biped_large_lateral_spec.mesh_leg_r(
biped_large_lateral_spec body.species,
.mesh_foot_r(body.species, body.body_type, generate_mesh), body.body_type,
), generate_mesh,
)),
Some(biped_large_lateral_spec.mesh_foot_l(
body.species,
body.body_type,
generate_mesh,
)),
Some(biped_large_lateral_spec.mesh_foot_r(
body.species,
body.body_type,
generate_mesh,
)),
None, None,
None, None,
None, None,
@ -497,28 +534,34 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
] ]
}, },
Body::Critter(body) => { Body::Critter(body) => {
let critter_center_spec = let critter_center_spec = CritterCenterSpec::load_watched(manifest_indicator);
CritterCenterSpec::load_watched(manifest_indicator);
[ [
Some( Some(critter_center_spec.mesh_head(
critter_center_spec.mesh_head(body.species, body.body_type, generate_mesh), body.species,
), body.body_type,
Some( generate_mesh,
critter_center_spec )),
.mesh_chest(body.species, body.body_type, generate_mesh), Some(critter_center_spec.mesh_chest(
), body.species,
Some( body.body_type,
critter_center_spec generate_mesh,
.mesh_feet_f(body.species, body.body_type, generate_mesh), )),
), Some(critter_center_spec.mesh_feet_f(
Some( body.species,
critter_center_spec body.body_type,
.mesh_feet_b(body.species, body.body_type, generate_mesh), generate_mesh,
), )),
Some( Some(critter_center_spec.mesh_feet_b(
critter_center_spec.mesh_tail(body.species, body.body_type, generate_mesh), body.species,
), body.body_type,
generate_mesh,
)),
Some(critter_center_spec.mesh_tail(
body.species,
body.body_type,
generate_mesh,
)),
None, None,
None, None,
None, None,
@ -593,35 +636,66 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
let manifest_indicator = &mut self.manifest_indicator; let manifest_indicator = &mut self.manifest_indicator;
let mut make_model = |generate_mesh| { let mut make_model = |generate_mesh| {
let mut mesh = Mesh::new(); let mut mesh = Mesh::new();
Self::bone_meshes(body, loadout, character_state, camera_mode, manifest_indicator, generate_mesh) Self::bone_meshes(
.iter() body,
.enumerate() loadout,
.filter_map(|(i, bm)| bm.as_ref().map(|bm| (i, bm))) character_state,
.for_each(|(i, bone_mesh)| { camera_mode,
mesh.push_mesh_map(bone_mesh, |vert| vert.with_bone_idx(i as u8)) manifest_indicator,
}); generate_mesh,
)
.iter()
.enumerate()
.filter_map(|(i, bm)| bm.as_ref().map(|bm| (i, bm)))
.for_each(|(i, bone_mesh)| {
mesh.push_mesh_map(bone_mesh, |vert| vert.with_bone_idx(i as u8))
});
renderer.create_model(&mesh).unwrap() renderer.create_model(&mesh).unwrap()
}; };
fn generate_mesh(segment: &Segment, offset: Vec3<f32>) -> Mesh<FigurePipeline> { fn generate_mesh(
Meshable::<FigurePipeline, FigurePipeline>::generate_mesh(segment, (offset, Vec3::one())).0 segment: &Segment,
offset: Vec3<f32>,
) -> Mesh<FigurePipeline> {
Meshable::<FigurePipeline, FigurePipeline>::generate_mesh(
segment,
(offset, Vec3::one()),
)
.0
} }
fn generate_mesh_lod_mid(segment: &Segment, offset: Vec3<f32>) -> Mesh<FigurePipeline> { fn generate_mesh_lod_mid(
segment: &Segment,
offset: Vec3<f32>,
) -> Mesh<FigurePipeline> {
let lod_scale = Vec3::broadcast(0.6); let lod_scale = Vec3::broadcast(0.6);
Meshable::<FigurePipeline, FigurePipeline>::generate_mesh(&segment.scaled_by(lod_scale), (offset * lod_scale, Vec3::one() / lod_scale)).0 Meshable::<FigurePipeline, FigurePipeline>::generate_mesh(
&segment.scaled_by(lod_scale),
(offset * lod_scale, Vec3::one() / lod_scale),
)
.0
} }
fn generate_mesh_lod_low(segment: &Segment, offset: Vec3<f32>) -> Mesh<FigurePipeline> { fn generate_mesh_lod_low(
segment: &Segment,
offset: Vec3<f32>,
) -> Mesh<FigurePipeline> {
let lod_scale = Vec3::broadcast(0.3); let lod_scale = Vec3::broadcast(0.3);
Meshable::<FigurePipeline, FigurePipeline>::generate_mesh(&segment.scaled_by(lod_scale), (offset * lod_scale, Vec3::one() / lod_scale)).0 Meshable::<FigurePipeline, FigurePipeline>::generate_mesh(
&segment.scaled_by(lod_scale),
(offset * lod_scale, Vec3::one() / lod_scale),
)
.0
} }
([ (
make_model(generate_mesh), [
make_model(generate_mesh_lod_mid), make_model(generate_mesh),
make_model(generate_mesh_lod_low), make_model(generate_mesh_lod_mid),
], skeleton_attr) make_model(generate_mesh_lod_low),
],
skeleton_attr,
)
}, },
tick, tick,
)) ))

View File

@ -51,7 +51,11 @@ fn graceful_load_mat_segment_flipped(mesh_name: &str) -> MatSegment {
MatSegment::from_vox(graceful_load_vox(mesh_name).as_ref(), true) MatSegment::from_vox(graceful_load_vox(mesh_name).as_ref(), true)
} }
pub fn load_mesh(mesh_name: &str, position: Vec3<f32>, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn load_mesh(
mesh_name: &str,
position: Vec3<f32>,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
generate_mesh(&load_segment(mesh_name), position) generate_mesh(&load_segment(mesh_name), position)
} }
@ -343,7 +347,13 @@ impl HumArmorShoulderSpec {
.unwrap() .unwrap()
} }
fn mesh_shoulder(&self, body: &Body, loadout: &Loadout, flipped: bool, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { fn mesh_shoulder(
&self,
body: &Body,
loadout: &Loadout,
flipped: bool,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = if let Some(ItemKind::Armor { let spec = if let Some(ItemKind::Armor {
kind: Armor::Shoulder(shoulder), kind: Armor::Shoulder(shoulder),
.. ..
@ -385,11 +395,21 @@ impl HumArmorShoulderSpec {
generate_mesh(&shoulder_segment, Vec3::from(offset)) generate_mesh(&shoulder_segment, Vec3::from(offset))
} }
pub fn mesh_left_shoulder(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_left_shoulder(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
self.mesh_shoulder(body, loadout, true, generate_mesh) self.mesh_shoulder(body, loadout, true, generate_mesh)
} }
pub fn mesh_right_shoulder(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_right_shoulder(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
self.mesh_shoulder(body, loadout, false, generate_mesh) self.mesh_shoulder(body, loadout, false, generate_mesh)
} }
} }
@ -400,7 +420,12 @@ impl HumArmorChestSpec {
.unwrap() .unwrap()
} }
pub fn mesh_chest(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_chest(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = if let Some(ItemKind::Armor { let spec = if let Some(ItemKind::Armor {
kind: Armor::Chest(chest), kind: Armor::Chest(chest),
.. ..
@ -451,7 +476,13 @@ impl HumArmorHandSpec {
.unwrap() .unwrap()
} }
fn mesh_hand(&self, body: &Body, loadout: &Loadout, flipped: bool, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { fn mesh_hand(
&self,
body: &Body,
loadout: &Loadout,
flipped: bool,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = if let Some(ItemKind::Armor { let spec = if let Some(ItemKind::Armor {
kind: Armor::Hand(hand), kind: Armor::Hand(hand),
.. ..
@ -488,11 +519,21 @@ impl HumArmorHandSpec {
generate_mesh(&hand_segment, Vec3::from(offset)) generate_mesh(&hand_segment, Vec3::from(offset))
} }
pub fn mesh_left_hand(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_left_hand(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
self.mesh_hand(body, loadout, true, generate_mesh) self.mesh_hand(body, loadout, true, generate_mesh)
} }
pub fn mesh_right_hand(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_right_hand(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
self.mesh_hand(body, loadout, false, generate_mesh) self.mesh_hand(body, loadout, false, generate_mesh)
} }
} }
@ -503,7 +544,12 @@ impl HumArmorBeltSpec {
.unwrap() .unwrap()
} }
pub fn mesh_belt(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_belt(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = if let Some(ItemKind::Armor { let spec = if let Some(ItemKind::Armor {
kind: Armor::Belt(belt), kind: Armor::Belt(belt),
.. ..
@ -537,7 +583,12 @@ impl HumArmorBackSpec {
.unwrap() .unwrap()
} }
pub fn mesh_back(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_back(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = if let Some(ItemKind::Armor { let spec = if let Some(ItemKind::Armor {
kind: Armor::Back(back), kind: Armor::Back(back),
.. ..
@ -571,7 +622,12 @@ impl HumArmorPantsSpec {
.unwrap() .unwrap()
} }
pub fn mesh_pants(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_pants(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = if let Some(ItemKind::Armor { let spec = if let Some(ItemKind::Armor {
kind: Armor::Pants(pants), kind: Armor::Pants(pants),
.. ..
@ -622,7 +678,13 @@ impl HumArmorFootSpec {
.unwrap() .unwrap()
} }
fn mesh_foot(&self, body: &Body, loadout: &Loadout, flipped: bool, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { fn mesh_foot(
&self,
body: &Body,
loadout: &Loadout,
flipped: bool,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = if let Some(ItemKind::Armor { let spec = if let Some(ItemKind::Armor {
kind: Armor::Foot(foot), kind: Armor::Foot(foot),
.. ..
@ -653,11 +715,21 @@ impl HumArmorFootSpec {
generate_mesh(&foot_segment, Vec3::from(spec.vox_spec.1)) generate_mesh(&foot_segment, Vec3::from(spec.vox_spec.1))
} }
pub fn mesh_left_foot(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_left_foot(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
self.mesh_foot(body, loadout, true, generate_mesh) self.mesh_foot(body, loadout, true, generate_mesh)
} }
pub fn mesh_right_foot(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_right_foot(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
self.mesh_foot(body, loadout, false, generate_mesh) self.mesh_foot(body, loadout, false, generate_mesh)
} }
} }
@ -668,7 +740,11 @@ impl HumMainWeaponSpec {
.unwrap() .unwrap()
} }
pub fn mesh_main_weapon(&self, item_kind: Option<&ItemKind>, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_main_weapon(
&self,
item_kind: Option<&ItemKind>,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let tool_kind = if let Some(ItemKind::Tool(Tool { kind, .. })) = item_kind { let tool_kind = if let Some(ItemKind::Tool(Tool { kind, .. })) = item_kind {
kind kind
} else { } else {
@ -693,7 +769,12 @@ impl HumArmorLanternSpec {
assets::load_watched::<Self>("voxygen.voxel.humanoid_lantern_manifest", indicator).unwrap() assets::load_watched::<Self>("voxygen.voxel.humanoid_lantern_manifest", indicator).unwrap()
} }
pub fn mesh_lantern(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_lantern(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = let spec =
if let Some(ItemKind::Lantern(lantern)) = loadout.lantern.as_ref().map(|i| &i.kind) { if let Some(ItemKind::Lantern(lantern)) = loadout.lantern.as_ref().map(|i| &i.kind) {
match self.0.map.get(&lantern) { match self.0.map.get(&lantern) {
@ -723,7 +804,12 @@ impl HumArmorHeadSpec {
.unwrap() .unwrap()
} }
pub fn mesh_head(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_head(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = if let Some(ItemKind::Armor { let spec = if let Some(ItemKind::Armor {
kind: Armor::Head(head), kind: Armor::Head(head),
.. ..
@ -773,7 +859,12 @@ impl HumArmorTabardSpec {
.unwrap() .unwrap()
} }
pub fn mesh_tabard(&self, body: &Body, loadout: &Loadout, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_tabard(
&self,
body: &Body,
loadout: &Loadout,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = if let Some(ItemKind::Armor { let spec = if let Some(ItemKind::Armor {
kind: Armor::Tabard(tabard), kind: Armor::Tabard(tabard),
.. ..
@ -818,8 +909,14 @@ impl HumArmorTabardSpec {
} }
} }
// TODO: Inventory // TODO: Inventory
pub fn mesh_glider(generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_glider(
load_mesh("object.glider", Vec3::new(-26.0, -26.0, -5.0), generate_mesh) generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh(
"object.glider",
Vec3::new(-26.0, -26.0, -5.0),
generate_mesh,
)
} }
///////// /////////
@ -875,7 +972,12 @@ impl QuadrupedSmallCentralSpec {
.unwrap() .unwrap()
} }
pub fn mesh_head(&self, species: QSSpecies, body_type: QSBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_head(
&self,
species: QSSpecies,
body_type: QSBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -891,7 +993,12 @@ impl QuadrupedSmallCentralSpec {
generate_mesh(&central, Vec3::from(spec.head.offset)) generate_mesh(&central, Vec3::from(spec.head.offset))
} }
pub fn mesh_chest(&self, species: QSSpecies, body_type: QSBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_chest(
&self,
species: QSSpecies,
body_type: QSBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -914,7 +1021,12 @@ impl QuadrupedSmallLateralSpec {
.unwrap() .unwrap()
} }
pub fn mesh_foot_lf(&self, species: QSSpecies, body_type: QSBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_lf(
&self,
species: QSSpecies,
body_type: QSBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -930,7 +1042,12 @@ impl QuadrupedSmallLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.left_front.offset)) generate_mesh(&lateral, Vec3::from(spec.left_front.offset))
} }
pub fn mesh_foot_rf(&self, species: QSSpecies, body_type: QSBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_rf(
&self,
species: QSSpecies,
body_type: QSBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -946,7 +1063,12 @@ impl QuadrupedSmallLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.right_front.offset)) generate_mesh(&lateral, Vec3::from(spec.right_front.offset))
} }
pub fn mesh_foot_lb(&self, species: QSSpecies, body_type: QSBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_lb(
&self,
species: QSSpecies,
body_type: QSBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -962,7 +1084,12 @@ impl QuadrupedSmallLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.left_back.offset)) generate_mesh(&lateral, Vec3::from(spec.left_back.offset))
} }
pub fn mesh_foot_rb(&self, species: QSSpecies, body_type: QSBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_rb(
&self,
species: QSSpecies,
body_type: QSBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1078,7 +1205,12 @@ impl QuadrupedMediumCentralSpec {
generate_mesh(&central, Vec3::from(spec.lower.offset)) generate_mesh(&central, Vec3::from(spec.lower.offset))
} }
pub fn mesh_jaw(&self, species: QMSpecies, body_type: QMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_jaw(
&self,
species: QMSpecies,
body_type: QMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1094,7 +1226,12 @@ impl QuadrupedMediumCentralSpec {
generate_mesh(&central, Vec3::from(spec.jaw.offset)) generate_mesh(&central, Vec3::from(spec.jaw.offset))
} }
pub fn mesh_ears(&self, species: QMSpecies, body_type: QMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_ears(
&self,
species: QMSpecies,
body_type: QMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1110,7 +1247,12 @@ impl QuadrupedMediumCentralSpec {
generate_mesh(&central, Vec3::from(spec.ears.offset)) generate_mesh(&central, Vec3::from(spec.ears.offset))
} }
pub fn mesh_torso_f(&self, species: QMSpecies, body_type: QMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_torso_f(
&self,
species: QMSpecies,
body_type: QMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1126,7 +1268,12 @@ impl QuadrupedMediumCentralSpec {
generate_mesh(&central, Vec3::from(spec.torso_f.offset)) generate_mesh(&central, Vec3::from(spec.torso_f.offset))
} }
pub fn mesh_torso_b(&self, species: QMSpecies, body_type: QMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_torso_b(
&self,
species: QMSpecies,
body_type: QMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1142,7 +1289,12 @@ impl QuadrupedMediumCentralSpec {
generate_mesh(&central, Vec3::from(spec.torso_b.offset)) generate_mesh(&central, Vec3::from(spec.torso_b.offset))
} }
pub fn mesh_tail(&self, species: QMSpecies, body_type: QMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_tail(
&self,
species: QMSpecies,
body_type: QMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1165,7 +1317,12 @@ impl QuadrupedMediumLateralSpec {
.unwrap() .unwrap()
} }
pub fn mesh_foot_lf(&self, species: QMSpecies, body_type: QMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_lf(
&self,
species: QMSpecies,
body_type: QMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1181,7 +1338,12 @@ impl QuadrupedMediumLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.left_front.offset)) generate_mesh(&lateral, Vec3::from(spec.left_front.offset))
} }
pub fn mesh_foot_rf(&self, species: QMSpecies, body_type: QMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_rf(
&self,
species: QMSpecies,
body_type: QMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1197,7 +1359,12 @@ impl QuadrupedMediumLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.right_front.offset)) generate_mesh(&lateral, Vec3::from(spec.right_front.offset))
} }
pub fn mesh_foot_lb(&self, species: QMSpecies, body_type: QMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_lb(
&self,
species: QMSpecies,
body_type: QMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1213,7 +1380,12 @@ impl QuadrupedMediumLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.left_back.offset)) generate_mesh(&lateral, Vec3::from(spec.left_back.offset))
} }
pub fn mesh_foot_rb(&self, species: QMSpecies, body_type: QMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_rb(
&self,
species: QMSpecies,
body_type: QMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1284,7 +1456,12 @@ impl BirdMediumCenterSpec {
.unwrap() .unwrap()
} }
pub fn mesh_head(&self, species: BMSpecies, body_type: BMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_head(
&self,
species: BMSpecies,
body_type: BMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1300,7 +1477,12 @@ impl BirdMediumCenterSpec {
generate_mesh(&center, Vec3::from(spec.head.offset)) generate_mesh(&center, Vec3::from(spec.head.offset))
} }
pub fn mesh_torso(&self, species: BMSpecies, body_type: BMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_torso(
&self,
species: BMSpecies,
body_type: BMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1316,7 +1498,12 @@ impl BirdMediumCenterSpec {
generate_mesh(&center, Vec3::from(spec.torso.offset)) generate_mesh(&center, Vec3::from(spec.torso.offset))
} }
pub fn mesh_tail(&self, species: BMSpecies, body_type: BMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_tail(
&self,
species: BMSpecies,
body_type: BMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1338,7 +1525,12 @@ impl BirdMediumLateralSpec {
.unwrap() .unwrap()
} }
pub fn mesh_wing_l(&self, species: BMSpecies, body_type: BMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_wing_l(
&self,
species: BMSpecies,
body_type: BMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1354,7 +1546,12 @@ impl BirdMediumLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.wing_l.offset)) generate_mesh(&lateral, Vec3::from(spec.wing_l.offset))
} }
pub fn mesh_wing_r(&self, species: BMSpecies, body_type: BMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_wing_r(
&self,
species: BMSpecies,
body_type: BMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1370,7 +1567,12 @@ impl BirdMediumLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.wing_r.offset)) generate_mesh(&lateral, Vec3::from(spec.wing_r.offset))
} }
pub fn mesh_foot_l(&self, species: BMSpecies, body_type: BMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_l(
&self,
species: BMSpecies,
body_type: BMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1386,7 +1588,12 @@ impl BirdMediumLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.foot_l.offset)) generate_mesh(&lateral, Vec3::from(spec.foot_l.offset))
} }
pub fn mesh_foot_r(&self, species: BMSpecies, body_type: BMBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_r(
&self,
species: BMSpecies,
body_type: BMBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1433,7 +1640,12 @@ impl CritterCenterSpec {
assets::load_watched::<Self>("voxygen.voxel.critter_center_manifest", indicator).unwrap() assets::load_watched::<Self>("voxygen.voxel.critter_center_manifest", indicator).unwrap()
} }
pub fn mesh_head(&self, species: CSpecies, body_type: CBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_head(
&self,
species: CSpecies,
body_type: CBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1449,7 +1661,12 @@ impl CritterCenterSpec {
generate_mesh(&center, Vec3::from(spec.head.offset)) generate_mesh(&center, Vec3::from(spec.head.offset))
} }
pub fn mesh_chest(&self, species: CSpecies, body_type: CBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_chest(
&self,
species: CSpecies,
body_type: CBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1465,7 +1682,12 @@ impl CritterCenterSpec {
generate_mesh(&center, Vec3::from(spec.chest.offset)) generate_mesh(&center, Vec3::from(spec.chest.offset))
} }
pub fn mesh_feet_f(&self, species: CSpecies, body_type: CBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_feet_f(
&self,
species: CSpecies,
body_type: CBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1481,7 +1703,12 @@ impl CritterCenterSpec {
generate_mesh(&center, Vec3::from(spec.feet_f.offset)) generate_mesh(&center, Vec3::from(spec.feet_f.offset))
} }
pub fn mesh_feet_b(&self, species: CSpecies, body_type: CBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_feet_b(
&self,
species: CSpecies,
body_type: CBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1497,7 +1724,12 @@ impl CritterCenterSpec {
generate_mesh(&center, Vec3::from(spec.feet_b.offset)) generate_mesh(&center, Vec3::from(spec.feet_b.offset))
} }
pub fn mesh_tail(&self, species: CSpecies, body_type: CBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_tail(
&self,
species: CSpecies,
body_type: CBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1514,7 +1746,10 @@ impl CritterCenterSpec {
} }
} }
//// ////
pub fn mesh_fish_medium_head(head: fish_medium::Head, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_fish_medium_head(
head: fish_medium::Head,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match head { match head {
fish_medium::Head::Default => "npc.marlin.head", fish_medium::Head::Default => "npc.marlin.head",
@ -1524,7 +1759,10 @@ pub fn mesh_fish_medium_head(head: fish_medium::Head, generate_mesh: impl FnOnce
) )
} }
pub fn mesh_fish_medium_torso(torso: fish_medium::Torso, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_fish_medium_torso(
torso: fish_medium::Torso,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match torso { match torso {
fish_medium::Torso::Default => "npc.marlin.torso", fish_medium::Torso::Default => "npc.marlin.torso",
@ -1534,7 +1772,10 @@ pub fn mesh_fish_medium_torso(torso: fish_medium::Torso, generate_mesh: impl FnO
) )
} }
pub fn mesh_fish_medium_rear(rear: fish_medium::Rear, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_fish_medium_rear(
rear: fish_medium::Rear,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match rear { match rear {
fish_medium::Rear::Default => "npc.marlin.rear", fish_medium::Rear::Default => "npc.marlin.rear",
@ -1544,7 +1785,10 @@ pub fn mesh_fish_medium_rear(rear: fish_medium::Rear, generate_mesh: impl FnOnce
) )
} }
pub fn mesh_fish_medium_tail(tail: fish_medium::Tail, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_fish_medium_tail(
tail: fish_medium::Tail,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match tail { match tail {
fish_medium::Tail::Default => "npc.marlin.tail", fish_medium::Tail::Default => "npc.marlin.tail",
@ -1554,7 +1798,10 @@ pub fn mesh_fish_medium_tail(tail: fish_medium::Tail, generate_mesh: impl FnOnce
) )
} }
pub fn mesh_fish_medium_fin_l(fin_l: fish_medium::FinL, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_fish_medium_fin_l(
fin_l: fish_medium::FinL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match fin_l { match fin_l {
fish_medium::FinL::Default => "npc.marlin.fin_l", fish_medium::FinL::Default => "npc.marlin.fin_l",
@ -1564,7 +1811,10 @@ pub fn mesh_fish_medium_fin_l(fin_l: fish_medium::FinL, generate_mesh: impl FnOn
) )
} }
pub fn mesh_fish_medium_fin_r(fin_r: fish_medium::FinR, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_fish_medium_fin_r(
fin_r: fish_medium::FinR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match fin_r { match fin_r {
fish_medium::FinR::Default => "npc.marlin.fin_r", fish_medium::FinR::Default => "npc.marlin.fin_r",
@ -1574,7 +1824,10 @@ pub fn mesh_fish_medium_fin_r(fin_r: fish_medium::FinR, generate_mesh: impl FnOn
) )
} }
pub fn mesh_dragon_head(head: dragon::Head, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_head(
head: dragon::Head,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match head { match head {
dragon::Head::Default => "npc.dragon.head", dragon::Head::Default => "npc.dragon.head",
@ -1584,7 +1837,10 @@ pub fn mesh_dragon_head(head: dragon::Head, generate_mesh: impl FnOnce(&Segment,
) )
} }
pub fn mesh_dragon_chest_front(chest_front: dragon::ChestFront, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_chest_front(
chest_front: dragon::ChestFront,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match chest_front { match chest_front {
dragon::ChestFront::Default => "npc.dragon.chest_front", dragon::ChestFront::Default => "npc.dragon.chest_front",
@ -1594,7 +1850,10 @@ pub fn mesh_dragon_chest_front(chest_front: dragon::ChestFront, generate_mesh: i
) )
} }
pub fn mesh_dragon_chest_rear(chest_rear: dragon::ChestRear, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_chest_rear(
chest_rear: dragon::ChestRear,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match chest_rear { match chest_rear {
dragon::ChestRear::Default => "npc.dragon.chest_rear", dragon::ChestRear::Default => "npc.dragon.chest_rear",
@ -1604,7 +1863,10 @@ pub fn mesh_dragon_chest_rear(chest_rear: dragon::ChestRear, generate_mesh: impl
) )
} }
pub fn mesh_dragon_tail_front(tail_front: dragon::TailFront, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_tail_front(
tail_front: dragon::TailFront,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match tail_front { match tail_front {
dragon::TailFront::Default => "npc.dragon.tail_front", dragon::TailFront::Default => "npc.dragon.tail_front",
@ -1614,7 +1876,10 @@ pub fn mesh_dragon_tail_front(tail_front: dragon::TailFront, generate_mesh: impl
) )
} }
pub fn mesh_dragon_tail_rear(tail_rear: dragon::TailRear, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_tail_rear(
tail_rear: dragon::TailRear,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match tail_rear { match tail_rear {
dragon::TailRear::Default => "npc.dragon.tail_rear", dragon::TailRear::Default => "npc.dragon.tail_rear",
@ -1624,7 +1889,10 @@ pub fn mesh_dragon_tail_rear(tail_rear: dragon::TailRear, generate_mesh: impl Fn
) )
} }
pub fn mesh_dragon_wing_in_l(wing_in_l: dragon::WingInL, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_wing_in_l(
wing_in_l: dragon::WingInL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match wing_in_l { match wing_in_l {
dragon::WingInL::Default => "npc.dragon.wing_in_l", dragon::WingInL::Default => "npc.dragon.wing_in_l",
@ -1634,7 +1902,10 @@ pub fn mesh_dragon_wing_in_l(wing_in_l: dragon::WingInL, generate_mesh: impl FnO
) )
} }
pub fn mesh_dragon_wing_in_r(wing_in_r: dragon::WingInR, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_wing_in_r(
wing_in_r: dragon::WingInR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match wing_in_r { match wing_in_r {
dragon::WingInR::Default => "npc.dragon.wing_in_r", dragon::WingInR::Default => "npc.dragon.wing_in_r",
@ -1644,7 +1915,10 @@ pub fn mesh_dragon_wing_in_r(wing_in_r: dragon::WingInR, generate_mesh: impl FnO
) )
} }
pub fn mesh_dragon_wing_out_l(wing_out_l: dragon::WingOutL, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_wing_out_l(
wing_out_l: dragon::WingOutL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match wing_out_l { match wing_out_l {
dragon::WingOutL::Default => "npc.dragon.wing_out_l", dragon::WingOutL::Default => "npc.dragon.wing_out_l",
@ -1654,7 +1928,10 @@ pub fn mesh_dragon_wing_out_l(wing_out_l: dragon::WingOutL, generate_mesh: impl
) )
} }
pub fn mesh_dragon_wing_out_r(wing_out_r: dragon::WingOutR, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_wing_out_r(
wing_out_r: dragon::WingOutR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match wing_out_r { match wing_out_r {
dragon::WingOutR::Default => "npc.dragon.wing_out_r", dragon::WingOutR::Default => "npc.dragon.wing_out_r",
@ -1664,7 +1941,10 @@ pub fn mesh_dragon_wing_out_r(wing_out_r: dragon::WingOutR, generate_mesh: impl
) )
} }
pub fn mesh_dragon_foot_fl(foot_fl: dragon::FootFL, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_foot_fl(
foot_fl: dragon::FootFL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match foot_fl { match foot_fl {
dragon::FootFL::Default => "npc.dragon.foot_fl", dragon::FootFL::Default => "npc.dragon.foot_fl",
@ -1674,7 +1954,10 @@ pub fn mesh_dragon_foot_fl(foot_fl: dragon::FootFL, generate_mesh: impl FnOnce(&
) )
} }
pub fn mesh_dragon_foot_fr(foot_fr: dragon::FootFR, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_foot_fr(
foot_fr: dragon::FootFR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match foot_fr { match foot_fr {
dragon::FootFR::Default => "npc.dragon.foot_fr", dragon::FootFR::Default => "npc.dragon.foot_fr",
@ -1684,7 +1967,10 @@ pub fn mesh_dragon_foot_fr(foot_fr: dragon::FootFR, generate_mesh: impl FnOnce(&
) )
} }
pub fn mesh_dragon_foot_bl(foot_bl: dragon::FootBL, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_foot_bl(
foot_bl: dragon::FootBL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match foot_bl { match foot_bl {
dragon::FootBL::Default => "npc.dragon.foot_bl", dragon::FootBL::Default => "npc.dragon.foot_bl",
@ -1694,7 +1980,10 @@ pub fn mesh_dragon_foot_bl(foot_bl: dragon::FootBL, generate_mesh: impl FnOnce(&
) )
} }
pub fn mesh_dragon_foot_br(foot_br: dragon::FootBR, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_dragon_foot_br(
foot_br: dragon::FootBR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match foot_br { match foot_br {
dragon::FootBR::Default => "npc.dragon.foot_br", dragon::FootBR::Default => "npc.dragon.foot_br",
@ -1705,7 +1994,10 @@ pub fn mesh_dragon_foot_br(foot_br: dragon::FootBR, generate_mesh: impl FnOnce(&
} }
//// ////
pub fn mesh_bird_small_head(head: bird_small::Head, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_bird_small_head(
head: bird_small::Head,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match head { match head {
bird_small::Head::Default => "npc.crow.head", bird_small::Head::Default => "npc.crow.head",
@ -1715,7 +2007,10 @@ pub fn mesh_bird_small_head(head: bird_small::Head, generate_mesh: impl FnOnce(&
) )
} }
pub fn mesh_bird_small_torso(torso: bird_small::Torso, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_bird_small_torso(
torso: bird_small::Torso,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match torso { match torso {
bird_small::Torso::Default => "npc.crow.torso", bird_small::Torso::Default => "npc.crow.torso",
@ -1725,7 +2020,10 @@ pub fn mesh_bird_small_torso(torso: bird_small::Torso, generate_mesh: impl FnOnc
) )
} }
pub fn mesh_bird_small_wing_l(wing_l: bird_small::WingL, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_bird_small_wing_l(
wing_l: bird_small::WingL,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match wing_l { match wing_l {
bird_small::WingL::Default => "npc.crow.wing_l", bird_small::WingL::Default => "npc.crow.wing_l",
@ -1735,7 +2033,10 @@ pub fn mesh_bird_small_wing_l(wing_l: bird_small::WingL, generate_mesh: impl FnO
) )
} }
pub fn mesh_bird_small_wing_r(wing_r: bird_small::WingR, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_bird_small_wing_r(
wing_r: bird_small::WingR,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match wing_r { match wing_r {
bird_small::WingR::Default => "npc.crow.wing_r", bird_small::WingR::Default => "npc.crow.wing_r",
@ -1745,7 +2046,10 @@ pub fn mesh_bird_small_wing_r(wing_r: bird_small::WingR, generate_mesh: impl FnO
) )
} }
//// ////
pub fn mesh_fish_small_torso(torso: fish_small::Torso, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_fish_small_torso(
torso: fish_small::Torso,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match torso { match torso {
fish_small::Torso::Default => "npc.cardinalfish.torso", fish_small::Torso::Default => "npc.cardinalfish.torso",
@ -1755,7 +2059,10 @@ pub fn mesh_fish_small_torso(torso: fish_small::Torso, generate_mesh: impl FnOnc
) )
} }
pub fn mesh_fish_small_tail(tail: fish_small::Tail, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_fish_small_tail(
tail: fish_small::Tail,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
load_mesh( load_mesh(
match tail { match tail {
fish_small::Tail::Default => "npc.cardinalfish.tail", fish_small::Tail::Default => "npc.cardinalfish.tail",
@ -1822,7 +2129,12 @@ impl BipedLargeCenterSpec {
.unwrap() .unwrap()
} }
pub fn mesh_head(&self, species: BLSpecies, body_type: BLBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_head(
&self,
species: BLSpecies,
body_type: BLBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1928,7 +2240,12 @@ impl BipedLargeLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.shoulder_r.offset)) generate_mesh(&lateral, Vec3::from(spec.shoulder_r.offset))
} }
pub fn mesh_hand_l(&self, species: BLSpecies, body_type: BLBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_hand_l(
&self,
species: BLSpecies,
body_type: BLBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1944,7 +2261,12 @@ impl BipedLargeLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.hand_l.offset)) generate_mesh(&lateral, Vec3::from(spec.hand_l.offset))
} }
pub fn mesh_hand_r(&self, species: BLSpecies, body_type: BLBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_hand_r(
&self,
species: BLSpecies,
body_type: BLBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1960,7 +2282,12 @@ impl BipedLargeLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.hand_r.offset)) generate_mesh(&lateral, Vec3::from(spec.hand_r.offset))
} }
pub fn mesh_leg_l(&self, species: BLSpecies, body_type: BLBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_leg_l(
&self,
species: BLSpecies,
body_type: BLBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1976,7 +2303,12 @@ impl BipedLargeLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.leg_l.offset)) generate_mesh(&lateral, Vec3::from(spec.leg_l.offset))
} }
pub fn mesh_leg_r(&self, species: BLSpecies, body_type: BLBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_leg_r(
&self,
species: BLSpecies,
body_type: BLBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -1992,7 +2324,12 @@ impl BipedLargeLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.leg_r.offset)) generate_mesh(&lateral, Vec3::from(spec.leg_r.offset))
} }
pub fn mesh_foot_l(&self, species: BLSpecies, body_type: BLBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_l(
&self,
species: BLSpecies,
body_type: BLBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -2008,7 +2345,12 @@ impl BipedLargeLateralSpec {
generate_mesh(&lateral, Vec3::from(spec.foot_l.offset)) generate_mesh(&lateral, Vec3::from(spec.foot_l.offset))
} }
pub fn mesh_foot_r(&self, species: BLSpecies, body_type: BLBodyType, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_foot_r(
&self,
species: BLSpecies,
body_type: BLBodyType,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
let spec = match self.0.get(&(species, body_type)) { let spec = match self.0.get(&(species, body_type)) {
Some(spec) => spec, Some(spec) => spec,
None => { None => {
@ -2025,7 +2367,10 @@ impl BipedLargeLateralSpec {
} }
} }
//// ////
pub fn mesh_object(obj: object::Body, generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>) -> Mesh<FigurePipeline> { pub fn mesh_object(
obj: object::Body,
generate_mesh: impl FnOnce(&Segment, Vec3<f32>) -> Mesh<FigurePipeline>,
) -> Mesh<FigurePipeline> {
use object::Body; use object::Body;
let (name, offset) = match obj { let (name, offset) = match obj {

View File

@ -117,19 +117,22 @@ impl FigureMgr {
.get(scene_data.player_entity) .get(scene_data.player_entity)
.map_or(Vec3::zero(), |pos| pos.0); .map_or(Vec3::zero(), |pos| pos.0);
for (i, ( for (
entity, i,
pos, (
interpolated, entity,
vel, pos,
scale, interpolated,
body, vel,
character, scale,
last_character, body,
physics, character,
stats, last_character,
loadout, physics,
)) in ( stats,
loadout,
),
) in (
&ecs.entities(), &ecs.entities(),
&ecs.read_storage::<Pos>(), &ecs.read_storage::<Pos>(),
ecs.read_storage::<Interpolated>().maybe(), ecs.read_storage::<Interpolated>().maybe(),
@ -145,15 +148,21 @@ impl FigureMgr {
.join() .join()
.enumerate() .enumerate()
{ {
// Maintaining figure data and sending new figure data to the GPU turns out to be a // Maintaining figure data and sending new figure data to the GPU turns out to
// very expensive operation. We want to avoid doing it as much as possible, so we // be a very expensive operation. We want to avoid doing it as much
// make the assumption that players don't care so much about the update *rate* for far // as possible, so we make the assumption that players don't care so
// away things. As the entity goes further and further away, we start to 'skip' update // much about the update *rate* for far away things. As the entity
// ticks. // goes further and further away, we start to 'skip' update ticks.
// TODO: Investigate passing the velocity into the shader so we can at least // TODO: Investigate passing the velocity into the shader so we can at least
// interpolate motion // interpolate motion
const MIN_PERFECT_RATE_DIST: f32 = 96.0; const MIN_PERFECT_RATE_DIST: f32 = 50.0;
if (i as u64 + tick) % 1 + ((pos.0.distance(camera.get_focus_pos()).powf(0.5) - MIN_PERFECT_RATE_DIST.powf(0.5)).max(0.0) / 5.0) as u64 != 0 { if (i as u64 + tick) % (1
+ ((pos.0.distance_squared(camera.get_focus_pos()).powf(0.25)
- MIN_PERFECT_RATE_DIST.powf(0.5))
.max(0.0)
/ 3.0) as u64)
!= 0
{
continue; continue;
} }
@ -1708,7 +1717,9 @@ impl FigureMgr {
const FIGURE_LOD_LOW_DIST: f32 = 150.0; const FIGURE_LOD_LOW_DIST: f32 = 150.0;
const FIGURE_LOD_MID_DIST: f32 = 70.0; const FIGURE_LOD_MID_DIST: f32 = 70.0;
let model = if pos.distance_squared(camera.get_focus_pos()) > FIGURE_LOD_LOW_DIST.powf(2.0) { let model = if pos.distance_squared(camera.get_focus_pos())
> FIGURE_LOD_LOW_DIST.powf(2.0)
{
&model[2] &model[2]
} else if pos.distance_squared(camera.get_focus_pos()) > FIGURE_LOD_MID_DIST.powf(2.0) { } else if pos.distance_squared(camera.get_focus_pos()) > FIGURE_LOD_MID_DIST.powf(2.0) {
&model[1] &model[1]

View File

@ -4,23 +4,22 @@ use crate::{
fixture::FixtureSkeleton, fixture::FixtureSkeleton,
Animation, Skeleton, Animation, Skeleton,
}, },
mesh::Meshable,
render::{ render::{
create_pp_mesh, create_skybox_mesh, Consts, FigurePipeline, Globals, Light, Model, create_pp_mesh, create_skybox_mesh, Consts, FigurePipeline, Globals, Light, Mesh, Model,
PostProcessLocals, PostProcessPipeline, Renderer, Shadow, SkyboxLocals, SkyboxPipeline, PostProcessLocals, PostProcessPipeline, Renderer, Shadow, SkyboxLocals, SkyboxPipeline,
Mesh,
}, },
scene::{ scene::{
camera::{self, Camera, CameraMode}, camera::{self, Camera, CameraMode},
figure::{load_mesh, FigureModelCache, FigureState}, figure::{load_mesh, FigureModelCache, FigureState},
}, },
window::{Event, PressState}, window::{Event, PressState},
mesh::Meshable,
}; };
use common::{ use common::{
comp::{humanoid, Body, Loadout}, comp::{humanoid, Body, Loadout},
figure::Segment,
terrain::BlockKind, terrain::BlockKind,
vol::{BaseVol, ReadVol, Vox}, vol::{BaseVol, ReadVol, Vox},
figure::Segment,
}; };
use log::error; use log::error;
use vek::*; use vek::*;
@ -114,7 +113,11 @@ impl Scene {
backdrop: backdrop.map(|specifier| { backdrop: backdrop.map(|specifier| {
( (
renderer renderer
.create_model(&load_mesh(specifier, Vec3::new(-55.0, -49.5, -2.0), generate_mesh)) .create_model(&load_mesh(
specifier,
Vec3::new(-55.0, -49.5, -2.0),
generate_mesh,
))
.unwrap(), .unwrap(),
FigureState::new(renderer, FixtureSkeleton::new()), FigureState::new(renderer, FixtureSkeleton::new()),
) )