mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
add hotloads to all anims
This commit is contained in:
parent
124ed52554
commit
838eadda4e
@ -8,7 +8,11 @@ impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = BipedLargeSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"biped_large_idle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_idle")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for JumpAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = BipedLargeSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"biped_large_jump\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_jump")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -32,9 +32,13 @@ impl BipedLargeSkeleton {
|
||||
impl Skeleton for BipedLargeSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"biped_large_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 11 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_compute_mats")]
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
let upper_torso_mat = self.upper_torso.compute_base_matrix();
|
||||
let shoulder_l_mat = self.shoulder_l.compute_base_matrix();
|
||||
let shoulder_r_mat = self.shoulder_r.compute_base_matrix();
|
||||
|
@ -8,7 +8,11 @@ impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = BipedLargeSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"biped_large_run\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for FlyAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = BirdMediumSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"bird_medium_fly\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_medium_fly")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,12 @@ impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = BirdMediumSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"bird_medium_idle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_medium_idle")]
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -27,9 +27,14 @@ impl BirdMediumSkeleton {
|
||||
impl Skeleton for BirdMediumSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"bird_medium_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 7 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_medium_compute_mats")]
|
||||
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
|
||||
(
|
||||
|
@ -8,7 +8,11 @@ impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = BirdMediumSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"bird_medium_run\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_medium_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = BirdSmallSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"bird_small_idle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_small_idle")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for JumpAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = BirdSmallSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"bird_small_jump\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_small_jump")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -32,9 +32,14 @@ impl BirdSmallSkeleton {
|
||||
impl Skeleton for BirdSmallSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"bird_small_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 4 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_small_compute_mats")]
|
||||
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
|
||||
(
|
||||
|
@ -8,7 +8,11 @@ impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = BirdSmallSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"bird_small_run\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "bird_small_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -9,8 +9,12 @@ impl Animation for AlphaAnimation {
|
||||
type Dependency = (Option<ToolKind>, f32, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_alpha\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_alpha")]
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for BetaAnimation {
|
||||
type Dependency = (Option<ToolKind>, f32, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_beta\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_beta")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, _velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -12,7 +12,11 @@ impl Animation for BlockAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_block\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_block")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -12,7 +12,11 @@ impl Animation for BlockIdleAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_blockidle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_blockidle")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -9,9 +9,13 @@ impl Animation for ChargeAnimation {
|
||||
type Dependency = (Option<ToolKind>, f32, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_charge\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_charge")]
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
#[allow(clippy::identity_conversion)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, velocity, orientation, last_ori, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -9,7 +9,11 @@ impl Animation for ClimbAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_climb\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_climb")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, velocity, _orientation, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -9,7 +9,11 @@ impl Animation for DanceAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_dance\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_dance")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -11,8 +11,12 @@ impl Animation for DashAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_dash\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_dash")]
|
||||
#[allow(clippy::single_match)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -10,8 +10,12 @@ impl Animation for EquipAnimation {
|
||||
type Dependency = (Option<ToolKind>, f32, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_equip\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_equip")]
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, velocity, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
308
voxygen/src/anim/src/character/glidewield.rs
Normal file
308
voxygen/src/anim/src/character/glidewield.rs
Normal file
@ -0,0 +1,308 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::ToolKind;
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use vek::*;
|
||||
|
||||
pub struct GlideWieldAnimation;
|
||||
|
||||
impl Animation for GlideWieldAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_glidewield\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_glidewield")]
|
||||
#[allow(clippy::identity_conversion)] // TODO: Pending review in #587
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
*rate = 1.0;
|
||||
let slow = (anim_time as f32 * 1.0).sin();
|
||||
let breathe = ((anim_time as f32 * 0.5).sin()).abs();
|
||||
let walkintensity = if speed > 5.0 { 1.0 } else { 0.45 };
|
||||
let walk = if speed > 5.0 { 1.0 } else { 0.5 };
|
||||
let lower = if speed > 5.0 { 0.0 } else { 1.0 };
|
||||
let _snapfoot = if speed > 5.0 { 1.1 } else { 2.0 };
|
||||
let lab = 1.0;
|
||||
let foothoril = (anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.45).sin();
|
||||
let foothorir = (anim_time as f32 * 16.0 * walk * lab as f32 + PI * (0.45)).sin();
|
||||
|
||||
let footvertl = (anim_time as f32 * 16.0 * walk * lab as f32).sin();
|
||||
let footvertr = (anim_time as f32 * 16.0 * walk * lab as f32 + PI).sin();
|
||||
|
||||
let footrotl = (((5.0)
|
||||
/ (2.5
|
||||
+ (2.5)
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin());
|
||||
|
||||
let footrotr = (((5.0)
|
||||
/ (1.0
|
||||
+ (4.0)
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 0.4).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 0.4).sin());
|
||||
|
||||
let short = (((5.0)
|
||||
/ (1.5
|
||||
+ 3.5 * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 16.0 * walk).sin());
|
||||
let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin();
|
||||
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
|
||||
|
||||
let shorte = (((5.0)
|
||||
/ (4.0
|
||||
+ 1.0 * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 16.0 * walk).sin());
|
||||
|
||||
let shortalt = (anim_time as f32 * lab as f32 * 16.0 * walk + PI / 2.0).sin();
|
||||
let shortalter = (anim_time as f32 * lab as f32 * 16.0 * walk + PI / -2.0).sin();
|
||||
|
||||
let wave_stop = (anim_time as f32 * 26.0).min(PI / 2.0 / 2.0).sin();
|
||||
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 18.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.2,
|
||||
((global_time + anim_time) as f32 / 18.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.1,
|
||||
);
|
||||
|
||||
let ori = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| Vec2::<f32>::from(o).magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-2.0 - skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1,
|
||||
skeleton_attr.hand.2 + 15.0,
|
||||
);
|
||||
next.l_hand.ori = Quaternion::rotation_x(3.35);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
2.0 + skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1,
|
||||
skeleton_attr.hand.2 + 15.0,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(3.35);
|
||||
next.r_hand.scale = Vec3::one();
|
||||
|
||||
if speed > 0.5 {
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-3.0 + skeleton_attr.head.0,
|
||||
skeleton_attr.head.1 + short * 0.1,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.1)
|
||||
* Quaternion::rotation_x(head_look.y + 0.45 - lower * 0.35);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + 2.0 + shortalt * -1.5 - lower,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_z(short * 0.10 * walkintensity + tilt * -1.0)
|
||||
* Quaternion::rotation_y(tilt * 2.2)
|
||||
* Quaternion::rotation_x(
|
||||
shortalter * 0.035 + wave_stop * speed * -0.1 + (tilt.abs()),
|
||||
);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(short * 0.1 + tilt * -1.1)
|
||||
* Quaternion::rotation_y(tilt * 0.5);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.glider.ori = Quaternion::rotation_x(0.8);
|
||||
next.glider.offset = Vec3::new(0.0, -10.0, 15.0);
|
||||
next.glider.scale = Vec3::one() * 1.0;
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
next.back.ori =
|
||||
Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(short * 0.25 + tilt * -1.5)
|
||||
* Quaternion::rotation_y(tilt * 0.7);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
-1.5 + skeleton_attr.foot.1 + foothoril * -8.5 * walkintensity - lower * 1.0,
|
||||
2.0 + skeleton_attr.foot.2 + ((footvertl * -2.7).max(-1.0)) * walkintensity,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.2 + footrotl * -1.2 * walkintensity)
|
||||
* Quaternion::rotation_y(tilt * 1.8);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
-1.5 + skeleton_attr.foot.1 + foothorir * -8.5 * walkintensity - lower * 1.0,
|
||||
2.0 + skeleton_attr.foot.2 + ((footvertr * -2.7).max(-1.0)) * walkintensity,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(-0.2 + footrotr * -1.2 * walkintensity)
|
||||
* Quaternion::rotation_y(tilt * 1.8);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(short * 0.15 * walkintensity);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(short * -0.15 * walkintensity);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.main.offset = Vec3::new(-7.0, -6.5, 15.0);
|
||||
next.main.ori =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.second.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.lantern.offset = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.lantern.ori =
|
||||
Quaternion::rotation_x(shorte * 0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_y(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.control.ori = Quaternion::rotation_x(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.l_control.scale = Vec3::one();
|
||||
|
||||
next.r_control.scale = Vec3::one();
|
||||
} else {
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-3.0 + skeleton_attr.head.0,
|
||||
skeleton_attr.head.1 + slow * 0.3 + breathe * -0.05,
|
||||
);
|
||||
next.head.ori =
|
||||
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale + breathe * -0.05;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + slow * 0.3,
|
||||
);
|
||||
next.chest.ori = Quaternion::rotation_z(head_look.x * 0.6);
|
||||
next.chest.scale = Vec3::one() * 1.01 + breathe * 0.03;
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
|
||||
next.belt.ori = Quaternion::rotation_z(head_look.x * -0.1);
|
||||
next.belt.scale = Vec3::one() + breathe * -0.03;
|
||||
|
||||
next.glider.ori = Quaternion::rotation_x(0.35);
|
||||
next.glider.offset = Vec3::new(0.0, -9.0, 17.0);
|
||||
next.glider.scale = Vec3::one() * 1.0;
|
||||
|
||||
next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
|
||||
next.back.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(head_look.x * -0.2);
|
||||
next.shorts.scale = Vec3::one() + breathe * -0.03;
|
||||
|
||||
next.l_foot.offset = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.l_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.r_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15;
|
||||
|
||||
next.main.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.second.offset = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.lantern.offset = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.lantern.ori = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
||||
next.lantern.scale = Vec3::one() * 0.65;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.l_control.scale = Vec3::one();
|
||||
|
||||
next.r_control.scale = Vec3::one();
|
||||
}
|
||||
next
|
||||
}
|
||||
}
|
@ -9,8 +9,12 @@ impl Animation for GlidingAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_gliding\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_gliding")]
|
||||
#[allow(clippy::identity_conversion)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_idle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_idle")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: f64,
|
||||
anim_time: f64,
|
||||
|
@ -7,8 +7,12 @@ impl Animation for JumpAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_jump\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_jump")]
|
||||
#[allow(clippy::identity_conversion)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -66,9 +66,14 @@ impl CharacterSkeleton {
|
||||
impl Skeleton for CharacterSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"character_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 16 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_compute_mats")]
|
||||
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
let chest_mat = self.chest.compute_base_matrix();
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
let l_hand_mat = self.l_hand.compute_base_matrix();
|
||||
|
@ -8,8 +8,12 @@ impl Animation for RollAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_roll\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_roll")]
|
||||
#[allow(clippy::identity_conversion)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, orientation, last_ori, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -9,8 +9,12 @@ impl Animation for RunAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_run\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_run")]
|
||||
#[allow(clippy::identity_conversion)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,8 +8,12 @@ impl Animation for ShootAnimation {
|
||||
type Dependency = (Option<ToolKind>, f32, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_shoot\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_shoot")]
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -9,7 +9,11 @@ impl Animation for SitAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_sit\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_sit")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -12,7 +12,11 @@ impl Animation for SpinAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_spin\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_spin")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -9,7 +9,11 @@ impl Animation for StandAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_stand\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_stand")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -9,8 +9,12 @@ impl Animation for SwimAnimation {
|
||||
type Dependency = (Option<ToolKind>, Vec3<f32>, Vec3<f32>, Vec3<f32>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_swim\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_swim")]
|
||||
#[allow(clippy::identity_conversion)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -9,8 +9,12 @@ impl Animation for WieldAnimation {
|
||||
type Dependency = (Option<ToolKind>, f32, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_wield\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_wield")]
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
fn update_skeleton(
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, velocity, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -9,7 +9,11 @@ impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = CritterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"critter_idle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "critter_idle")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for JumpAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = CritterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"critter_jump\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "critter_jump")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -32,9 +32,14 @@ impl CritterSkeleton {
|
||||
impl Skeleton for CritterSkeleton {
|
||||
type Attr = CritterAttr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"critter_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 5 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "critter_compute_mats")]
|
||||
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
(
|
||||
[
|
||||
FigureBoneData::new(self.head.compute_base_matrix()),
|
||||
|
@ -9,7 +9,11 @@ impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = CritterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"critter_run\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "critter_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for FlyAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = DragonSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"dragon_fly\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "dragon_fly")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = DragonSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"dragon_idle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "dragon_idle")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -35,9 +35,14 @@ impl DragonSkeleton {
|
||||
impl Skeleton for DragonSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"dragon_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 15 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "dragon_compute_mats")]
|
||||
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
let head_upper_mat = self.head_upper.compute_base_matrix();
|
||||
let head_lower_mat = self.head_lower.compute_base_matrix();
|
||||
let chest_front_mat = self.chest_front.compute_base_matrix();
|
||||
|
@ -8,7 +8,11 @@ impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = DragonSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"dragon_run\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "dragon_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = FishMediumSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"fish_medium_idle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_medium_idle")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for JumpAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = FishMediumSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"fish_medium_jump\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_medium_jump")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -36,9 +36,13 @@ impl FishMediumSkeleton {
|
||||
impl Skeleton for FishMediumSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"fish_medium_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 6 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_medium_compute_mats")]
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
let rear_mat = self.rear.compute_base_matrix();
|
||||
|
||||
|
@ -8,7 +8,11 @@ impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = FishMediumSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"fish_medium_run\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_medium_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = FishSmallSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"fish_small_idle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_small_idle")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -8,7 +8,11 @@ impl Animation for JumpAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = FishSmallSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"fish_small_jump\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_small_jump")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -28,9 +28,14 @@ impl FishSmallSkeleton {
|
||||
impl Skeleton for FishSmallSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"fish_small_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 2 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_small_compute_mats")]
|
||||
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
|
||||
(
|
||||
|
@ -8,7 +8,11 @@ impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = FishSmallSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"fish_small_run\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fish_small_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -14,9 +14,14 @@ impl FixtureSkeleton {
|
||||
impl Skeleton for FixtureSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"fixture_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 1 }
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "fixture_compute_mats")]
|
||||
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
(
|
||||
[
|
||||
FigureBoneData::new(vek::Mat4::identity()), // <-- This is actually a bone!
|
||||
|
@ -8,7 +8,12 @@ impl Animation for IdleAnimation {
|
||||
type Dependency = f64;
|
||||
type Skeleton = GolemSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"golem_idle\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "golem_idle")]
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -8,7 +8,12 @@ impl Animation for JumpAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = GolemSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"golem_jump\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "golem_jump")]
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
|
@ -9,7 +9,7 @@ use super::{Bone, FigureBoneData, Skeleton};
|
||||
use common::comp::{self};
|
||||
use vek::Vec3;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct GolemSkeleton {
|
||||
head: Bone,
|
||||
upper_torso: Bone,
|
||||
@ -25,28 +25,19 @@ pub struct GolemSkeleton {
|
||||
}
|
||||
|
||||
impl GolemSkeleton {
|
||||
#[allow(clippy::new_without_default)] // TODO: Pending review in #587
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
head: Bone::default(),
|
||||
upper_torso: Bone::default(),
|
||||
shoulder_l: Bone::default(),
|
||||
shoulder_r: Bone::default(),
|
||||
hand_l: Bone::default(),
|
||||
hand_r: Bone::default(),
|
||||
leg_l: Bone::default(),
|
||||
leg_r: Bone::default(),
|
||||
foot_l: Bone::default(),
|
||||
foot_r: Bone::default(),
|
||||
torso: Bone::default(),
|
||||
}
|
||||
}
|
||||
pub fn new() -> Self { Self::default() }
|
||||
}
|
||||
|
||||
impl Skeleton for GolemSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"golem_compute_mats\0";
|
||||
|
||||
fn bone_count(&self) -> usize { 15 }
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "golem_compute_mats")]
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
let upper_torso_mat = self.upper_torso.compute_base_matrix();
|
||||
let shoulder_l_mat = self.shoulder_l.compute_base_matrix();
|
||||
let shoulder_r_mat = self.shoulder_r.compute_base_matrix();
|
||||
|
@ -8,7 +8,12 @@ impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Skeleton = GolemSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"golem_run\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "golem_run")]
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
|
@ -1,4 +1,3 @@
|
||||
// TODO: we could probably avoid the need for this
|
||||
#[cfg(all(feature = "be-dyn-lib", feature = "use-dyn-lib"))]
|
||||
compile_error!("Can't use both \"be-dyn-lib\" and \"use-dyn-lib\" features at once");
|
||||
|
||||
@ -70,10 +69,12 @@ pub trait Skeleton: Send + Sync + 'static {
|
||||
type Attr;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"\0";
|
||||
const COMPUTE_FN: &'static [u8];
|
||||
|
||||
fn bone_count(&self) -> usize { 16 }
|
||||
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>);
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
#[cfg(not(feature = "use-dyn-lib"))]
|
||||
{
|
||||
@ -100,13 +101,6 @@ pub trait Skeleton: Send + Sync + 'static {
|
||||
}
|
||||
}
|
||||
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
panic!(
|
||||
"Neither compute_matrices_inner nor compute_matrices override present in Animation \
|
||||
impl"
|
||||
)
|
||||
}
|
||||
|
||||
/// Change the current skeleton to be more like `target`.
|
||||
fn interpolate(&mut self, target: &Self, dt: f32);
|
||||
}
|
||||
@ -116,9 +110,19 @@ pub trait Animation {
|
||||
type Dependency;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"\0";
|
||||
const UPDATE_FN: &'static [u8];
|
||||
|
||||
/// Returns a new skeleton that is generated by the animation.
|
||||
fn update_skeleton_inner(
|
||||
_skeleton: &Self::Skeleton,
|
||||
_dependency: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &<<Self as Animation>::Skeleton as Skeleton>::Attr,
|
||||
) -> Self::Skeleton;
|
||||
|
||||
/// Calls `update_skeleton_inner` either directly or via `libloading` to
|
||||
/// produce generate the new skeleton.
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
dependency: Self::Dependency,
|
||||
@ -164,16 +168,4 @@ pub trait Animation {
|
||||
update_fn(skeleton, dependency, anim_time, rate, skeleton_attr)
|
||||
}
|
||||
}
|
||||
|
||||
fn update_skeleton_inner(
|
||||
_skeleton: &Self::Skeleton,
|
||||
_dependency: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &<<Self as Animation>::Skeleton as Skeleton>::Attr,
|
||||
) -> Self::Skeleton {
|
||||
panic!(
|
||||
"Neither update_skeleton_inner nor update_skeleton override present in Animation impl"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,13 @@ const SCALE: f32 = 1.0 / 11.0;
|
||||
impl Skeleton for ObjectSkeleton {
|
||||
type Attr = SkeletonAttr;
|
||||
|
||||
fn bone_count(&self) -> usize { 1 }
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const COMPUTE_FN: &'static [u8] = b"object_compute_mats\0";
|
||||
|
||||
fn compute_matrices(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
fn bone_count(&self) -> usize { 15 }
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "object_compute_mats")]
|
||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||
(
|
||||
[
|
||||
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
|
||||
|
Loading…
Reference in New Issue
Block a user