mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Creature viewpoint
This commit is contained in:
parent
ba62cc853e
commit
54bad4b205
@ -108,6 +108,7 @@ impl Skeleton for ArthropodSkeleton {
|
|||||||
|
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((head_mat * Vec4::new(0.0, 7.0, 0.0, 1.0)).xyz()),
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: mount_position,
|
position: mount_position,
|
||||||
orientation: mount_orientation,
|
orientation: mount_orientation,
|
||||||
|
@ -104,9 +104,11 @@ impl Skeleton for BipedLargeSkeleton {
|
|||||||
let head_mat = upper_torso_mat * Mat4::<f32>::from(self.head);
|
let head_mat = upper_torso_mat * Mat4::<f32>::from(self.head);
|
||||||
let hand_l_mat = Mat4::<f32>::from(self.hand_l);
|
let hand_l_mat = Mat4::<f32>::from(self.hand_l);
|
||||||
|
|
||||||
|
let jaw_mat = head_mat * Mat4::<f32>::from(self.jaw);
|
||||||
|
|
||||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||||
make_bone(head_mat),
|
make_bone(head_mat),
|
||||||
make_bone(head_mat * Mat4::<f32>::from(self.jaw)),
|
make_bone(jaw_mat),
|
||||||
make_bone(upper_torso_mat),
|
make_bone(upper_torso_mat),
|
||||||
make_bone(lower_torso_mat),
|
make_bone(lower_torso_mat),
|
||||||
make_bone(lower_torso_mat * Mat4::<f32>::from(self.tail)),
|
make_bone(lower_torso_mat * Mat4::<f32>::from(self.tail)),
|
||||||
@ -129,6 +131,7 @@ impl Skeleton for BipedLargeSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((jaw_mat * Vec4::new(0.0, 4.0, 0.0, 1.0)).xyz()),
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::BipedLarge(body)
|
position: comp::Body::BipedLarge(body)
|
||||||
|
@ -62,8 +62,9 @@ impl Skeleton for BipedSmallSkeleton {
|
|||||||
let control_mat = chest_mat * Mat4::<f32>::from(self.control);
|
let control_mat = chest_mat * Mat4::<f32>::from(self.control);
|
||||||
let control_l_mat = Mat4::<f32>::from(self.control_l);
|
let control_l_mat = Mat4::<f32>::from(self.control_l);
|
||||||
let control_r_mat = Mat4::<f32>::from(self.control_r);
|
let control_r_mat = Mat4::<f32>::from(self.control_r);
|
||||||
|
let head_mat = chest_mat * Mat4::<f32>::from(self.head);
|
||||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||||
make_bone(chest_mat * Mat4::<f32>::from(self.head)),
|
make_bone(head_mat),
|
||||||
make_bone(chest_mat),
|
make_bone(chest_mat),
|
||||||
make_bone(pants_mat),
|
make_bone(pants_mat),
|
||||||
make_bone(pants_mat * Mat4::<f32>::from(self.tail)),
|
make_bone(pants_mat * Mat4::<f32>::from(self.tail)),
|
||||||
@ -75,6 +76,7 @@ impl Skeleton for BipedSmallSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((head_mat * Vec4::new(0.0, 0.0, 0.0, 1.0)).xyz()),
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::BipedSmall(body)
|
position: comp::Body::BipedSmall(body)
|
||||||
|
@ -98,6 +98,7 @@ impl Skeleton for BirdLargeSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((head_mat * Vec4::new(0.0, 3.0, 6.0, 1.0)).xyz()),
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::BirdLarge(body)
|
position: comp::Body::BirdLarge(body)
|
||||||
|
@ -40,9 +40,10 @@ impl Skeleton for BirdMediumSkeleton {
|
|||||||
) -> Offsets {
|
) -> Offsets {
|
||||||
let base_mat = base_mat * Mat4::scaling_3d(1.0 / 11.0);
|
let base_mat = base_mat * Mat4::scaling_3d(1.0 / 11.0);
|
||||||
let torso_mat = base_mat * Mat4::<f32>::from(self.torso);
|
let torso_mat = base_mat * Mat4::<f32>::from(self.torso);
|
||||||
|
let head_mat = torso_mat * Mat4::<f32>::from(self.head);
|
||||||
|
|
||||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||||
make_bone(torso_mat * Mat4::<f32>::from(self.head)),
|
make_bone(head_mat),
|
||||||
make_bone(torso_mat),
|
make_bone(torso_mat),
|
||||||
make_bone(torso_mat * Mat4::<f32>::from(self.tail)),
|
make_bone(torso_mat * Mat4::<f32>::from(self.tail)),
|
||||||
make_bone(torso_mat * Mat4::<f32>::from(self.wing_l)),
|
make_bone(torso_mat * Mat4::<f32>::from(self.wing_l)),
|
||||||
@ -50,8 +51,13 @@ impl Skeleton for BirdMediumSkeleton {
|
|||||||
make_bone(base_mat * Mat4::<f32>::from(self.leg_l)),
|
make_bone(base_mat * Mat4::<f32>::from(self.leg_l)),
|
||||||
make_bone(base_mat * Mat4::<f32>::from(self.leg_r)),
|
make_bone(base_mat * Mat4::<f32>::from(self.leg_r)),
|
||||||
];
|
];
|
||||||
|
use common::comp::body::bird_medium::Species::*;
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: match body.species {
|
||||||
|
Bat => Some((head_mat * Vec4::new(0.0, 5.0, -4.0, 1.0)).xyz()),
|
||||||
|
_ => Some((head_mat * Vec4::new(0.0, 3.0, 2.0, 1.0)).xyz()),
|
||||||
|
},
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::BirdMedium(body)
|
position: comp::Body::BirdMedium(body)
|
||||||
|
@ -165,6 +165,7 @@ impl Skeleton for CharacterSkeleton {
|
|||||||
let weapon_trails = self.main_weapon_trail || self.off_weapon_trail;
|
let weapon_trails = self.main_weapon_trail || self.off_weapon_trail;
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: Some((lantern_mat * Vec4::new(0.0, 0.5, -6.0, 1.0)).xyz()),
|
lantern: Some((lantern_mat * Vec4::new(0.0, 0.5, -6.0, 1.0)).xyz()),
|
||||||
|
viewpoint: Some((head_mat * Vec4::new(0.0, 0.0, 4.0, 1.0)).xyz()),
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::Humanoid(body)
|
position: comp::Body::Humanoid(body)
|
||||||
|
@ -73,6 +73,7 @@ impl Skeleton for DragonSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((head_upper_mat * Vec4::new(0.0, 8.0, 0.0, 1.0)).xyz()),
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::Dragon(body).mount_offset().into_tuple().into(),
|
position: comp::Body::Dragon(body).mount_offset().into_tuple().into(),
|
||||||
|
@ -39,11 +39,11 @@ impl Skeleton for FishMediumSkeleton {
|
|||||||
|
|
||||||
let chest_front_mat = base_mat * Mat4::<f32>::from(self.chest_front);
|
let chest_front_mat = base_mat * Mat4::<f32>::from(self.chest_front);
|
||||||
let chest_back_mat = Mat4::<f32>::from(self.chest_back);
|
let chest_back_mat = Mat4::<f32>::from(self.chest_back);
|
||||||
let head_mat = Mat4::<f32>::from(self.head);
|
let head_mat = chest_front_mat * Mat4::<f32>::from(self.head);
|
||||||
|
|
||||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||||
make_bone(chest_front_mat * head_mat),
|
make_bone(head_mat),
|
||||||
make_bone(chest_front_mat * head_mat * Mat4::<f32>::from(self.jaw)),
|
make_bone(head_mat * Mat4::<f32>::from(self.jaw)),
|
||||||
make_bone(chest_front_mat),
|
make_bone(chest_front_mat),
|
||||||
make_bone(chest_front_mat * chest_back_mat),
|
make_bone(chest_front_mat * chest_back_mat),
|
||||||
make_bone(chest_front_mat * chest_back_mat * Mat4::<f32>::from(self.tail)),
|
make_bone(chest_front_mat * chest_back_mat * Mat4::<f32>::from(self.tail)),
|
||||||
@ -52,6 +52,7 @@ impl Skeleton for FishMediumSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((head_mat * Vec4::new(0.0, 5.0, 0.0, 1.0)).xyz()),
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::FishMedium(body)
|
position: comp::Body::FishMedium(body)
|
||||||
|
@ -43,6 +43,7 @@ impl Skeleton for FishSmallSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((chest_mat * Vec4::new(0.0, 3.0, 0.0, 1.0)).xyz()),
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::FishSmall(body)
|
position: comp::Body::FishSmall(body)
|
||||||
|
@ -36,6 +36,7 @@ impl Skeleton for FixtureSkeleton {
|
|||||||
buf[0] = make_bone(base_mat);
|
buf[0] = make_bone(base_mat);
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: None,
|
||||||
mount_bone: Transform::default(),
|
mount_bone: Transform::default(),
|
||||||
primary_trail_mat: None,
|
primary_trail_mat: None,
|
||||||
secondary_trail_mat: None,
|
secondary_trail_mat: None,
|
||||||
|
@ -58,9 +58,10 @@ impl Skeleton for GolemSkeleton {
|
|||||||
let leg_r_mat = lower_torso_mat * Mat4::<f32>::from(self.leg_r);
|
let leg_r_mat = lower_torso_mat * Mat4::<f32>::from(self.leg_r);
|
||||||
let shoulder_l_mat = upper_torso_mat * Mat4::<f32>::from(self.shoulder_l);
|
let shoulder_l_mat = upper_torso_mat * Mat4::<f32>::from(self.shoulder_l);
|
||||||
let shoulder_r_mat = upper_torso_mat * Mat4::<f32>::from(self.shoulder_r);
|
let shoulder_r_mat = upper_torso_mat * Mat4::<f32>::from(self.shoulder_r);
|
||||||
|
let head_mat = upper_torso_mat * Mat4::<f32>::from(self.head);
|
||||||
|
|
||||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||||
make_bone(upper_torso_mat * Mat4::<f32>::from(self.head)),
|
make_bone(head_mat),
|
||||||
make_bone(upper_torso_mat * Mat4::<f32>::from(self.head) * Mat4::<f32>::from(self.jaw)),
|
make_bone(upper_torso_mat * Mat4::<f32>::from(self.head) * Mat4::<f32>::from(self.jaw)),
|
||||||
make_bone(upper_torso_mat),
|
make_bone(upper_torso_mat),
|
||||||
make_bone(lower_torso_mat),
|
make_bone(lower_torso_mat),
|
||||||
@ -75,6 +76,7 @@ impl Skeleton for GolemSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((head_mat * Vec4::new(0.0, 0.0, 5.0, 1.0)).xyz()),
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::Golem(body).mount_offset().into_tuple().into(),
|
position: comp::Body::Golem(body).mount_offset().into_tuple().into(),
|
||||||
|
@ -36,6 +36,7 @@ impl Skeleton for ItemDropSkeleton {
|
|||||||
[make_bone(bone0_mat)];
|
[make_bone(bone0_mat)];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: None,
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::ItemDrop(body)
|
position: comp::Body::ItemDrop(body)
|
||||||
.mount_offset()
|
.mount_offset()
|
||||||
|
@ -107,6 +107,7 @@ pub fn init() { lazy_static::initialize(&LIB); }
|
|||||||
// Offsets that will be returned after computing the skeleton matrices
|
// Offsets that will be returned after computing the skeleton matrices
|
||||||
pub struct Offsets {
|
pub struct Offsets {
|
||||||
pub lantern: Option<Vec3<f32>>,
|
pub lantern: Option<Vec3<f32>>,
|
||||||
|
pub viewpoint: Option<Vec3<f32>>,
|
||||||
pub mount_bone: Transform<f32, f32, f32>,
|
pub mount_bone: Transform<f32, f32, f32>,
|
||||||
pub primary_trail_mat: Option<(Mat4<f32>, TrailSource)>,
|
pub primary_trail_mat: Option<(Mat4<f32>, TrailSource)>,
|
||||||
pub secondary_trail_mat: Option<(Mat4<f32>, TrailSource)>,
|
pub secondary_trail_mat: Option<(Mat4<f32>, TrailSource)>,
|
||||||
|
@ -41,6 +41,7 @@ impl Skeleton for ObjectSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: None,
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::Object(body).mount_offset().into_tuple().into(),
|
position: comp::Body::Object(body).mount_offset().into_tuple().into(),
|
||||||
|
@ -95,6 +95,7 @@ impl Skeleton for QuadrupedLowSkeleton {
|
|||||||
|
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((head_upper_mat * Vec4::new(0.0, 4.0, 1.0, 1.0)).xyz()),
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: mount_position,
|
position: mount_position,
|
||||||
orientation: mount_orientation,
|
orientation: mount_orientation,
|
||||||
|
@ -105,6 +105,30 @@ impl Skeleton for QuadrupedMediumSkeleton {
|
|||||||
|
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: match body.species {
|
||||||
|
Akhlut | Catoblepas | Lion => {
|
||||||
|
Some((head_mat * Vec4::new(0.0, 8.0, 0.0, 1.0)).xyz())
|
||||||
|
},
|
||||||
|
Barghest | Saber => Some((head_mat * Vec4::new(0.0, 8.0, 3.0, 1.0)).xyz()),
|
||||||
|
Cattle | Highland | Bonerattler | Ngoubou | Yak => {
|
||||||
|
Some((head_mat * Vec4::new(0.0, 6.0, -1.0, 1.0)).xyz())
|
||||||
|
},
|
||||||
|
Antelope | Deer | Donkey | Bear | Mouflon | Panda => {
|
||||||
|
Some((head_mat * Vec4::new(0.0, 3.0, 3.0, 1.0)).xyz())
|
||||||
|
},
|
||||||
|
Camel | Hirdrasil | Horse | Kelpie | Zebra => {
|
||||||
|
Some((head_mat * Vec4::new(0.0, 2.0, 5.0, 1.0)).xyz())
|
||||||
|
},
|
||||||
|
Darkhound | Llama | Snowleopard | Tiger | Wolf => {
|
||||||
|
Some((head_mat * Vec4::new(0.0, 4.0, 1.0, 1.0)).xyz())
|
||||||
|
},
|
||||||
|
Dreadhorn | Mammoth | Moose | Tarasque => {
|
||||||
|
Some((head_mat * Vec4::new(0.0, 13.0, -3.0, 1.0)).xyz())
|
||||||
|
},
|
||||||
|
Frostfang => Some((head_mat * Vec4::new(0.0, 5.0, 3.0, 1.0)).xyz()),
|
||||||
|
Grolgar | Roshwalr => Some((head_mat * Vec4::new(0.0, 8.0, 6.0, 1.0)).xyz()),
|
||||||
|
_ => Some((head_mat * Vec4::new(0.0, 2.0, 0.0, 1.0)).xyz()),
|
||||||
|
},
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: mount_position,
|
position: mount_position,
|
||||||
orientation: mount_orientation,
|
orientation: mount_orientation,
|
||||||
|
@ -65,6 +65,7 @@ impl Skeleton for QuadrupedSmallSkeleton {
|
|||||||
|
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((head_mat * Vec4::new(0.0, 3.0, 0.0, 1.0)).xyz()),
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: mount_position,
|
position: mount_position,
|
||||||
orientation: mount_orientation,
|
orientation: mount_orientation,
|
||||||
|
@ -43,6 +43,7 @@ impl Skeleton for ShipSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: None,
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: (base_mat * scale_mat)
|
position: (base_mat * scale_mat)
|
||||||
|
@ -76,6 +76,7 @@ impl Skeleton for TheropodSkeleton {
|
|||||||
];
|
];
|
||||||
Offsets {
|
Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: Some((head_mat * Vec4::new(0.0, 2.0, 0.0, 1.0)).xyz()),
|
||||||
// TODO: see quadruped_medium for how to animate this
|
// TODO: see quadruped_medium for how to animate this
|
||||||
mount_bone: Transform {
|
mount_bone: Transform {
|
||||||
position: comp::Body::Theropod(body)
|
position: comp::Body::Theropod(body)
|
||||||
|
@ -1078,12 +1078,16 @@ make_vox_spec!(
|
|||||||
central: QuadrupedSmallCentralSpec = "voxygen.voxel.quadruped_small_central_manifest",
|
central: QuadrupedSmallCentralSpec = "voxygen.voxel.quadruped_small_central_manifest",
|
||||||
lateral: QuadrupedSmallLateralSpec = "voxygen.voxel.quadruped_small_lateral_manifest",
|
lateral: QuadrupedSmallLateralSpec = "voxygen.voxel.quadruped_small_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_chest(
|
Some(spec.central.read().0.mesh_chest(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -1282,20 +1286,28 @@ make_vox_spec!(
|
|||||||
central: QuadrupedMediumCentralSpec = "voxygen.voxel.quadruped_medium_central_manifest",
|
central: QuadrupedMediumCentralSpec = "voxygen.voxel.quadruped_medium_central_manifest",
|
||||||
lateral: QuadrupedMediumLateralSpec = "voxygen.voxel.quadruped_medium_lateral_manifest",
|
lateral: QuadrupedMediumLateralSpec = "voxygen.voxel.quadruped_medium_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.central.read().0.mesh_neck(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_neck(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.central.read().0.mesh_jaw(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_jaw(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_tail(
|
Some(spec.central.read().0.mesh_tail(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -1308,10 +1320,12 @@ make_vox_spec!(
|
|||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)),
|
||||||
Some(spec.central.read().0.mesh_ears(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_ears(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.lateral.read().0.mesh_leg_fl(
|
Some(spec.lateral.read().0.mesh_leg_fl(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -1631,12 +1645,16 @@ make_vox_spec!(
|
|||||||
central: BirdMediumCentralSpec = "voxygen.voxel.bird_medium_central_manifest",
|
central: BirdMediumCentralSpec = "voxygen.voxel.bird_medium_central_manifest",
|
||||||
lateral: BirdMediumLateralSpec = "voxygen.voxel.bird_medium_lateral_manifest",
|
lateral: BirdMediumLateralSpec = "voxygen.voxel.bird_medium_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_torso(
|
Some(spec.central.read().0.mesh_torso(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -1830,16 +1848,22 @@ make_vox_spec!(
|
|||||||
central: TheropodCentralSpec = "voxygen.voxel.theropod_central_manifest",
|
central: TheropodCentralSpec = "voxygen.voxel.theropod_central_manifest",
|
||||||
lateral: TheropodLateralSpec = "voxygen.voxel.theropod_lateral_manifest",
|
lateral: TheropodLateralSpec = "voxygen.voxel.theropod_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.central.read().0.mesh_jaw(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_jaw(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_neck(
|
Some(spec.central.read().0.mesh_neck(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -2147,24 +2171,32 @@ make_vox_spec!(
|
|||||||
central: ArthropodCentralSpec = "voxygen.voxel.arthropod_central_manifest",
|
central: ArthropodCentralSpec = "voxygen.voxel.arthropod_central_manifest",
|
||||||
lateral: ArthropodLateralSpec = "voxygen.voxel.arthropod_lateral_manifest",
|
lateral: ArthropodLateralSpec = "voxygen.voxel.arthropod_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_chest(
|
Some(spec.central.read().0.mesh_chest(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)),
|
||||||
Some(spec.lateral.read().0.mesh_mandible_l(
|
third_person.map(|_| {
|
||||||
|
spec.lateral.read().0.mesh_mandible_l(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.lateral.read().0.mesh_mandible_r(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.lateral.read().0.mesh_mandible_r(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.lateral.read().0.mesh_wing_fl(
|
Some(spec.lateral.read().0.mesh_wing_fl(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -2515,12 +2547,16 @@ make_vox_spec!(
|
|||||||
central: FishMediumCentralSpec = "voxygen.voxel.fish_medium_central_manifest",
|
central: FishMediumCentralSpec = "voxygen.voxel.fish_medium_central_manifest",
|
||||||
lateral: FishMediumLateralSpec = "voxygen.voxel.fish_medium_lateral_manifest",
|
lateral: FishMediumLateralSpec = "voxygen.voxel.fish_medium_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_jaw(
|
Some(spec.central.read().0.mesh_jaw(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -2707,12 +2743,16 @@ make_vox_spec!(
|
|||||||
central: FishSmallCentralSpec = "voxygen.voxel.fish_small_central_manifest",
|
central: FishSmallCentralSpec = "voxygen.voxel.fish_small_central_manifest",
|
||||||
lateral: FishSmallLateralSpec = "voxygen.voxel.fish_small_lateral_manifest",
|
lateral: FishSmallLateralSpec = "voxygen.voxel.fish_small_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_chest(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_chest(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_tail(
|
Some(spec.central.read().0.mesh_tail(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -3131,20 +3171,26 @@ make_vox_spec!(
|
|||||||
central: DragonCentralSpec = "voxygen.voxel.dragon_central_manifest",
|
central: DragonCentralSpec = "voxygen.voxel.dragon_central_manifest",
|
||||||
lateral: DragonLateralSpec = "voxygen.voxel.dragon_lateral_manifest",
|
lateral: DragonLateralSpec = "voxygen.voxel.dragon_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head_upper(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head_upper(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_head_lower(
|
Some(spec.central.read().0.mesh_head_lower(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)),
|
||||||
Some(spec.central.read().0.mesh_jaw(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_jaw(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_chest_front(
|
Some(spec.central.read().0.mesh_chest_front(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -3488,16 +3534,22 @@ make_vox_spec!(
|
|||||||
central: BirdLargeCentralSpec = "voxygen.voxel.bird_large_central_manifest",
|
central: BirdLargeCentralSpec = "voxygen.voxel.bird_large_central_manifest",
|
||||||
lateral: BirdLargeLateralSpec = "voxygen.voxel.bird_large_lateral_manifest",
|
lateral: BirdLargeLateralSpec = "voxygen.voxel.bird_large_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.central.read().0.mesh_beak(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_beak(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_neck(
|
Some(spec.central.read().0.mesh_neck(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -3879,21 +3931,29 @@ make_vox_spec!(
|
|||||||
|
|
||||||
// TODO: This is bad code, maybe this method should return Option<_>
|
// TODO: This is bad code, maybe this method should return Option<_>
|
||||||
let loadout = extra.as_deref().unwrap_or(&DEFAULT_LOADOUT);
|
let loadout = extra.as_deref().unwrap_or(&DEFAULT_LOADOUT);
|
||||||
|
let third_person = loadout.third_person.as_ref();
|
||||||
|
|
||||||
//let third_person = loadout.third_person.as_ref();
|
//let third_person = loadout.third_person.as_ref();
|
||||||
let tool = loadout.tool.as_ref();
|
let tool = loadout.tool.as_ref();
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.central.read().0.mesh_jaw(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_jaw(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.central.read().0.mesh_torso_upper(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_torso_upper(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_torso_lower(
|
Some(spec.central.read().0.mesh_torso_lower(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -4262,16 +4322,22 @@ make_vox_spec!(
|
|||||||
central: GolemCentralSpec = "voxygen.voxel.golem_central_manifest",
|
central: GolemCentralSpec = "voxygen.voxel.golem_central_manifest",
|
||||||
lateral: GolemLateralSpec = "voxygen.voxel.golem_lateral_manifest",
|
lateral: GolemLateralSpec = "voxygen.voxel.golem_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.central.read().0.mesh_jaw(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_jaw(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_torso_upper(
|
Some(spec.central.read().0.mesh_torso_upper(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
@ -4556,20 +4622,28 @@ make_vox_spec!(
|
|||||||
central: QuadrupedLowCentralSpec = "voxygen.voxel.quadruped_low_central_manifest",
|
central: QuadrupedLowCentralSpec = "voxygen.voxel.quadruped_low_central_manifest",
|
||||||
lateral: QuadrupedLowLateralSpec = "voxygen.voxel.quadruped_low_lateral_manifest",
|
lateral: QuadrupedLowLateralSpec = "voxygen.voxel.quadruped_low_lateral_manifest",
|
||||||
},
|
},
|
||||||
|FigureKey { body, .. }, spec| {
|
|FigureKey { body, extra, .. }, spec| {
|
||||||
|
let third_person = extra.as_ref().and_then(|loadout| loadout.third_person.as_ref());
|
||||||
|
|
||||||
[
|
[
|
||||||
Some(spec.central.read().0.mesh_head_upper(
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head_upper(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.central.read().0.mesh_head_lower(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_head_lower(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
Some(spec.central.read().0.mesh_jaw(
|
}),
|
||||||
|
third_person.map(|_| {
|
||||||
|
spec.central.read().0.mesh_jaw(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
)),
|
)
|
||||||
|
}),
|
||||||
Some(spec.central.read().0.mesh_chest(
|
Some(spec.central.read().0.mesh_chest(
|
||||||
body.species,
|
body.species,
|
||||||
body.body_type,
|
body.body_type,
|
||||||
|
@ -6517,6 +6517,103 @@ impl FigureMgr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn viewpoint_offset(&self, scene_data: &SceneData, entity: EcsEntity) -> Vec3<f32> {
|
||||||
|
scene_data
|
||||||
|
.state
|
||||||
|
.ecs()
|
||||||
|
.read_storage::<Body>()
|
||||||
|
.get(entity)
|
||||||
|
.and_then(|b| match b {
|
||||||
|
Body::Humanoid(_) => self
|
||||||
|
.states
|
||||||
|
.character_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::QuadrupedSmall(_) => self
|
||||||
|
.states
|
||||||
|
.quadruped_small_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::QuadrupedMedium(_) => self
|
||||||
|
.states
|
||||||
|
.quadruped_medium_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::BirdMedium(_) => self
|
||||||
|
.states
|
||||||
|
.bird_medium_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::FishMedium(_) => self
|
||||||
|
.states
|
||||||
|
.fish_medium_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::Dragon(_) => self
|
||||||
|
.states
|
||||||
|
.dragon_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::BirdLarge(_) => self
|
||||||
|
.states
|
||||||
|
.bird_large_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::FishSmall(_) => self
|
||||||
|
.states
|
||||||
|
.fish_small_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::BipedLarge(_) => self
|
||||||
|
.states
|
||||||
|
.biped_large_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::BipedSmall(_) => self
|
||||||
|
.states
|
||||||
|
.biped_small_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::Golem(_) => self
|
||||||
|
.states
|
||||||
|
.golem_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::Theropod(_) => self
|
||||||
|
.states
|
||||||
|
.theropod_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::QuadrupedLow(_) => self
|
||||||
|
.states
|
||||||
|
.quadruped_low_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::Arthropod(_) => self
|
||||||
|
.states
|
||||||
|
.arthropod_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::Object(_) => self
|
||||||
|
.states
|
||||||
|
.object_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::Ship(_) => self
|
||||||
|
.states
|
||||||
|
.ship_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
Body::ItemDrop(_) => self
|
||||||
|
.states
|
||||||
|
.item_drop_states
|
||||||
|
.get(&entity)
|
||||||
|
.and_then(|state| state.viewpoint_offset),
|
||||||
|
})
|
||||||
|
.map(|viewpoint| viewpoint.into())
|
||||||
|
.unwrap_or_else(Vec3::zero)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn figure_count(&self) -> usize { self.states.count() }
|
pub fn figure_count(&self) -> usize { self.states.count() }
|
||||||
|
|
||||||
pub fn figure_count_visible(&self) -> usize { self.states.count_visible() }
|
pub fn figure_count_visible(&self) -> usize { self.states.count_visible() }
|
||||||
@ -6625,6 +6722,7 @@ impl FigureColLights {
|
|||||||
|
|
||||||
pub struct FigureStateMeta {
|
pub struct FigureStateMeta {
|
||||||
lantern_offset: Option<anim::vek::Vec3<f32>>,
|
lantern_offset: Option<anim::vek::Vec3<f32>>,
|
||||||
|
viewpoint_offset: Option<anim::vek::Vec3<f32>>,
|
||||||
main_abs_trail_points: Option<(anim::vek::Vec3<f32>, anim::vek::Vec3<f32>)>,
|
main_abs_trail_points: Option<(anim::vek::Vec3<f32>, anim::vek::Vec3<f32>)>,
|
||||||
off_abs_trail_points: Option<(anim::vek::Vec3<f32>, anim::vek::Vec3<f32>)>,
|
off_abs_trail_points: Option<(anim::vek::Vec3<f32>, anim::vek::Vec3<f32>)>,
|
||||||
// Animation to be applied to rider of this entity
|
// Animation to be applied to rider of this entity
|
||||||
@ -6710,6 +6808,7 @@ impl<S: Skeleton> FigureState<S> {
|
|||||||
Self {
|
Self {
|
||||||
meta: FigureStateMeta {
|
meta: FigureStateMeta {
|
||||||
lantern_offset: offsets.lantern,
|
lantern_offset: offsets.lantern,
|
||||||
|
viewpoint_offset: offsets.viewpoint,
|
||||||
main_abs_trail_points: None,
|
main_abs_trail_points: None,
|
||||||
off_abs_trail_points: None,
|
off_abs_trail_points: None,
|
||||||
mount_transform: offsets.mount_bone,
|
mount_transform: offsets.mount_bone,
|
||||||
@ -6890,6 +6989,7 @@ impl<S: Skeleton> FigureState<S> {
|
|||||||
|
|
||||||
renderer.update_consts(&mut self.meta.bound.1, &new_bone_consts[0..S::BONE_COUNT]);
|
renderer.update_consts(&mut self.meta.bound.1, &new_bone_consts[0..S::BONE_COUNT]);
|
||||||
self.lantern_offset = offsets.lantern;
|
self.lantern_offset = offsets.lantern;
|
||||||
|
self.viewpoint_offset = offsets.viewpoint;
|
||||||
// Handle weapon trails
|
// Handle weapon trails
|
||||||
fn handle_weapon_trails(
|
fn handle_weapon_trails(
|
||||||
trail_mgr: &mut TrailMgr,
|
trail_mgr: &mut TrailMgr,
|
||||||
|
@ -59,6 +59,7 @@ impl anim::Skeleton for VolumeKey {
|
|||||||
|
|
||||||
anim::Offsets {
|
anim::Offsets {
|
||||||
lantern: None,
|
lantern: None,
|
||||||
|
viewpoint: None,
|
||||||
mount_bone: anim::vek::Transform::default(),
|
mount_bone: anim::vek::Transform::default(),
|
||||||
primary_trail_mat: None,
|
primary_trail_mat: None,
|
||||||
secondary_trail_mat: None,
|
secondary_trail_mat: None,
|
||||||
|
@ -524,28 +524,16 @@ impl Scene {
|
|||||||
.get(scene_data.viewpoint_entity)
|
.get(scene_data.viewpoint_entity)
|
||||||
.map_or(Quaternion::identity(), |ori| ori.to_quat());
|
.map_or(Quaternion::identity(), |ori| ori.to_quat());
|
||||||
|
|
||||||
let viewpoint_rolling = ecs
|
let (is_humanoid, viewpoint_height, viewpoint_eye_height) = ecs
|
||||||
.read_storage::<comp::CharacterState>()
|
|
||||||
.get(scene_data.viewpoint_entity)
|
|
||||||
.map_or(false, |cs| cs.is_dodge());
|
|
||||||
|
|
||||||
let is_running = ecs
|
|
||||||
.read_storage::<comp::Vel>()
|
|
||||||
.get(scene_data.viewpoint_entity)
|
|
||||||
.map(|v| v.0.magnitude_squared() > RUNNING_THRESHOLD.powi(2))
|
|
||||||
.unwrap_or(false);
|
|
||||||
|
|
||||||
let on_ground = ecs
|
|
||||||
.read_storage::<comp::PhysicsState>()
|
|
||||||
.get(scene_data.viewpoint_entity)
|
|
||||||
.map(|p| p.on_ground.is_some());
|
|
||||||
|
|
||||||
let (viewpoint_height, viewpoint_eye_height) = scene_data
|
|
||||||
.state
|
|
||||||
.ecs()
|
|
||||||
.read_storage::<comp::Body>()
|
.read_storage::<comp::Body>()
|
||||||
.get(scene_data.viewpoint_entity)
|
.get(scene_data.viewpoint_entity)
|
||||||
.map_or((1.0, 0.0), |b| (b.height(), b.eye_height()));
|
.map_or((false, 1.0, 0.0), |b| {
|
||||||
|
(
|
||||||
|
matches!(b, comp::Body::Humanoid(_)),
|
||||||
|
b.height(),
|
||||||
|
b.eye_height(),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
if scene_data.mutable_viewpoint || matches!(self.camera.get_mode(), CameraMode::Freefly)
|
if scene_data.mutable_viewpoint || matches!(self.camera.get_mode(), CameraMode::Freefly)
|
||||||
{
|
{
|
||||||
@ -576,9 +564,22 @@ impl Scene {
|
|||||||
.set_orientation_instant(Vec3::new(-yaw, pitch, roll));
|
.set_orientation_instant(Vec3::new(-yaw, pitch, roll));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alter camera position to match player.
|
let viewpoint_offset = if is_humanoid {
|
||||||
let tilt = self.camera.get_orientation().y;
|
let viewpoint_rolling = ecs
|
||||||
let dist = self.camera.get_distance();
|
.read_storage::<comp::CharacterState>()
|
||||||
|
.get(scene_data.viewpoint_entity)
|
||||||
|
.map_or(false, |cs| cs.is_dodge());
|
||||||
|
|
||||||
|
let is_running = ecs
|
||||||
|
.read_storage::<comp::Vel>()
|
||||||
|
.get(scene_data.viewpoint_entity)
|
||||||
|
.map(|v| v.0.magnitude_squared() > RUNNING_THRESHOLD.powi(2))
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
let on_ground = ecs
|
||||||
|
.read_storage::<comp::PhysicsState>()
|
||||||
|
.get(scene_data.viewpoint_entity)
|
||||||
|
.map(|p| p.on_ground.is_some());
|
||||||
|
|
||||||
let up = match self.camera.get_mode() {
|
let up = match self.camera.get_mode() {
|
||||||
CameraMode::FirstPerson => {
|
CameraMode::FirstPerson => {
|
||||||
@ -595,12 +596,19 @@ impl Scene {
|
|||||||
CameraMode::ThirdPerson => viewpoint_eye_height,
|
CameraMode::ThirdPerson => viewpoint_eye_height,
|
||||||
CameraMode::Freefly => 0.0,
|
CameraMode::Freefly => 0.0,
|
||||||
};
|
};
|
||||||
|
// Alter camera position to match player.
|
||||||
|
let tilt = self.camera.get_orientation().y;
|
||||||
|
let dist = self.camera.get_distance();
|
||||||
|
|
||||||
|
Vec3::unit_z() * (up - tilt.min(0.0).sin() * dist * 0.6)
|
||||||
|
} else {
|
||||||
|
self.figure_mgr
|
||||||
|
.viewpoint_offset(scene_data, scene_data.viewpoint_entity)
|
||||||
|
};
|
||||||
|
|
||||||
match self.camera.get_mode() {
|
match self.camera.get_mode() {
|
||||||
CameraMode::FirstPerson | CameraMode::ThirdPerson => {
|
CameraMode::FirstPerson | CameraMode::ThirdPerson => {
|
||||||
self.camera.set_focus_pos(
|
self.camera.set_focus_pos(viewpoint_pos + viewpoint_offset);
|
||||||
viewpoint_pos + Vec3::unit_z() * (up - tilt.min(0.0).sin() * dist * 0.6),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
CameraMode::Freefly => {},
|
CameraMode::Freefly => {},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user