mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Makes anim hotload work for quadlow
This commit is contained in:
@ -8,7 +8,7 @@ edition = "2018"
|
|||||||
name = "voxygen_anim"
|
name = "voxygen_anim"
|
||||||
# Uncomment to use animation hot reloading
|
# Uncomment to use animation hot reloading
|
||||||
# Note: this breaks `cargo test`
|
# Note: this breaks `cargo test`
|
||||||
# crate-type = ["lib", "cdylib"]
|
crate-type = ["lib", "cdylib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
use-dyn-lib = ["libloading", "notify", "lazy_static", "tracing", "find_folder"]
|
use-dyn-lib = ["libloading", "notify", "lazy_static", "tracing", "find_folder"]
|
||||||
|
@ -15,6 +15,7 @@ pub mod golem;
|
|||||||
pub mod object;
|
pub mod object;
|
||||||
pub mod quadruped_medium;
|
pub mod quadruped_medium;
|
||||||
pub mod quadruped_small;
|
pub mod quadruped_small;
|
||||||
|
pub mod quadruped_low;
|
||||||
|
|
||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
pub use dyn_lib::init;
|
pub use dyn_lib::init;
|
||||||
|
@ -8,7 +8,11 @@ impl Animation for IdleAnimation {
|
|||||||
type Dependency = f64;
|
type Dependency = f64;
|
||||||
type Skeleton = QuadrupedLowSkeleton;
|
type Skeleton = QuadrupedLowSkeleton;
|
||||||
|
|
||||||
fn update_skeleton(
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const UPDATE_FN: &'static [u8] = b"quadruped_low_idle\0";
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_idle")]
|
||||||
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
global_time: Self::Dependency,
|
global_time: Self::Dependency,
|
||||||
anim_time: f64,
|
anim_time: f64,
|
@ -8,7 +8,11 @@ impl Animation for JumpAnimation {
|
|||||||
type Dependency = (f32, f64);
|
type Dependency = (f32, f64);
|
||||||
type Skeleton = QuadrupedLowSkeleton;
|
type Skeleton = QuadrupedLowSkeleton;
|
||||||
|
|
||||||
fn update_skeleton(
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const UPDATE_FN: &'static [u8] = b"quadruped_low_jump\0";
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_jump")]
|
||||||
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
_global_time: Self::Dependency,
|
_global_time: Self::Dependency,
|
||||||
anim_time: f64,
|
anim_time: f64,
|
@ -5,8 +5,7 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
||||||
|
|
||||||
use super::{Bone, Skeleton};
|
use super::{Bone, FigureBoneData, Skeleton};
|
||||||
use crate::render::FigureBoneData;
|
|
||||||
use common::comp::{self};
|
use common::comp::{self};
|
||||||
use vek::Vec3;
|
use vek::Vec3;
|
||||||
|
|
||||||
@ -31,9 +30,13 @@ impl QuadrupedLowSkeleton {
|
|||||||
impl Skeleton for QuadrupedLowSkeleton {
|
impl Skeleton for QuadrupedLowSkeleton {
|
||||||
type Attr = SkeletonAttr;
|
type Attr = SkeletonAttr;
|
||||||
|
|
||||||
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const COMPUTE_FN: &'static [u8] = b"quadruped_low_compute_mats\0";
|
||||||
|
|
||||||
fn bone_count(&self) -> usize { 10 }
|
fn bone_count(&self) -> usize { 10 }
|
||||||
|
|
||||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_compute_mats")]
|
||||||
|
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||||
let head_upper_mat = self.head_upper.compute_base_matrix();
|
let head_upper_mat = self.head_upper.compute_base_matrix();
|
||||||
let head_lower_mat = self.head_lower.compute_base_matrix();
|
let head_lower_mat = self.head_lower.compute_base_matrix();
|
||||||
let chest_mat = self.chest.compute_base_matrix();
|
let chest_mat = self.chest.compute_base_matrix();
|
@ -8,7 +8,11 @@ impl Animation for RunAnimation {
|
|||||||
type Dependency = (f32, f64);
|
type Dependency = (f32, f64);
|
||||||
type Skeleton = QuadrupedLowSkeleton;
|
type Skeleton = QuadrupedLowSkeleton;
|
||||||
|
|
||||||
fn update_skeleton(
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const UPDATE_FN: &'static [u8] = b"quadruped_low_run\0";
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_run")]
|
||||||
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
(_velocity, global_time): Self::Dependency,
|
(_velocity, global_time): Self::Dependency,
|
||||||
anim_time: f64,
|
anim_time: f64,
|
@ -28,60 +28,6 @@ pub struct QuadrupedMediumSkeleton {
|
|||||||
foot_br: Bone,
|
foot_br: Bone,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const HEAD_UPPER_Y: f32 = 6.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const HEAD_UPPER_Z: f32 = 1.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const HEAD_LOWER_Y: f32 = 1.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const HEAD_LOWER_Z: f32 = -3.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const JAW_Y: f32 = -2.5;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const JAW_Z: f32 = 0.5;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const TAIL_Y: f32 = -5.5;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const TAIL_Z: f32 = -0.5;
|
|
||||||
#[const_tweaker::tweak(min = -25.0, max = 20.0, step = 0.5)]
|
|
||||||
const TORSO_BACK_Y: f32 = -20.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const TORSO_BACK_Z: f32 = 1.5;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const TORSO_FRONT_Y: f32 = 0.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const TORSO_FRONT_Z: f32 = 11.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const EARS_Y: f32 = 5.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const EARS_Z: f32 = 9.5;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const LEG_FRONT_X: f32 = -7.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const LEG_FRONT_Y: f32 = -5.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const LEG_FRONT_Z: f32 = -2.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const LEG_BACK_X: f32 = 6.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const LEG_BACK_Y: f32 = -0.5;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const LEG_BACK_Z: f32 = -5.5;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const FEET_FRONT_X: f32 = 0.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const FEET_FRONT_Y: f32 = 1.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const FEET_FRONT_Z: f32 = -6.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const FEET_BACK_X: f32 = 0.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const FEET_BACK_Y: f32 = 0.0;
|
|
||||||
#[const_tweaker::tweak(min = -20.0, max = 20.0, step = 0.5)]
|
|
||||||
const FEET_BACK_Z: f32 = -5.0;
|
|
||||||
|
|
||||||
|
|
||||||
impl QuadrupedMediumSkeleton {
|
impl QuadrupedMediumSkeleton {
|
||||||
pub fn new() -> Self { Self::default() }
|
pub fn new() -> Self { Self::default() }
|
||||||
}
|
}
|
||||||
@ -89,6 +35,9 @@ impl QuadrupedMediumSkeleton {
|
|||||||
impl Skeleton for QuadrupedMediumSkeleton {
|
impl Skeleton for QuadrupedMediumSkeleton {
|
||||||
type Attr = SkeletonAttr;
|
type Attr = SkeletonAttr;
|
||||||
|
|
||||||
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const COMPUTE_FN: &'static [u8] = b"quadruped_medium_compute_mats\0";
|
||||||
|
|
||||||
fn bone_count(&self) -> usize { 15 }
|
fn bone_count(&self) -> usize { 15 }
|
||||||
|
|
||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_compute_mats")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_compute_mats")]
|
||||||
@ -207,7 +156,6 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
|
|||||||
(Saber, _) => (1.0, 0.0),
|
(Saber, _) => (1.0, 0.0),
|
||||||
(Tuskram, _) => (1.0, 1.0),
|
(Tuskram, _) => (1.0, 1.0),
|
||||||
(Lion, _) => (0.5, 1.0),
|
(Lion, _) => (0.5, 1.0),
|
||||||
(Tiger, _) => (0.0, 0.0),
|
|
||||||
(Tarasque, _) => (0.5, -2.0),
|
(Tarasque, _) => (0.5, -2.0),
|
||||||
(Tiger, _) => (-5.0, -6.0),
|
(Tiger, _) => (-5.0, -6.0),
|
||||||
},
|
},
|
||||||
|
@ -5,13 +5,6 @@ pub use cache::FigureModelCache;
|
|||||||
pub use load::load_mesh; // TODO: Don't make this public.
|
pub use load::load_mesh; // TODO: Don't make this public.
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
anim::{
|
|
||||||
self, biped_large::BipedLargeSkeleton, bird_medium::BirdMediumSkeleton,
|
|
||||||
bird_small::BirdSmallSkeleton, character::CharacterSkeleton, critter::CritterSkeleton,
|
|
||||||
dragon::DragonSkeleton, fish_medium::FishMediumSkeleton, fish_small::FishSmallSkeleton,
|
|
||||||
golem::GolemSkeleton, object::ObjectSkeleton, quadruped_medium::QuadrupedMediumSkeleton,
|
|
||||||
quadruped_small::QuadrupedSmallSkeleton, quadruped_low::QuadrupedLowSkeleton, Animation, Skeleton,
|
|
||||||
},
|
|
||||||
ecs::comp::Interpolated,
|
ecs::comp::Interpolated,
|
||||||
render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow},
|
render::{Consts, FigureBoneData, FigureLocals, Globals, Light, Renderer, Shadow},
|
||||||
scene::{
|
scene::{
|
||||||
@ -24,7 +17,7 @@ use anim::{
|
|||||||
bird_small::BirdSmallSkeleton, character::CharacterSkeleton, critter::CritterSkeleton,
|
bird_small::BirdSmallSkeleton, character::CharacterSkeleton, critter::CritterSkeleton,
|
||||||
dragon::DragonSkeleton, fish_medium::FishMediumSkeleton, fish_small::FishSmallSkeleton,
|
dragon::DragonSkeleton, fish_medium::FishMediumSkeleton, fish_small::FishSmallSkeleton,
|
||||||
golem::GolemSkeleton, object::ObjectSkeleton, quadruped_medium::QuadrupedMediumSkeleton,
|
golem::GolemSkeleton, object::ObjectSkeleton, quadruped_medium::QuadrupedMediumSkeleton,
|
||||||
quadruped_small::QuadrupedSmallSkeleton, Animation, Skeleton,
|
quadruped_small::QuadrupedSmallSkeleton, quadruped_low::QuadrupedLowSkeleton, Animation, Skeleton,
|
||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
comp::{
|
comp::{
|
||||||
@ -1020,7 +1013,7 @@ impl FigureMgr {
|
|||||||
is_player,
|
is_player,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
Body::QuadrupedLow(_) => {
|
Body::QuadrupedLow(quadruped_body) => {
|
||||||
let skeleton_attr = &self
|
let skeleton_attr = &self
|
||||||
.quadruped_low_model_cache
|
.quadruped_low_model_cache
|
||||||
.get_or_create_model(
|
.get_or_create_model(
|
||||||
@ -1032,6 +1025,7 @@ impl FigureMgr {
|
|||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
.1;
|
.1;
|
||||||
|
let ref skeleton_attr = quadruped_body.into();
|
||||||
|
|
||||||
let state = self
|
let state = self
|
||||||
.quadruped_low_states
|
.quadruped_low_states
|
||||||
|
Reference in New Issue
Block a user