Fixed bad non-humanoid lantern offset

This commit is contained in:
Joshua Barretto 2021-07-24 15:05:36 +01:00
parent 4bfc92c65d
commit 6dfa233cc4
18 changed files with 25 additions and 20 deletions

View File

@ -128,7 +128,7 @@ impl Skeleton for BipedLargeSkeleton {
make_bone(upper_torso_mat * control_mat * hand_l_mat * Mat4::<f32>::from(self.hold)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::BipedLarge(body)

View File

@ -68,7 +68,7 @@ impl Skeleton for BipedSmallSkeleton {
make_bone(base_mat * Mat4::<f32>::from(self.foot_r)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::BipedSmall(body)

View File

@ -97,7 +97,7 @@ impl Skeleton for BirdLargeSkeleton {
make_bone(foot_r_mat),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::BirdLarge(body)

View File

@ -51,7 +51,7 @@ impl Skeleton for BirdMediumSkeleton {
make_bone(base_mat * Mat4::<f32>::from(self.leg_r)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::BirdMedium(body)

View File

@ -141,7 +141,7 @@ impl Skeleton for CharacterSkeleton {
make_bone(control_mat * hand_l_mat * Mat4::<f32>::from(self.hold)),
];
Offsets {
lantern: (lantern_mat * Vec4::new(0.0, 0.0, -4.0, 1.0)).xyz(),
lantern: Some((lantern_mat * Vec4::new(0.0, 0.0, -4.0, 1.0)).xyz()),
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::Humanoid(body)

View File

@ -72,7 +72,7 @@ impl Skeleton for DragonSkeleton {
make_bone(chest_rear_mat * Mat4::<f32>::from(self.foot_br)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::Dragon(body)

View File

@ -51,7 +51,7 @@ impl Skeleton for FishMediumSkeleton {
make_bone(chest_front_mat * Mat4::<f32>::from(self.fin_r)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::FishMedium(body)

View File

@ -42,7 +42,7 @@ impl Skeleton for FishSmallSkeleton {
make_bone(chest_mat * Mat4::<f32>::from(self.fin_r)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::FishSmall(body)

View File

@ -35,7 +35,7 @@ impl Skeleton for FixtureSkeleton {
) -> Offsets {
buf[0] = make_bone(base_mat);
Offsets {
lantern: Vec3::default(),
lantern: None,
mount_bone: Transform::default(),
}
}

View File

@ -74,7 +74,7 @@ impl Skeleton for GolemSkeleton {
make_bone(leg_r_mat * Mat4::<f32>::from(self.foot_r)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::Golem(body)

View File

@ -100,7 +100,7 @@ pub fn init() { lazy_static::initialize(&LIB); }
// Offsets that will be returned after computing the skeleton matrices
pub struct Offsets {
pub lantern: Vec3<f32>,
pub lantern: Option<Vec3<f32>>,
pub mount_bone: Transform<f32, f32, f32>,
}

View File

@ -40,7 +40,7 @@ impl Skeleton for ObjectSkeleton {
make_bone(scale_mat * Mat4::<f32>::from(self.bone1)), /* Decorellated from ori */
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::Object(body)

View File

@ -70,7 +70,7 @@ impl Skeleton for QuadrupedLowSkeleton {
make_bone(chest_mat * Mat4::<f32>::from(self.foot_br)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::QuadrupedLow(body)

View File

@ -103,7 +103,7 @@ impl Skeleton for QuadrupedMediumSkeleton {
let mount_orientation = mount_bone_ori;
Offsets {
lantern: Vec3::default(),
lantern: None,
mount_bone: Transform {
position: mount_position,
orientation: mount_orientation,

View File

@ -56,7 +56,7 @@ impl Skeleton for QuadrupedSmallSkeleton {
make_bone(chest_mat * Mat4::<f32>::from(self.tail)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::QuadrupedSmall(body)

View File

@ -40,7 +40,7 @@ impl Skeleton for ShipSkeleton {
make_bone(bone0_mat * Mat4::<f32>::from(self.bone3)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::Ship(body)

View File

@ -75,7 +75,7 @@ impl Skeleton for TheropodSkeleton {
make_bone(leg_r_mat * Mat4::<f32>::from(self.foot_r)),
];
Offsets {
lantern: Vec3::default(),
lantern: None,
// TODO: see quadruped_medium for how to animate this
mount_bone: Transform {
position: common::comp::Body::Theropod(body)

View File

@ -454,8 +454,13 @@ impl FigureMgr {
} else {
(vek::Rgb::zero(), 0.0, 0.0, true)
};
if let Some(state) = body.and_then(|body| self.states.get_mut(body, &entity)) {
light_anim.offset = vek::Vec3::from(state.lantern_offset);
if let Some(lantern_offset) = body
.and_then(|body| self.states.get_mut(body, &entity))
.and_then(|state| state.lantern_offset)
{
light_anim.offset = vek::Vec3::from(lantern_offset);
} else if let Some(body) = body {
light_anim.offset = body.default_light_offset();
}
if !light_anim.strength.is_normal() {
light_anim.strength = 0.0;
@ -5257,7 +5262,7 @@ impl FigureColLights {
}
pub struct FigureStateMeta {
lantern_offset: anim::vek::Vec3<f32>,
lantern_offset: Option<anim::vek::Vec3<f32>>,
// Animation to be applied to mounter of this entity
mount_transform: anim::vek::Transform<f32, f32, f32>,
// Contains the position of this figure or if it is a mounter it will contain the mountee's