mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Experimental entity pop-in fix
This commit is contained in:
parent
2c36524c90
commit
634f059d3d
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Ogre,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::BipedLarge(body) }
|
||||
}
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Gnome,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::BipedSmall(body) }
|
||||
}
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Phoenix,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::BirdLarge(body) }
|
||||
}
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Duck,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::BirdMedium(body) }
|
||||
}
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Reddragon,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::Dragon(body) }
|
||||
}
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Marlin,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::FishMedium(body) }
|
||||
}
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Clownfish,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::FishSmall(body) }
|
||||
}
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::StoneGolem,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::Golem(body) }
|
||||
}
|
||||
|
@ -65,6 +65,22 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Danari,
|
||||
body_type: BodyType::Female,
|
||||
hair_style: 0,
|
||||
beard: 0,
|
||||
accessory: 0,
|
||||
hair_color: 0,
|
||||
skin: 0,
|
||||
eye_color: 0,
|
||||
eyes: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::Humanoid(body) }
|
||||
}
|
||||
|
@ -89,6 +89,10 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self { Body::Arrow }
|
||||
}
|
||||
|
||||
pub const ALL_OBJECTS: [Body; 67] = [
|
||||
Body::Arrow,
|
||||
Body::Bomb,
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Crocodile,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::QuadrupedLow(body) }
|
||||
}
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Grolgar,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::QuadrupedMedium(body) }
|
||||
}
|
||||
|
@ -25,6 +25,15 @@ impl Body {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Pig,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::QuadrupedSmall(body) }
|
||||
}
|
||||
|
@ -54,6 +54,10 @@ impl Body {
|
||||
pub fn mass(&self) -> Mass { Mass((self.hull_vol() + self.balloon_vol()) * self.density().0) }
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self { Body::DefaultAirship }
|
||||
}
|
||||
|
||||
/// Terrain is 11.0 scale relative to small-scale voxels,
|
||||
/// airship scale is multiplied by 11 to reach terrain scale.
|
||||
pub const AIRSHIP_SCALE: f32 = 11.0;
|
||||
|
@ -25,6 +25,15 @@ impl From<Body> for super::Body {
|
||||
fn from(body: Body) -> Self { super::Body::Theropod(body) }
|
||||
}
|
||||
|
||||
impl Default for Body {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
species: Species::Archaeos,
|
||||
body_type: BodyType::Female,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[repr(u32)]
|
||||
pub enum Species {
|
||||
|
@ -42,7 +42,6 @@ impl Animation for IdleAnimation {
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
next.shoulder_l.scale = Vec3::one() * 1.1;
|
||||
next.shoulder_r.scale = Vec3::one() * 1.1;
|
||||
|
||||
@ -135,7 +134,7 @@ impl Animation for IdleAnimation {
|
||||
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
|
||||
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
||||
next.second.scale = match hands {
|
||||
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),
|
||||
|
@ -70,12 +70,14 @@ skeleton_impls!(struct CharacterSkeleton {
|
||||
control_l,
|
||||
control_r,
|
||||
:: // Begin non-bone fields
|
||||
body: Body,
|
||||
holding_lantern: bool,
|
||||
});
|
||||
|
||||
impl CharacterSkeleton {
|
||||
pub fn new(holding_lantern: bool) -> Self {
|
||||
pub fn new(body: Body, holding_lantern: bool) -> Self {
|
||||
Self {
|
||||
body,
|
||||
holding_lantern,
|
||||
..Self::default()
|
||||
}
|
||||
@ -97,7 +99,10 @@ impl Skeleton for CharacterSkeleton {
|
||||
base_mat: Mat4<f32>,
|
||||
buf: &mut [FigureBoneData; super::MAX_BONE_COUNT],
|
||||
) -> Vec3<f32> {
|
||||
let torso_mat = base_mat * Mat4::<f32>::from(self.torso);
|
||||
let torso_mat = base_mat
|
||||
* Mat4::<f32>::from(self.torso)
|
||||
* Mat4::scaling_3d(1.0 / 11.0)
|
||||
* Mat4::scaling_3d(SkeletonAttr::from(&self.body).scaler);
|
||||
let chest_mat = torso_mat * Mat4::<f32>::from(self.chest);
|
||||
let head_mat = chest_mat * Mat4::<f32>::from(self.head);
|
||||
let shorts_mat = chest_mat * Mat4::<f32>::from(self.shorts);
|
||||
|
@ -273,8 +273,7 @@ impl Animation for RunAnimation {
|
||||
* Quaternion::rotation_y(tilt * 4.0 * fast + tilt * 3.0 + fast2 * speednorm * 0.25);
|
||||
}
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match active_tool_kind {
|
||||
|
@ -85,7 +85,7 @@ impl Animation for SitAnimation {
|
||||
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, -0.2, stop * -0.16) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, -0.2, stop * -0.16);
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position = Vec3::new(
|
||||
|
@ -44,7 +44,7 @@ impl Animation for StandAnimation {
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
next.torso.scale = Vec3::one();
|
||||
next.shoulder_l.scale = Vec3::one() * 1.1;
|
||||
next.shoulder_r.scale = Vec3::one() * 1.1;
|
||||
|
||||
@ -162,7 +162,7 @@ impl Animation for StandAnimation {
|
||||
* Quaternion::rotation_y(fast2 * 0.1);
|
||||
}
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.scale = Vec3::one();
|
||||
next.second.scale = match hands {
|
||||
(Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(),
|
||||
|
@ -773,7 +773,10 @@ impl FigureMgr {
|
||||
.character_states
|
||||
.entry(entity)
|
||||
.or_insert_with(|| {
|
||||
FigureState::new(renderer, CharacterSkeleton::new(holding_lantern))
|
||||
FigureState::new(
|
||||
renderer,
|
||||
CharacterSkeleton::new(*body, holding_lantern),
|
||||
)
|
||||
});
|
||||
|
||||
// Average velocity relative to the current ground
|
||||
@ -795,7 +798,7 @@ impl FigureMgr {
|
||||
) {
|
||||
// Standing
|
||||
(true, false, false) => anim::character::StandAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(holding_lantern),
|
||||
&CharacterSkeleton::new(*body, holding_lantern),
|
||||
(active_tool_kind, second_tool_kind, hands, time, rel_avg_vel),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
@ -803,7 +806,7 @@ impl FigureMgr {
|
||||
),
|
||||
// Running
|
||||
(true, true, false) => anim::character::RunAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(holding_lantern),
|
||||
&CharacterSkeleton::new(*body, holding_lantern),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
@ -822,7 +825,7 @@ impl FigureMgr {
|
||||
),
|
||||
// In air
|
||||
(false, _, false) => anim::character::JumpAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(holding_lantern),
|
||||
&CharacterSkeleton::new(*body, holding_lantern),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
@ -839,7 +842,7 @@ impl FigureMgr {
|
||||
),
|
||||
// Swim
|
||||
(_, _, true) => anim::character::SwimAnimation::update_skeleton(
|
||||
&CharacterSkeleton::new(holding_lantern),
|
||||
&CharacterSkeleton::new(*body, holding_lantern),
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
|
Loading…
Reference in New Issue
Block a user