diff --git a/assets/voxygen/voxel/hand.vox b/assets/voxygen/voxel/hand.vox index cb2928405e..eb9468b18a 100644 Binary files a/assets/voxygen/voxel/hand.vox and b/assets/voxygen/voxel/hand.vox differ diff --git a/assets/voxygen/voxel/head.vox b/assets/voxygen/voxel/head.vox index d1e925ce60..80834fb1e1 100644 Binary files a/assets/voxygen/voxel/head.vox and b/assets/voxygen/voxel/head.vox differ diff --git a/assets/voxygen/voxel/shoulder_l.vox b/assets/voxygen/voxel/shoulder_l.vox new file mode 100644 index 0000000000..62e1930940 Binary files /dev/null and b/assets/voxygen/voxel/shoulder_l.vox differ diff --git a/assets/voxygen/voxel/shoulder_r.vox b/assets/voxygen/voxel/shoulder_r.vox new file mode 100644 index 0000000000..ce14c0e7d3 Binary files /dev/null and b/assets/voxygen/voxel/shoulder_r.vox differ diff --git a/common/src/comp/character.rs b/common/src/comp/character.rs index 929c584a48..c56dddde3e 100644 --- a/common/src/comp/character.rs +++ b/common/src/comp/character.rs @@ -60,14 +60,26 @@ pub enum Weapon { Staff, } +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Shoulder { + DefaultShoulder, +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +pub enum Draw { + DefaultDraw, +} + use Belt::*; use Chest::*; +use Draw::*; use Foot::*; use Gender::*; use Hand::*; use Head::*; use Pants::*; use Race::*; +use Shoulder::*; use Weapon::*; const ALL_RACES: [Race; 6] = [Danari, Dwarf, Elf, Human, Orc, Undead]; @@ -79,6 +91,8 @@ const ALL_PANTS: [Pants; 1] = [DefaultPants]; const ALL_HANDS: [Hand; 1] = [DefaultHand]; const ALL_FEET: [Foot; 1] = [DefaultFoot]; const ALL_WEAPONS: [Weapon; 7] = [Daggers, SwordShield, Sword, Axe, Hammer, Bow, Staff]; +const ALL_SHOULDERS: [Shoulder; 1] = [DefaultShoulder]; +const ALL_DRAW: [Draw; 1] = [DefaultDraw]; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct Character { @@ -91,6 +105,8 @@ pub struct Character { pub hand: Hand, pub foot: Foot, pub weapon: Weapon, + pub shoulder: Shoulder, + pub draw: Draw, } impl Character { @@ -105,6 +121,8 @@ impl Character { hand: *thread_rng().choose(&ALL_HANDS).unwrap(), foot: *thread_rng().choose(&ALL_FEET).unwrap(), weapon: *thread_rng().choose(&ALL_WEAPONS).unwrap(), + shoulder: *thread_rng().choose(&ALL_SHOULDERS).unwrap(), + draw: *thread_rng().choose(&ALL_DRAW).unwrap(), } } } diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index 85c0e03315..1a629d3b0b 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -7,6 +7,9 @@ use vek::*; // Local use super::{super::Animation, CharacterSkeleton, SCALE}; +pub struct Input { + pub attack: bool, +} pub struct IdleAnimation; impl Animation for IdleAnimation { @@ -40,62 +43,66 @@ impl Animation for IdleAnimation { .sin() * 0.25, ); - next.head.offset = Vec3::new(5.5, 2.0, 11.5 + waveultra_slow * 0.4); + next.head.offset = Vec3::new(5.5, 2.0, 11.0 + waveultra_slow * 0.3); next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(5.5, 0.0, 7.5 + waveultra_slow * 0.4); + next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + waveultra_slow * 0.3); next.chest.ori = Quaternion::rotation_x(0.0); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(5.5, 0.0, 5.5 + waveultra_slow * 0.4); + next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + waveultra_slow * 0.3); next.belt.ori = Quaternion::rotation_x(0.0); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(5.5, 0.0, 2.5 + waveultra_slow * 0.4); + next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + waveultra_slow * 0.3); next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -7.5, - -2.0 + waveultracos_slow * 0.3, - 12.0 + waveultra_slow * 1.1, + -6.0, + -2.0 + waveultracos_slow * 0.15, + 11.5 + waveultra_slow * 0.5, ); + next.l_hand.ori = Quaternion::rotation_x(0.0 + waveultra_slow * 0.06); next.l_hand.scale = Vec3::one(); next.r_hand.offset = Vec3::new( - 7.5, - -2.0 + waveultracos_slow * 0.3, - 12.0 + waveultra_slow * 1.1, + 9.0, + -2.0 + waveultracos_slow * 0.15, + 11.5 + waveultra_slow * 0.5, ); next.r_hand.ori = Quaternion::rotation_x(0.0 + waveultra_slow * 0.06); next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, 0.0, 8.0); + next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); next.l_foot.ori = Quaternion::identity(); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, 0.0, 8.0); + next.r_foot.offset = Vec3::new(4.1, -0.1, 8.0); next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 18.5); + next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); + next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.scale = Vec3::one(); + + next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.scale = Vec3::one(); + next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0; - next.l_shoulder.offset = Vec3::new(2.9, 6.0, 18.0); - next.l_shoulder.ori = Quaternion::rotation_x(0.0); - next.l_shoulder.scale = Vec3::one(); - - next.r_shoulder.offset = Vec3::new(2.9, -6.0, 18.0); - next.r_shoulder.ori = Quaternion::rotation_x(0.0); - next.r_shoulder.scale = Vec3::one(); - + next.draw.offset = Vec3::new(0.0, 1.0, -8.0); + next.draw.ori = Quaternion::rotation_y(-0.2); + next.draw.scale = Vec3::one(); next } } diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index b966bce36e..acbd79adb0 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -21,18 +21,19 @@ impl Animation for JumpAnimation { ) -> Self::Skeleton { let mut next = (*skeleton).clone(); let wave = (anim_time as f32 * 14.0).sin(); - let arcwave = (1.0f32.ln_1p() - 1.0).abs(); + let waveslow = (anim_time as f32 * 7.0).sin(); + let arcwave = (1.0f32.ln_1p() - 1.5).abs(); let wavetest = (wave.cbrt()); let fuzzwave = (anim_time as f32 * 12.0).sin(); let wavecos = (anim_time as f32 * 14.0).cos(); - let wave_slow = (anim_time as f32 * 5.0 + PI).min(PI / 2.0).sin(); + let wave_stop = (anim_time as f32 * 4.5).min(PI / 2.0).sin(); + let wave_stopalt = (anim_time as f32 * 5.0).min(PI / 2.0).sin(); + let wave_slowtest = (anim_time as f32).min(PI / 2.0).sin(); let wavecos_slow = (anim_time as f32 * 8.0 + PI).cos(); - let wave_dip = (wave_slow.abs() - 0.5).abs(); - let mult = wave_slow / (wave_slow.abs()); next.head.offset = Vec3::new(5.5, 2.0, 12.0); - next.head.ori = Quaternion::rotation_x(0.15); + next.head.ori = Quaternion::rotation_x(0.25); next.head.scale = Vec3::one(); next.chest.offset = Vec3::new(5.5, 0.0, 8.0); @@ -47,38 +48,38 @@ impl Animation for JumpAnimation { next.shorts.ori = Quaternion::rotation_z(0.0); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-7.5, -2.0, 12.0); - next.l_hand.ori = Quaternion::rotation_x(0.8); + next.l_hand.offset = Vec3::new(-6.0, 0.0, 12.0); + next.l_hand.ori = Quaternion::rotation_x(wave_stopalt * 1.2 - waveslow * 0.15); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(7.5, -2.0, 12.0); - next.r_hand.ori = Quaternion::rotation_x(-0.8); + next.r_hand.offset = Vec3::new(9.0, 0.0, 12.0); + next.r_hand.ori = Quaternion::rotation_x(wave_stopalt * -1.2 + waveslow * 0.15); next.r_hand.scale = Vec3::one(); next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0); - next.l_foot.ori = Quaternion::rotation_x(wave_slow * -1.2); + next.l_foot.ori = Quaternion::rotation_x(wave_stop * -1.2 - waveslow * 0.2); next.l_foot.scale = Vec3::one(); next.r_foot.offset = Vec3::new(3.4, -1.0, 6.0); - next.r_foot.ori = Quaternion::rotation_x(wave_slow * 1.2); + next.r_foot.ori = Quaternion::rotation_x(wave_stop * 1.2 + waveslow * 0.2); next.r_foot.scale = Vec3::one(); next.weapon.offset = Vec3::new(-5.0, -6.0, 19.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); - next.torso.offset = Vec3::new(-0.5, 0.0, 0.2); - next.torso.ori = Quaternion::rotation_x(0.0); - next.torso.scale = Vec3::one() / 11.0; - - next.l_shoulder.offset = Vec3::new(3.0, 6.0, 18.0); - next.l_shoulder.ori = Quaternion::rotation_y(0.0); + next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = Vec3::one(); - next.r_shoulder.offset = Vec3::new(3.0, -6.0, 18.0); - next.r_shoulder.ori = Quaternion::rotation_y(0.0); + next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one(); + next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); + next.torso.ori = Quaternion::rotation_x(-0.2); + next.torso.scale = Vec3::one() / 11.0; + next } } diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 8671f5ca10..8a348ce769 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -25,9 +25,10 @@ pub struct CharacterSkeleton { l_foot: Bone, r_foot: Bone, weapon: Bone, - torso: Bone, l_shoulder: Bone, r_shoulder: Bone, + torso: Bone, + draw: Bone, } impl CharacterSkeleton { @@ -42,9 +43,10 @@ impl CharacterSkeleton { l_foot: Bone::default(), r_foot: Bone::default(), weapon: Bone::default(), - torso: Bone::default(), l_shoulder: Bone::default(), r_shoulder: Bone::default(), + torso: Bone::default(), + draw: Bone::default(), } } } @@ -53,22 +55,21 @@ impl Skeleton for CharacterSkeleton { fn compute_matrices(&self) -> [FigureBoneData; 16] { 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(); [ FigureBoneData::new(torso_mat * self.head.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat), FigureBoneData::new(torso_mat * self.belt.compute_base_matrix()), FigureBoneData::new(torso_mat * self.shorts.compute_base_matrix()), - FigureBoneData::new(torso_mat * self.l_hand.compute_base_matrix()), + FigureBoneData::new(torso_mat * l_hand_mat), FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()), FigureBoneData::new(torso_mat * self.l_foot.compute_base_matrix()), FigureBoneData::new(torso_mat * self.r_foot.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * self.weapon.compute_base_matrix()), + FigureBoneData::new(torso_mat * chest_mat * self.l_shoulder.compute_base_matrix()), + FigureBoneData::new(torso_mat * chest_mat * self.r_shoulder.compute_base_matrix()), FigureBoneData::new(torso_mat), - //FigureBoneData::new(torso_mat * self.l_shoulder.compute_base_matrix()), - //FigureBoneData::new(torso_mat * self.r_shoulder.compute_base_matrix()), - FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), + FigureBoneData::new(torso_mat * l_hand_mat * self.draw.compute_base_matrix()), FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), @@ -85,8 +86,9 @@ impl Skeleton for CharacterSkeleton { self.l_foot.interpolate(&target.l_foot); self.r_foot.interpolate(&target.r_foot); self.weapon.interpolate(&target.weapon); - self.torso.interpolate(&target.torso); self.l_shoulder.interpolate(&target.l_shoulder); self.r_shoulder.interpolate(&target.r_shoulder); + self.torso.interpolate(&target.torso); + self.draw.interpolate(&target.draw); } } diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index e6f2f6a8c0..b79751c20b 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -28,27 +28,27 @@ impl Animation for RunAnimation { let wavecos_slow = (anim_time as f32 * 8.0 + PI).cos(); let wave_dip = (wave_slow.abs() - 0.5).abs(); - next.head.offset = Vec3::new(5.5, 2.0, 12.0 + wavecos * 1.3); + next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wavecos * 1.3); next.head.ori = Quaternion::rotation_x(0.15); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(5.5, 0.0, 8.0 + wavecos * 1.1); + next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wavecos * 1.1); next.chest.ori = Quaternion::rotation_z(wave * 0.1); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(5.5, 0.0, 6.0 + wavecos * 1.1); + next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + wavecos * 1.1); next.belt.ori = Quaternion::rotation_z(wave * 0.25); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(5.5, 0.0, 3.0 + wavecos * 1.1); + next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + wavecos * 1.1); next.shorts.ori = Quaternion::rotation_z(wave * 0.6); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-7.5, -2.0 + wavecos * 2.5, 12.0 - wave * 1.5); + next.l_hand.offset = Vec3::new(-6.0, 0.0 + wavecos * 2.5, 11.0 - wave * 1.5); next.l_hand.ori = Quaternion::rotation_x(wavecos * 0.9); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(7.5, -2.0 - wavecos * 2.5, 12.0 + wave * 1.5); + next.r_hand.offset = Vec3::new(9.0, 0.0 - wavecos * 2.5, 11.0 + wave * 1.5); next.r_hand.ori = Quaternion::rotation_x(wavecos * -0.9); next.r_hand.scale = Vec3::one(); @@ -60,21 +60,24 @@ impl Animation for RunAnimation { next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave * 1.5); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 19.0); + next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); - next.torso.offset = Vec3::new(-0.5, -0.2, 0.2); + next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.scale = Vec3::one(); + + next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.scale = Vec3::one(); + next.torso.offset = Vec3::new(-0.5, -0.2, 0.4); next.torso.ori = Quaternion::rotation_x(-velocity * 0.05 - wavecos * 0.1); next.torso.scale = Vec3::one() / 11.0; - next.l_shoulder.offset = Vec3::new(3.0, 6.0, 18.0); - next.l_shoulder.ori = Quaternion::rotation_y(0.0); - next.l_shoulder.scale = Vec3::one(); - - next.r_shoulder.offset = Vec3::new(3.0, -6.0, 18.0); - next.r_shoulder.ori = Quaternion::rotation_y(0.0); - next.r_shoulder.scale = Vec3::one(); + next.draw.offset = Vec3::new(0.0, 1.0, -8.0); + next.draw.ori = Quaternion::rotation_y(-0.2); + next.draw.scale = Vec3::one(); next } diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index dae5f79f57..ee363764dc 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -14,7 +14,7 @@ use common::{ assets, comp::{ self, - character::{Belt, Character, Chest, Foot, Hand, Head, Pants, Weapon}, + character::{Belt, Character, Chest, Draw, Foot, Hand, Head, Pants, Shoulder, Weapon}, }, figure::Segment, msg, @@ -60,8 +60,9 @@ impl FigureModelCache { Some(Self::load_left_foot(character.foot)), Some(Self::load_right_foot(character.foot)), Some(Self::load_weapon(character.weapon)), - None, - None, + Some(Self::load_left_shoulder(character.shoulder)), + Some(Self::load_right_shoulder(character.shoulder)), + //Some(Self::load_draw(character.draw)), None, None, None, @@ -145,7 +146,7 @@ impl FigureModelCache { match hand { Hand::DefaultHand => "hand.vox", }, - Vec3::new(3.5, 0.0, -7.0), + Vec3::new(2.0, 0.0, -7.0), ) } @@ -154,7 +155,7 @@ impl FigureModelCache { match hand { Hand::DefaultHand => "hand.vox", }, - Vec3::new(3.5, 0.0, -7.0), + Vec3::new(2.0, 0.0, -7.0), ) } @@ -186,6 +187,35 @@ impl FigureModelCache { Vec3::new(0.0, 0.0, -4.0), ) } + + fn load_left_shoulder(shoulder: Shoulder) -> Mesh<FigurePipeline> { + Self::load_mesh( + match shoulder { + Shoulder::DefaultShoulder => "shoulder_l.vox", + }, + Vec3::new(2.5, 0.0, 0.0), + ) + } + + fn load_right_shoulder(shoulder: Shoulder) -> Mesh<FigurePipeline> { + Self::load_mesh( + match shoulder { + Shoulder::DefaultShoulder => "shoulder_r.vox", + }, + Vec3::new(2.5, 0.0, 0.0), + ) + } + // fn load_draw(draw: Draw) -> Mesh<FigurePipeline> { + // Self::load_mesh( + // match draw { + // //Draw::DefaultDraw => "sword.vox", + // + // }, + // Vec3::new(0.0, 0.0, -2.0) + // + // + // ) + // } } pub struct FigureMgr {