diff --git a/voxygen/src/anim/src/biped_large/idle.rs b/voxygen/src/anim/src/biped_large/idle.rs index d240811ace..4caa2d07c9 100644 --- a/voxygen/src/anim/src/biped_large/idle.rs +++ b/voxygen/src/anim/src/biped_large/idle.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + BipedLargeSkeleton, SkeletonAttr, +}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/biped_large/jump.rs b/voxygen/src/anim/src/biped_large/jump.rs index 650db18ffb..4883686028 100644 --- a/voxygen/src/anim/src/biped_large/jump.rs +++ b/voxygen/src/anim/src/biped_large/jump.rs @@ -1,6 +1,6 @@ use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr}; //use std::f32::consts::PI; -use vek::*; +use super::super::vek::*; pub struct JumpAnimation; diff --git a/voxygen/src/anim/src/biped_large/mod.rs b/voxygen/src/anim/src/biped_large/mod.rs index e3f9432623..9262474e90 100644 --- a/voxygen/src/anim/src/biped_large/mod.rs +++ b/voxygen/src/anim/src/biped_large/mod.rs @@ -8,9 +8,8 @@ pub use self::{ idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, wield::WieldAnimation, }; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone, Default)] pub struct BipedLargeSkeleton { diff --git a/voxygen/src/anim/src/biped_large/run.rs b/voxygen/src/anim/src/biped_large/run.rs index ac33aa2fb9..71a1eab78e 100644 --- a/voxygen/src/anim/src/biped_large/run.rs +++ b/voxygen/src/anim/src/biped_large/run.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + BipedLargeSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct RunAnimation; diff --git a/voxygen/src/anim/src/biped_large/wield.rs b/voxygen/src/anim/src/biped_large/wield.rs index 4edd995536..1b35ce4a9c 100644 --- a/voxygen/src/anim/src/biped_large/wield.rs +++ b/voxygen/src/anim/src/biped_large/wield.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + BipedLargeSkeleton, SkeletonAttr, +}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct WieldAnimation; diff --git a/voxygen/src/anim/src/bird_medium/feed.rs b/voxygen/src/anim/src/bird_medium/feed.rs index a5ca080177..50e24e68ff 100644 --- a/voxygen/src/anim/src/bird_medium/feed.rs +++ b/voxygen/src/anim/src/bird_medium/feed.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + BirdMediumSkeleton, SkeletonAttr, +}; use std::ops::Mul; -use vek::*; pub struct FeedAnimation; diff --git a/voxygen/src/anim/src/bird_medium/fly.rs b/voxygen/src/anim/src/bird_medium/fly.rs index 23477c3671..56465cd141 100644 --- a/voxygen/src/anim/src/bird_medium/fly.rs +++ b/voxygen/src/anim/src/bird_medium/fly.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + BirdMediumSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct FlyAnimation; diff --git a/voxygen/src/anim/src/bird_medium/idle.rs b/voxygen/src/anim/src/bird_medium/idle.rs index 33b430636b..b117620db5 100644 --- a/voxygen/src/anim/src/bird_medium/idle.rs +++ b/voxygen/src/anim/src/bird_medium/idle.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + BirdMediumSkeleton, SkeletonAttr, +}; use std::ops::Mul; -use vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/bird_medium/mod.rs b/voxygen/src/anim/src/bird_medium/mod.rs index fddd7dfa07..485640e3dc 100644 --- a/voxygen/src/anim/src/bird_medium/mod.rs +++ b/voxygen/src/anim/src/bird_medium/mod.rs @@ -6,9 +6,8 @@ pub mod run; // Reexports pub use self::{feed::FeedAnimation, fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation}; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone, Default)] pub struct BirdMediumSkeleton { diff --git a/voxygen/src/anim/src/bird_medium/run.rs b/voxygen/src/anim/src/bird_medium/run.rs index c86f16a86b..ff078f7b00 100644 --- a/voxygen/src/anim/src/bird_medium/run.rs +++ b/voxygen/src/anim/src/bird_medium/run.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + BirdMediumSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct RunAnimation; diff --git a/voxygen/src/anim/src/bird_small/idle.rs b/voxygen/src/anim/src/bird_small/idle.rs index f25b9a8810..d7a8d94319 100644 --- a/voxygen/src/anim/src/bird_small/idle.rs +++ b/voxygen/src/anim/src/bird_small/idle.rs @@ -1,6 +1,6 @@ use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr}; //use std::{f32::consts::PI, ops::Mul}; -use vek::*; +use super::super::vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/bird_small/jump.rs b/voxygen/src/anim/src/bird_small/jump.rs index 059480cc4a..925330ce42 100644 --- a/voxygen/src/anim/src/bird_small/jump.rs +++ b/voxygen/src/anim/src/bird_small/jump.rs @@ -1,6 +1,6 @@ use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr}; //use std::f32::consts::PI; -use vek::*; +use super::super::vek::*; pub struct JumpAnimation; diff --git a/voxygen/src/anim/src/bird_small/mod.rs b/voxygen/src/anim/src/bird_small/mod.rs index dde8a69b6f..5c5fe028ca 100644 --- a/voxygen/src/anim/src/bird_small/mod.rs +++ b/voxygen/src/anim/src/bird_small/mod.rs @@ -5,9 +5,8 @@ pub mod run; // Reexports pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation}; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone)] pub struct BirdSmallSkeleton { diff --git a/voxygen/src/anim/src/bird_small/run.rs b/voxygen/src/anim/src/bird_small/run.rs index 167889c0d0..f27d70e48e 100644 --- a/voxygen/src/anim/src/bird_small/run.rs +++ b/voxygen/src/anim/src/bird_small/run.rs @@ -1,6 +1,6 @@ use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr}; //use std::{f32::consts::PI, ops::Mul}; -use vek::*; +use super::super::vek::*; pub struct RunAnimation; diff --git a/voxygen/src/anim/src/character/alpha.rs b/voxygen/src/anim/src/character/alpha.rs index dcf8507717..f118e4b6df 100644 --- a/voxygen/src/anim/src/character/alpha.rs +++ b/voxygen/src/anim/src/character/alpha.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; -use vek::*; pub struct AlphaAnimation; diff --git a/voxygen/src/anim/src/character/beta.rs b/voxygen/src/anim/src/character/beta.rs index bfa3466638..a64ee73b83 100644 --- a/voxygen/src/anim/src/character/beta.rs +++ b/voxygen/src/anim/src/character/beta.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; -use vek::*; pub struct BetaAnimation; diff --git a/voxygen/src/anim/src/character/block.rs b/voxygen/src/anim/src/character/block.rs index b215071cd8..6316ae70b7 100644 --- a/voxygen/src/anim/src/character/block.rs +++ b/voxygen/src/anim/src/character/block.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct Input { pub attack: bool, diff --git a/voxygen/src/anim/src/character/blockidle.rs b/voxygen/src/anim/src/character/blockidle.rs index a08717f268..f0840c0370 100644 --- a/voxygen/src/anim/src/character/blockidle.rs +++ b/voxygen/src/anim/src/character/blockidle.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct Input { pub attack: bool, diff --git a/voxygen/src/anim/src/character/charge.rs b/voxygen/src/anim/src/character/charge.rs index 11dd3568bb..4f8f1321f7 100644 --- a/voxygen/src/anim/src/character/charge.rs +++ b/voxygen/src/anim/src/character/charge.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; -use vek::*; pub struct ChargeAnimation; @@ -62,7 +64,7 @@ impl Animation for ChargeAnimation { let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/character/climb.rs b/voxygen/src/anim/src/character/climb.rs index 47257ed641..9a159d5aca 100644 --- a/voxygen/src/anim/src/character/climb.rs +++ b/voxygen/src/anim/src/character/climb.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; -use vek::*; pub struct ClimbAnimation; diff --git a/voxygen/src/anim/src/character/dance.rs b/voxygen/src/anim/src/character/dance.rs index a79e16ad9d..a8cbfb3e7a 100644 --- a/voxygen/src/anim/src/character/dance.rs +++ b/voxygen/src/anim/src/character/dance.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct DanceAnimation; diff --git a/voxygen/src/anim/src/character/dash.rs b/voxygen/src/anim/src/character/dash.rs index 4f6f73e431..0e8d5d4e0c 100644 --- a/voxygen/src/anim/src/character/dash.rs +++ b/voxygen/src/anim/src/character/dash.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; -use vek::*; pub struct Input { pub attack: bool, diff --git a/voxygen/src/anim/src/character/equip.rs b/voxygen/src/anim/src/character/equip.rs index df02fc16e5..259a7b6511 100644 --- a/voxygen/src/anim/src/character/equip.rs +++ b/voxygen/src/anim/src/character/equip.rs @@ -2,7 +2,7 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; +use super::super::vek::*; pub struct EquipAnimation; diff --git a/voxygen/src/anim/src/character/glidewield.rs b/voxygen/src/anim/src/character/glidewield.rs index 6dfb6dbfb6..533c475f88 100644 --- a/voxygen/src/anim/src/character/glidewield.rs +++ b/voxygen/src/anim/src/character/glidewield.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct GlideWieldAnimation; @@ -96,7 +98,7 @@ impl Animation for GlideWieldAnimation { let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/character/gliding.rs b/voxygen/src/anim/src/character/gliding.rs index 27d8d3a6f6..936a36fddb 100644 --- a/voxygen/src/anim/src/character/gliding.rs +++ b/voxygen/src/anim/src/character/gliding.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct GlidingAnimation; @@ -56,7 +58,7 @@ impl Animation for GlidingAnimation { let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.0001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/character/idle.rs b/voxygen/src/anim/src/character/idle.rs index 7933f4a18a..56eb10ba0d 100644 --- a/voxygen/src/anim/src/character/idle.rs +++ b/voxygen/src/anim/src/character/idle.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; -use vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/character/jump.rs b/voxygen/src/anim/src/character/jump.rs index b00ab37dfe..94591876ea 100644 --- a/voxygen/src/anim/src/character/jump.rs +++ b/voxygen/src/anim/src/character/jump.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; -use vek::*; pub struct JumpAnimation; impl Animation for JumpAnimation { @@ -41,7 +43,7 @@ impl Animation for JumpAnimation { let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/character/leapmelee.rs b/voxygen/src/anim/src/character/leapmelee.rs index 4c9aca309d..cd3aeacbcc 100644 --- a/voxygen/src/anim/src/character/leapmelee.rs +++ b/voxygen/src/anim/src/character/leapmelee.rs @@ -1,7 +1,7 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; use common::comp::item::{Hands, ToolKind}; /* use std::f32::consts::PI; */ -use vek::*; +use super::super::vek::*; pub struct LeapAnimation; diff --git a/voxygen/src/anim/src/character/mod.rs b/voxygen/src/anim/src/character/mod.rs index f3440fa3ed..f4ae26778f 100644 --- a/voxygen/src/anim/src/character/mod.rs +++ b/voxygen/src/anim/src/character/mod.rs @@ -33,9 +33,11 @@ pub use self::{ stand::StandAnimation, swim::SwimAnimation, wield::WieldAnimation, }; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{ + vek::{Vec3, Vec4}, + Bone, FigureBoneData, Skeleton, +}; use common::comp; -use vek::{Vec3, Vec4}; #[derive(Clone, Default)] pub struct CharacterSkeleton { diff --git a/voxygen/src/anim/src/character/roll.rs b/voxygen/src/anim/src/character/roll.rs index f5eaf819f3..133bedabb4 100644 --- a/voxygen/src/anim/src/character/roll.rs +++ b/voxygen/src/anim/src/character/roll.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; -use vek::*; pub struct RollAnimation; @@ -33,7 +35,7 @@ impl Animation for RollAnimation { let spin = anim_time as f32; let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.0001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/character/run.rs b/voxygen/src/anim/src/character/run.rs index f85f1ca477..427738ad74 100644 --- a/voxygen/src/anim/src/character/run.rs +++ b/voxygen/src/anim/src/character/run.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct RunAnimation; @@ -98,7 +100,7 @@ impl Animation for RunAnimation { let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/character/shoot.rs b/voxygen/src/anim/src/character/shoot.rs index 9184ab99f5..daadf2d16d 100644 --- a/voxygen/src/anim/src/character/shoot.rs +++ b/voxygen/src/anim/src/character/shoot.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; -use vek::*; pub struct ShootAnimation; diff --git a/voxygen/src/anim/src/character/sit.rs b/voxygen/src/anim/src/character/sit.rs index 268e7e8dd7..873ea8332c 100644 --- a/voxygen/src/anim/src/character/sit.rs +++ b/voxygen/src/anim/src/character/sit.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct SitAnimation; diff --git a/voxygen/src/anim/src/character/spin.rs b/voxygen/src/anim/src/character/spin.rs index 5c8efb2c4e..23a465d74e 100644 --- a/voxygen/src/anim/src/character/spin.rs +++ b/voxygen/src/anim/src/character/spin.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; -use vek::*; pub struct Input { pub attack: bool, diff --git a/voxygen/src/anim/src/character/spinmelee.rs b/voxygen/src/anim/src/character/spinmelee.rs index 949b549482..d9ffd4a93c 100644 --- a/voxygen/src/anim/src/character/spinmelee.rs +++ b/voxygen/src/anim/src/character/spinmelee.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::f32::consts::PI; -use vek::*; pub struct SpinMeleeAnimation; diff --git a/voxygen/src/anim/src/character/stand.rs b/voxygen/src/anim/src/character/stand.rs index bfa97846b3..5d3d702d54 100644 --- a/voxygen/src/anim/src/character/stand.rs +++ b/voxygen/src/anim/src/character/stand.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct StandAnimation; diff --git a/voxygen/src/anim/src/character/swim.rs b/voxygen/src/anim/src/character/swim.rs index e7e23023ae..2a345bf5ac 100644 --- a/voxygen/src/anim/src/character/swim.rs +++ b/voxygen/src/anim/src/character/swim.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct SwimAnimation; @@ -59,7 +61,7 @@ impl Animation for SwimAnimation { ); let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/character/wield.rs b/voxygen/src/anim/src/character/wield.rs index 0251f9bb8f..ed8a0401e4 100644 --- a/voxygen/src/anim/src/character/wield.rs +++ b/voxygen/src/anim/src/character/wield.rs @@ -1,7 +1,9 @@ -use super::{super::Animation, CharacterSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + CharacterSkeleton, SkeletonAttr, +}; use common::comp::item::{Hands, ToolKind}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct WieldAnimation; diff --git a/voxygen/src/anim/src/critter/idle.rs b/voxygen/src/anim/src/critter/idle.rs index 22708a480d..89b1531cff 100644 --- a/voxygen/src/anim/src/critter/idle.rs +++ b/voxygen/src/anim/src/critter/idle.rs @@ -1,7 +1,7 @@ use super::{super::Animation, CritterAttr, CritterSkeleton}; //use std::{f32::consts::PI, ops::Mul}; +use super::super::vek::*; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/critter/jump.rs b/voxygen/src/anim/src/critter/jump.rs index 8279d321bb..d872a43ba9 100644 --- a/voxygen/src/anim/src/critter/jump.rs +++ b/voxygen/src/anim/src/critter/jump.rs @@ -1,6 +1,6 @@ use super::{super::Animation, CritterAttr, CritterSkeleton}; //use std::f32::consts::PI; -use vek::*; +use super::super::vek::*; pub struct JumpAnimation; diff --git a/voxygen/src/anim/src/critter/mod.rs b/voxygen/src/anim/src/critter/mod.rs index 2fe638803e..167967b613 100644 --- a/voxygen/src/anim/src/critter/mod.rs +++ b/voxygen/src/anim/src/critter/mod.rs @@ -5,9 +5,8 @@ pub mod run; // Reexports pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation}; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone, Default)] pub struct CritterSkeleton { diff --git a/voxygen/src/anim/src/critter/run.rs b/voxygen/src/anim/src/critter/run.rs index 120277f76b..57c099098b 100644 --- a/voxygen/src/anim/src/critter/run.rs +++ b/voxygen/src/anim/src/critter/run.rs @@ -1,7 +1,7 @@ use super::{super::Animation, CritterAttr, CritterSkeleton}; //use std::{f32::consts::PI, ops::Mul}; +use super::super::vek::*; use std::f32::consts::PI; -use vek::*; pub struct RunAnimation; diff --git a/voxygen/src/anim/src/dragon/fly.rs b/voxygen/src/anim/src/dragon/fly.rs index 14379e7a42..56918b25b3 100644 --- a/voxygen/src/anim/src/dragon/fly.rs +++ b/voxygen/src/anim/src/dragon/fly.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, DragonSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + DragonSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct FlyAnimation; diff --git a/voxygen/src/anim/src/dragon/idle.rs b/voxygen/src/anim/src/dragon/idle.rs index b61f87fbc4..874b5834bd 100644 --- a/voxygen/src/anim/src/dragon/idle.rs +++ b/voxygen/src/anim/src/dragon/idle.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, DragonSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + DragonSkeleton, SkeletonAttr, +}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/dragon/mod.rs b/voxygen/src/anim/src/dragon/mod.rs index 5a4ec4bbf5..8468b8a9a3 100644 --- a/voxygen/src/anim/src/dragon/mod.rs +++ b/voxygen/src/anim/src/dragon/mod.rs @@ -5,9 +5,8 @@ pub mod run; // Reexports pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation}; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone, Default)] pub struct DragonSkeleton { diff --git a/voxygen/src/anim/src/dragon/run.rs b/voxygen/src/anim/src/dragon/run.rs index 49f42dcf12..7ca126782e 100644 --- a/voxygen/src/anim/src/dragon/run.rs +++ b/voxygen/src/anim/src/dragon/run.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, DragonSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + DragonSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct RunAnimation; @@ -37,7 +39,7 @@ impl Animation for RunAnimation { // let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/fish_medium/idle.rs b/voxygen/src/anim/src/fish_medium/idle.rs index a61c284abd..06f72e0651 100644 --- a/voxygen/src/anim/src/fish_medium/idle.rs +++ b/voxygen/src/anim/src/fish_medium/idle.rs @@ -1,6 +1,6 @@ use super::{super::Animation, FishMediumSkeleton, SkeletonAttr}; //use std::{f32::consts::PI, ops::Mul}; -use vek::*; +use super::super::vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/fish_medium/jump.rs b/voxygen/src/anim/src/fish_medium/jump.rs index 2858c2ba23..f86760ef3d 100644 --- a/voxygen/src/anim/src/fish_medium/jump.rs +++ b/voxygen/src/anim/src/fish_medium/jump.rs @@ -1,6 +1,6 @@ use super::{super::Animation, FishMediumSkeleton, SkeletonAttr}; //use std::f32::consts::PI; -use vek::*; +use super::super::vek::*; pub struct JumpAnimation; diff --git a/voxygen/src/anim/src/fish_medium/mod.rs b/voxygen/src/anim/src/fish_medium/mod.rs index 7e3741d4c5..988b58bee1 100644 --- a/voxygen/src/anim/src/fish_medium/mod.rs +++ b/voxygen/src/anim/src/fish_medium/mod.rs @@ -5,9 +5,8 @@ pub mod run; // Reexports pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation}; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone)] pub struct FishMediumSkeleton { diff --git a/voxygen/src/anim/src/fish_medium/run.rs b/voxygen/src/anim/src/fish_medium/run.rs index 47219f1b31..05cd767a2d 100644 --- a/voxygen/src/anim/src/fish_medium/run.rs +++ b/voxygen/src/anim/src/fish_medium/run.rs @@ -1,6 +1,6 @@ use super::{super::Animation, FishMediumSkeleton, SkeletonAttr}; //use std::f32::consts::PI; -use vek::*; +use super::super::vek::*; pub struct RunAnimation; diff --git a/voxygen/src/anim/src/fish_small/idle.rs b/voxygen/src/anim/src/fish_small/idle.rs index 4262a42db9..b6cba63250 100644 --- a/voxygen/src/anim/src/fish_small/idle.rs +++ b/voxygen/src/anim/src/fish_small/idle.rs @@ -1,6 +1,6 @@ use super::{super::Animation, FishSmallSkeleton, SkeletonAttr}; //use std::{f32::consts::PI, ops::Mul}; -use vek::*; +use super::super::vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/fish_small/jump.rs b/voxygen/src/anim/src/fish_small/jump.rs index 90bca46ade..5a7acaaac6 100644 --- a/voxygen/src/anim/src/fish_small/jump.rs +++ b/voxygen/src/anim/src/fish_small/jump.rs @@ -1,6 +1,6 @@ use super::{super::Animation, FishSmallSkeleton, SkeletonAttr}; //use std::f32::consts::PI; -use vek::*; +use super::super::vek::*; pub struct JumpAnimation; diff --git a/voxygen/src/anim/src/fish_small/mod.rs b/voxygen/src/anim/src/fish_small/mod.rs index 7821d8b446..8c8eb9248c 100644 --- a/voxygen/src/anim/src/fish_small/mod.rs +++ b/voxygen/src/anim/src/fish_small/mod.rs @@ -5,9 +5,8 @@ pub mod run; // Reexports pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation}; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone)] pub struct FishSmallSkeleton { diff --git a/voxygen/src/anim/src/fish_small/run.rs b/voxygen/src/anim/src/fish_small/run.rs index 8e93a3ae7c..bd0fa55024 100644 --- a/voxygen/src/anim/src/fish_small/run.rs +++ b/voxygen/src/anim/src/fish_small/run.rs @@ -1,6 +1,6 @@ use super::{super::Animation, FishSmallSkeleton, SkeletonAttr}; //use std::{f32::consts::PI, ops::Mul}; -use vek::*; +use super::super::vek::*; pub struct RunAnimation; diff --git a/voxygen/src/anim/src/fixture/mod.rs b/voxygen/src/anim/src/fixture/mod.rs index 40fe3095fc..fbede358b5 100644 --- a/voxygen/src/anim/src/fixture/mod.rs +++ b/voxygen/src/anim/src/fixture/mod.rs @@ -1,5 +1,7 @@ -use super::{FigureBoneData, Skeleton}; -use vek::Vec3; +use super::{ + vek::{Mat4, Vec3}, + FigureBoneData, Skeleton, +}; #[derive(Clone)] pub struct FixtureSkeleton; @@ -24,22 +26,22 @@ impl Skeleton for FixtureSkeleton { fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3) { ( [ - FigureBoneData::new(vek::Mat4::identity()), // <-- This is actually a bone! - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), + FigureBoneData::new(Mat4::identity()), // <-- This is actually a bone! + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), ], Vec3::default(), ) diff --git a/voxygen/src/anim/src/golem/idle.rs b/voxygen/src/anim/src/golem/idle.rs index cbdfe7b05e..dc20071758 100644 --- a/voxygen/src/anim/src/golem/idle.rs +++ b/voxygen/src/anim/src/golem/idle.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, GolemSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + GolemSkeleton, SkeletonAttr, +}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/golem/jump.rs b/voxygen/src/anim/src/golem/jump.rs index ac294f59dc..b9c834a04d 100644 --- a/voxygen/src/anim/src/golem/jump.rs +++ b/voxygen/src/anim/src/golem/jump.rs @@ -1,6 +1,6 @@ use super::{super::Animation, GolemSkeleton, SkeletonAttr}; //use std::f32::consts::PI; -use vek::*; +use super::super::vek::*; pub struct JumpAnimation; diff --git a/voxygen/src/anim/src/golem/mod.rs b/voxygen/src/anim/src/golem/mod.rs index 5bd5861d1b..1a75152815 100644 --- a/voxygen/src/anim/src/golem/mod.rs +++ b/voxygen/src/anim/src/golem/mod.rs @@ -5,9 +5,8 @@ pub mod run; // Reexports pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation}; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone, Default)] pub struct GolemSkeleton { diff --git a/voxygen/src/anim/src/golem/run.rs b/voxygen/src/anim/src/golem/run.rs index c5d1c0f6ec..31e24f001d 100644 --- a/voxygen/src/anim/src/golem/run.rs +++ b/voxygen/src/anim/src/golem/run.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, GolemSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + GolemSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct RunAnimation; diff --git a/voxygen/src/anim/src/lib.rs b/voxygen/src/anim/src/lib.rs index b697eb89f4..c3711a883b 100644 --- a/voxygen/src/anim/src/lib.rs +++ b/voxygen/src/anim/src/lib.rs @@ -16,13 +16,15 @@ pub mod object; pub mod quadruped_low; pub mod quadruped_medium; pub mod quadruped_small; +pub mod vek; #[cfg(feature = "use-dyn-lib")] pub use dyn_lib::init; #[cfg(feature = "use-dyn-lib")] use std::ffi::CStr; -use vek::*; + +use self::vek::*; // TODO: replace with inner type everywhere pub struct FigureBoneData(pub Mat4); diff --git a/voxygen/src/anim/src/object/mod.rs b/voxygen/src/anim/src/object/mod.rs index 398e6d80be..6088fb9f37 100644 --- a/voxygen/src/anim/src/object/mod.rs +++ b/voxygen/src/anim/src/object/mod.rs @@ -1,5 +1,4 @@ -use super::{FigureBoneData, Skeleton}; -use vek::*; +use super::{vek::*, FigureBoneData, Skeleton}; #[derive(Clone)] pub struct ObjectSkeleton; @@ -25,21 +24,21 @@ impl Skeleton for ObjectSkeleton { ( [ FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), - FigureBoneData::new(vek::Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), + FigureBoneData::new(Mat4::identity()), ], Vec3::default(), ) diff --git a/voxygen/src/anim/src/quadruped_low/alpha.rs b/voxygen/src/anim/src/quadruped_low/alpha.rs index 0e60916168..f339b4c7c4 100644 --- a/voxygen/src/anim/src/quadruped_low/alpha.rs +++ b/voxygen/src/anim/src/quadruped_low/alpha.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + QuadrupedLowSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct AlphaAnimation; diff --git a/voxygen/src/anim/src/quadruped_low/idle.rs b/voxygen/src/anim/src/quadruped_low/idle.rs index 1a7ef52347..70fdb57460 100644 --- a/voxygen/src/anim/src/quadruped_low/idle.rs +++ b/voxygen/src/anim/src/quadruped_low/idle.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + QuadrupedLowSkeleton, SkeletonAttr, +}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/quadruped_low/jump.rs b/voxygen/src/anim/src/quadruped_low/jump.rs index ba851f9a52..f5a1805e0d 100644 --- a/voxygen/src/anim/src/quadruped_low/jump.rs +++ b/voxygen/src/anim/src/quadruped_low/jump.rs @@ -1,5 +1,7 @@ -use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr}; -use vek::*; +use super::{ + super::{vek::*, Animation}, + QuadrupedLowSkeleton, SkeletonAttr, +}; pub struct JumpAnimation; diff --git a/voxygen/src/anim/src/quadruped_low/mod.rs b/voxygen/src/anim/src/quadruped_low/mod.rs index 577ce0acac..5813d3d359 100644 --- a/voxygen/src/anim/src/quadruped_low/mod.rs +++ b/voxygen/src/anim/src/quadruped_low/mod.rs @@ -8,9 +8,8 @@ pub use self::{ alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, }; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone, Default)] pub struct QuadrupedLowSkeleton { diff --git a/voxygen/src/anim/src/quadruped_low/run.rs b/voxygen/src/anim/src/quadruped_low/run.rs index a71979ee24..b862bd82e8 100644 --- a/voxygen/src/anim/src/quadruped_low/run.rs +++ b/voxygen/src/anim/src/quadruped_low/run.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + QuadrupedLowSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct RunAnimation; @@ -72,7 +74,7 @@ impl Animation for RunAnimation { let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/quadruped_medium/alpha.rs b/voxygen/src/anim/src/quadruped_medium/alpha.rs index 80df941140..9a7978b194 100644 --- a/voxygen/src/anim/src/quadruped_medium/alpha.rs +++ b/voxygen/src/anim/src/quadruped_medium/alpha.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + QuadrupedMediumSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct AlphaAnimation; diff --git a/voxygen/src/anim/src/quadruped_medium/idle.rs b/voxygen/src/anim/src/quadruped_medium/idle.rs index b41ebcc636..846187c1e1 100644 --- a/voxygen/src/anim/src/quadruped_medium/idle.rs +++ b/voxygen/src/anim/src/quadruped_medium/idle.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + QuadrupedMediumSkeleton, SkeletonAttr, +}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/quadruped_medium/jump.rs b/voxygen/src/anim/src/quadruped_medium/jump.rs index eb8647aecc..7f79daab99 100644 --- a/voxygen/src/anim/src/quadruped_medium/jump.rs +++ b/voxygen/src/anim/src/quadruped_medium/jump.rs @@ -1,5 +1,7 @@ -use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr}; -use vek::*; +use super::{ + super::{vek::*, Animation}, + QuadrupedMediumSkeleton, SkeletonAttr, +}; pub struct JumpAnimation; diff --git a/voxygen/src/anim/src/quadruped_medium/mod.rs b/voxygen/src/anim/src/quadruped_medium/mod.rs index d78069b986..bfcc29eaee 100644 --- a/voxygen/src/anim/src/quadruped_medium/mod.rs +++ b/voxygen/src/anim/src/quadruped_medium/mod.rs @@ -8,9 +8,8 @@ pub use self::{ alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, }; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone, Default)] pub struct QuadrupedMediumSkeleton { diff --git a/voxygen/src/anim/src/quadruped_medium/run.rs b/voxygen/src/anim/src/quadruped_medium/run.rs index 5dadddf37d..0f3f71acf6 100644 --- a/voxygen/src/anim/src/quadruped_medium/run.rs +++ b/voxygen/src/anim/src/quadruped_medium/run.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + QuadrupedMediumSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct RunAnimation; @@ -59,7 +61,7 @@ impl Animation for RunAnimation { // let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if ::vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/anim/src/quadruped_small/feed.rs b/voxygen/src/anim/src/quadruped_small/feed.rs index aa4de97cb3..14ba0ce77d 100644 --- a/voxygen/src/anim/src/quadruped_small/feed.rs +++ b/voxygen/src/anim/src/quadruped_small/feed.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + QuadrupedSmallSkeleton, SkeletonAttr, +}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct FeedAnimation; diff --git a/voxygen/src/anim/src/quadruped_small/idle.rs b/voxygen/src/anim/src/quadruped_small/idle.rs index d32c14a128..4a8aa427b6 100644 --- a/voxygen/src/anim/src/quadruped_small/idle.rs +++ b/voxygen/src/anim/src/quadruped_small/idle.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + QuadrupedSmallSkeleton, SkeletonAttr, +}; use std::{f32::consts::PI, ops::Mul}; -use vek::*; pub struct IdleAnimation; diff --git a/voxygen/src/anim/src/quadruped_small/jump.rs b/voxygen/src/anim/src/quadruped_small/jump.rs index a8395ac958..3772fb1244 100644 --- a/voxygen/src/anim/src/quadruped_small/jump.rs +++ b/voxygen/src/anim/src/quadruped_small/jump.rs @@ -1,5 +1,7 @@ -use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr}; -use vek::*; +use super::{ + super::{vek::*, Animation}, + QuadrupedSmallSkeleton, SkeletonAttr, +}; pub struct JumpAnimation; diff --git a/voxygen/src/anim/src/quadruped_small/mod.rs b/voxygen/src/anim/src/quadruped_small/mod.rs index 0c19fc6ed2..2effc88233 100644 --- a/voxygen/src/anim/src/quadruped_small/mod.rs +++ b/voxygen/src/anim/src/quadruped_small/mod.rs @@ -6,9 +6,8 @@ pub mod run; // Reexports pub use self::{feed::FeedAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation}; -use super::{Bone, FigureBoneData, Skeleton}; +use super::{vek::Vec3, Bone, FigureBoneData, Skeleton}; use common::comp::{self}; -use vek::Vec3; #[derive(Clone, Default)] pub struct QuadrupedSmallSkeleton { diff --git a/voxygen/src/anim/src/quadruped_small/run.rs b/voxygen/src/anim/src/quadruped_small/run.rs index 09d14dedc0..974d9ce983 100644 --- a/voxygen/src/anim/src/quadruped_small/run.rs +++ b/voxygen/src/anim/src/quadruped_small/run.rs @@ -1,6 +1,8 @@ -use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr}; +use super::{ + super::{vek::*, Animation}, + QuadrupedSmallSkeleton, SkeletonAttr, +}; use std::f32::consts::PI; -use vek::*; pub struct RunAnimation; @@ -35,7 +37,7 @@ impl Animation for RunAnimation { let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); - let tilt = if Vec2::new(ori, last_ori) + let tilt = if vek::Vec2::new(ori, last_ori) .map(|o| o.magnitude_squared()) .map(|m| m > 0.001 && m.is_finite()) .reduce_and() diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 7fe9c4f3b7..e3d9e49efc 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -288,15 +288,15 @@ pub enum Event { UseSlot(comp::slot::Slot), SwapSlots(comp::slot::Slot, comp::slot::Slot), DropSlot(comp::slot::Slot), - ChangeHotbarState(HotbarState), + ChangeHotbarState(Box), Ability3(bool), Logout, Quit, - ChangeLanguage(LanguageMetadata), + ChangeLanguage(Box), ChangeBinding(GameInput), ResetBindings, ChangeFreeLookBehavior(PressBehavior), - ChangeRenderMode(RenderMode), + ChangeRenderMode(Box), ChangeAutoWalkBehavior(PressBehavior), ChangeStopAutoWalkOnInput(bool), CraftRecipe(String), @@ -2006,10 +2006,10 @@ impl Hud { events.push(Event::SwapSlots(a, b)); } else if let (Inventory(i), Hotbar(h)) = (a, b) { self.hotbar.add_inventory_link(h, i.0); - events.push(Event::ChangeHotbarState(self.hotbar.to_owned())); + events.push(Event::ChangeHotbarState(Box::new(self.hotbar.to_owned()))); } else if let (Hotbar(a), Hotbar(b)) = (a, b) { self.hotbar.swap(a, b); - events.push(Event::ChangeHotbarState(self.hotbar.to_owned())); + events.push(Event::ChangeHotbarState(Box::new(self.hotbar.to_owned()))); } }, slot::Event::Dropped(from) => { @@ -2018,7 +2018,7 @@ impl Hud { events.push(Event::DropSlot(from)); } else if let Hotbar(h) = from { self.hotbar.clear_slot(h); - events.push(Event::ChangeHotbarState(self.hotbar.to_owned())); + events.push(Event::ChangeHotbarState(Box::new(self.hotbar.to_owned()))); } }, slot::Event::Used(from) => { diff --git a/voxygen/src/hud/settings_window.rs b/voxygen/src/hud/settings_window.rs index a4722c4a0c..c14bb362c5 100644 --- a/voxygen/src/hud/settings_window.rs +++ b/voxygen/src/hud/settings_window.rs @@ -245,7 +245,7 @@ pub enum Event { AdjustGamma(f32), AdjustWindowSize([u16; 2]), ToggleFullscreen, - ChangeRenderMode(RenderMode), + ChangeRenderMode(Box), AdjustMusicVolume(f32), AdjustSfxVolume(f32), ChangeAudioDevice(String), @@ -260,7 +260,7 @@ pub enum Event { SctDamageBatch(bool), SpeechBubbleDarkMode(bool), SpeechBubbleIcon(bool), - ChangeLanguage(LanguageMetadata), + ChangeLanguage(Box), ChangeBinding(GameInput), ResetBindings, ChangeFreeLookBehavior(PressBehavior), @@ -1226,7 +1226,9 @@ impl<'a> Widget for SettingsWindow<'a> { .label_font_id(self.fonts.cyri.conrod_id) .set(state.ids.languages_list, ui) { - events.push(Event::ChangeLanguage(language_list[clicked].to_owned())); + events.push(Event::ChangeLanguage(Box::new( + language_list[clicked].to_owned(), + ))); } } @@ -1942,7 +1944,7 @@ impl<'a> Widget for SettingsWindow<'a> { .color(TEXT_COLOR) .set(state.ids.figure_dist_value, ui); - let render_mode = self.global_state.settings.graphics.render_mode; + let render_mode = &self.global_state.settings.graphics.render_mode; // AaMode Text::new(&self.localized_strings.get("hud.settings.antialiasing_mode")) @@ -1980,10 +1982,10 @@ impl<'a> Widget for SettingsWindow<'a> { .down_from(state.ids.aa_mode_text, 8.0) .set(state.ids.aa_mode_list, ui) { - events.push(Event::ChangeRenderMode(RenderMode { + events.push(Event::ChangeRenderMode(Box::new(RenderMode { aa: mode_list[clicked], - ..render_mode - })); + ..render_mode.clone() + }))); } // CloudMode @@ -2017,10 +2019,10 @@ impl<'a> Widget for SettingsWindow<'a> { .down_from(state.ids.cloud_mode_text, 8.0) .set(state.ids.cloud_mode_list, ui) { - events.push(Event::ChangeRenderMode(RenderMode { + events.push(Event::ChangeRenderMode(Box::new(RenderMode { cloud: mode_list[clicked], - ..render_mode - })); + ..render_mode.clone() + }))); } // FluidMode @@ -2056,10 +2058,10 @@ impl<'a> Widget for SettingsWindow<'a> { .down_from(state.ids.fluid_mode_text, 8.0) .set(state.ids.fluid_mode_list, ui) { - events.push(Event::ChangeRenderMode(RenderMode { + events.push(Event::ChangeRenderMode(Box::new(RenderMode { fluid: mode_list[clicked], - ..render_mode - })); + ..render_mode.clone() + }))); } // LightingMode @@ -2102,10 +2104,10 @@ impl<'a> Widget for SettingsWindow<'a> { .down_from(state.ids.lighting_mode_text, 8.0) .set(state.ids.lighting_mode_list, ui) { - events.push(Event::ChangeRenderMode(RenderMode { + events.push(Event::ChangeRenderMode(Box::new(RenderMode { lighting: mode_list[clicked], - ..render_mode - })); + ..render_mode.clone() + }))); } // ShadowMode @@ -2149,10 +2151,10 @@ impl<'a> Widget for SettingsWindow<'a> { .down_from(state.ids.shadow_mode_text, 8.0) .set(state.ids.shadow_mode_list, ui) { - events.push(Event::ChangeRenderMode(RenderMode { + events.push(Event::ChangeRenderMode(Box::new(RenderMode { shadow: mode_list[clicked], - ..render_mode - })); + ..render_mode.clone() + }))); } if let Some(shadow_map_mode) = shadow_map_mode { @@ -2182,12 +2184,12 @@ impl<'a> Widget for SettingsWindow<'a> { .pad_track((5.0, 5.0)) .set(state.ids.shadow_mode_map_resolution_slider, ui) { - events.push(Event::ChangeRenderMode(RenderMode { + events.push(Event::ChangeRenderMode(Box::new(RenderMode { shadow: ShadowMode::Map(ShadowMapMode { resolution: 2.0f32.powf(f32::from(new_val) / 4.0), }), - ..render_mode - })); + ..render_mode.clone() + }))); } // TODO: Consider fixing to avoid allocation (it's probably not a bottleneck but diff --git a/voxygen/src/render/mod.rs b/voxygen/src/render/mod.rs index 3162214d74..2a87702811 100644 --- a/voxygen/src/render/mod.rs +++ b/voxygen/src/render/mod.rs @@ -247,7 +247,7 @@ impl ShadowMode { } /// Render modes -#[derive(PartialEq, Clone, Copy, Debug, Default, Serialize, Deserialize)] +#[derive(PartialEq, Clone, Debug, Default, Serialize, Deserialize)] pub struct RenderMode { #[serde(default)] pub aa: AaMode, diff --git a/voxygen/src/render/pipelines/figure.rs b/voxygen/src/render/pipelines/figure.rs index e5e5f6b98e..aac7daf33a 100644 --- a/voxygen/src/render/pipelines/figure.rs +++ b/voxygen/src/render/pipelines/figure.rs @@ -64,41 +64,11 @@ gfx_defines! { } } -impl Vertex { - #[allow(clippy::collapsible_if)] - pub fn new(pos: Vec3, norm: Vec3, col: Rgb, ao: f32, bone_idx: u8) -> Self { - let norm_bits = if norm.x != 0.0 { - if norm.x < 0.0 { 0 } else { 1 } - } else if norm.y != 0.0 { - if norm.y < 0.0 { 2 } else { 3 } - } else { - if norm.z < 0.0 { 4 } else { 5 } - }; - Self { - pos_norm: pos - .map2(Vec3::new(0, 9, 18), |e, shift| { - (((e * 2.0 + 256.0) as u32) & 0x3FF) << shift - }) - .reduce_bitor() - | (norm_bits << 29), - col: col - .map2(Rgb::new(0, 8, 16), |e, shift| ((e * 255.0) as u32) << shift) - .reduce_bitor(), - ao_bone: (bone_idx << 2) | ((ao * 3.9999) as u8), - } - } - - pub fn with_bone_idx(mut self, bone_idx: u8) -> Self { - self.ao_bone = (self.ao_bone & 0b11) | (bone_idx << 2); - self - } -} - impl Locals { pub fn new( - model_mat: Mat4, + model_mat: anim::vek::Mat4, col: Rgba, - pos: Vec3, + pos: anim::vek::Vec3, atlas_offs: Vec2, is_player: bool, ) -> Self { @@ -118,9 +88,9 @@ impl Locals { impl Default for Locals { fn default() -> Self { Self::new( - Mat4::identity(), + anim::vek::Mat4::identity(), Rgba::broadcast(1.0), - Vec3::default(), + anim::vek::Vec3::default(), Vec2::default(), false, ) @@ -128,7 +98,7 @@ impl Default for Locals { } impl BoneData { - pub fn new(bone_mat: Mat4, normals_mat: Mat4) -> Self { + pub fn new(bone_mat: anim::vek::Mat4, normals_mat: anim::vek::Mat4) -> Self { Self { bone_mat: bone_mat.into_col_arrays(), normals_mat: normals_mat.into_col_arrays(), @@ -137,7 +107,7 @@ impl BoneData { } impl Default for BoneData { - fn default() -> Self { Self::new(Mat4::identity(), Mat4::identity()) } + fn default() -> Self { Self::new(anim::vek::Mat4::identity(), anim::vek::Mat4::identity()) } } pub struct FigurePipeline; diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index d6ffc7f935..08bca8ce60 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -43,7 +43,6 @@ use guillotiere::AtlasAllocator; use hashbrown::HashMap; use specs::{Entity as EcsEntity, Join, LazyUpdate, WorldExt}; use treeculler::{BVol, BoundingSphere}; -use vek::*; const DAMAGE_FADE_COEFFICIENT: f64 = 5.0; const MOVING_THRESHOLD: f32 = 0.7; @@ -348,7 +347,11 @@ impl FigureMgr { self.golem_model_cache.clean(&mut self.col_lights, tick); } - #[allow(clippy::redundant_pattern_matching)] // TODO: Pending review in #587 + #[allow(clippy::redundant_pattern_matching)] + // TODO: Pending review in #587 + // NOTE: All of the "useless" conversion reported here allow us to abstract over repr_c vs. + // simd vectors, so fixing this warning would make the code worse in this case. + #[allow(clippy::useless_conversion)] pub fn update_lighting(&mut self, scene_data: &SceneData) { let ecs = scene_data.state.ecs(); for (entity, light_emitter) in (&ecs.entities(), &ecs.read_storage::()).join() @@ -357,7 +360,7 @@ impl FigureMgr { let mut anim_storage = ecs.write_storage::(); if let None = anim_storage.get_mut(entity) { let anim = LightAnimation { - offset: Vec3::zero(), //Vec3::new(0.0, 0.0, 2.0), + offset: vek::Vec3::zero(), //Vec3::new(0.0, 0.0, 2.0), col: light_emitter.col, strength: 0.0, }; @@ -387,13 +390,13 @@ impl FigureMgr { emitter.animated, ) } else { - (Rgb::zero(), 0.0, 0.0, true) + (vek::Rgb::zero(), 0.0, 0.0, true) }; if let Some(_) = waypoint { - light_anim.offset = Vec3::unit_z() * 0.5; + light_anim.offset = vek::Vec3::unit_z() * 0.5; } if let Some(state) = self.states.character_states.get(&entity) { - light_anim.offset = state.lantern_offset; + light_anim.offset = vek::Vec3::from(state.lantern_offset); } if !light_anim.strength.is_normal() { light_anim.strength = 0.0; @@ -424,7 +427,11 @@ impl FigureMgr { } } - #[allow(clippy::or_fun_call)] // TODO: Pending review in #587 + #[allow(clippy::or_fun_call)] + // TODO: Pending review in #587 + // NOTE: All of the "useless" conversion reported here allow us to abstract over repr_c vs. + // simd vectors, so fixing this warning would make the code worse in this case. + #[allow(clippy::useless_conversion)] pub fn maintain( &mut self, renderer: &mut Renderer, @@ -432,7 +439,7 @@ impl FigureMgr { // Visible chunk data. visible_psr_bounds: math::Aabr, camera: &Camera, - ) -> Aabb { + ) -> anim::vek::Aabb { let state = scene_data.state; let time = state.get_time(); let tick = scene_data.tick; @@ -496,7 +503,7 @@ impl FigureMgr { a.min.partial_cmple(&b.max).reduce_and() && a.max.partial_cmpge(&b.min).reduce_and() }; // println!("Aabr: {:?}", visible_bounds); - move |pos: Pos, radius: f32| { + move |pos: (anim::vek::Vec3,), radius: f32| { // Short circuit when there are no shadows to cast. if !can_shadow_sun { return false; @@ -519,12 +526,14 @@ impl FigureMgr { let player_pos = ecs .read_storage::() .get(scene_data.player_entity) - .map_or(Vec3::zero(), |pos| pos.0); - let mut visible_aabb = Aabb { + .map_or(anim::vek::Vec3::zero(), |pos| anim::vek::Vec3::from(pos.0)); + let visible_aabb = anim::vek::Aabb { min: player_pos - 2.0, max: player_pos + 2.0, }; + let focus_pos = anim::vek::Vec3::::from(camera.get_focus_pos()); + for ( i, ( @@ -556,10 +565,19 @@ impl FigureMgr { .join() .enumerate() { + let vel = (anim::vek::Vec3::::from(vel.0),); let is_player = scene_data.player_entity == entity; let (pos, ori) = interpolated - .map(|i| (Pos(i.pos), *i.ori)) - .unwrap_or((*pos, Vec3::unit_y())); + .map(|i| { + ( + (anim::vek::Vec3::from(i.pos),), + anim::vek::Vec3::from(*i.ori), + ) + }) + .unwrap_or(( + (anim::vek::Vec3::::from(pos.0),), + anim::vek::Vec3::::unit_y(), + )); // Maintaining figure data and sending new figure data to the GPU turns out to // be a very expensive operation. We want to avoid doing it as much @@ -571,7 +589,7 @@ impl FigureMgr { const MIN_PERFECT_RATE_DIST: f32 = 50.0; if (i as u64 + tick) - % (1 + ((pos.0.distance_squared(camera.get_focus_pos()).powf(0.25) + % (1 + ((pos.0.distance_squared(focus_pos).powf(0.25) - MIN_PERFECT_RATE_DIST.powf(0.5)) .max(0.0) / 3.0) as u64) @@ -588,10 +606,11 @@ impl FigureMgr { .unwrap_or(false); // Don't process figures outside the vd - let vd_frac = Vec2::from(pos.0 - player_pos) - .map2(TerrainChunk::RECT_SIZE, |d: f32, sz| { - d.abs() as f32 / sz as f32 - }) + let vd_frac = anim::vek::Vec2::from(pos.0 - player_pos) + .map2( + anim::vek::Vec2::::from(TerrainChunk::RECT_SIZE), + |d: f32, sz| d.abs() as f32 / sz as f32, + ) .magnitude() / view_distance as f32; @@ -620,11 +639,11 @@ impl FigureMgr { meta.visible = in_frustum; meta.lpindex = lpindex; if in_frustum { - // Update visible bounds. + /* // Update visible bounds. visible_aabb.expand_to_contain(Aabb { min: pos.0 - radius, max: pos.0 + radius, - }); + }); */ } else { // Check whether we can shadow. meta.can_shadow_sun = can_shadow_sun(pos, radius); @@ -637,12 +656,12 @@ impl FigureMgr { // Change in health as color! let col = stats .map(|s| { - Rgba::broadcast(1.0) - + Rgba::new(2.0, 2.0, 2., 0.00).map(|c| { + vek::Rgba::broadcast(1.0) + + vek::Rgba::new(2.0, 2.0, 2., 0.00).map(|c| { (c / (1.0 + DAMAGE_FADE_COEFFICIENT * s.health.last_change.0)) as f32 }) }) - .unwrap_or(Rgba::broadcast(1.0)); + .unwrap_or(vek::Rgba::broadcast(1.0)); let scale = scale.map(|s| s.0).unwrap_or(1.0); @@ -1968,7 +1987,6 @@ impl FigureMgr { .entry(entity) .or_insert_with(|| FigureState::new(renderer, ObjectSkeleton::new())); - state.skeleton = state.skeleton_mut().clone(); state.update( renderer, pos.0, @@ -2226,7 +2244,7 @@ impl FigureMgr { loadout: Option<&Loadout>, is_player: bool, // is_shadow: bool, - pos: Vec3, + pos: vek::Vec3, figure_lod_render_distance: f32, filter_state: impl Fn(&FigureStateMeta) -> bool, ) -> Option<( @@ -2593,11 +2611,11 @@ impl FigureColLights { // println!("Allocation {:?} for {:?} (original size = {:?}... ugh)", // allocation, response.pos, tex_size); NOTE: Cast is safe since the // origin was a u16. - let atlas_offs = Vec2::new( + let atlas_offs = vek::Vec2::new( allocation.rectangle.min.x as u16, allocation.rectangle.min.y as u16, ); - if atlas_offs == Vec2::zero() { + if atlas_offs == vek::Vec2::zero() { // println!("Model: {:?}", &response.opaque_mesh.vertices()); // println!("Texture: {:?}", tex); } @@ -2689,14 +2707,14 @@ impl FigureColLights { pub struct FigureStateMeta { bone_consts: Consts, locals: Consts, - lantern_offset: Vec3, + lantern_offset: anim::vek::Vec3, state_time: f64, - last_ori: Vec3, + last_ori: anim::vek::Vec3, lpindex: u8, can_shadow_sun: bool, visible: bool, - last_pos: Option>, - avg_vel: Vec3, + last_pos: Option>, + avg_vel: anim::vek::Vec3, } impl FigureStateMeta { @@ -2735,12 +2753,12 @@ impl FigureState { locals: renderer.create_consts(&[FigureLocals::default()]).unwrap(), lantern_offset, state_time: 0.0, - last_ori: Vec3::zero(), + last_ori: anim::vek::Vec3::zero(), lpindex: 0, visible: false, can_shadow_sun: false, last_pos: None, - avg_vel: Vec3::zero(), + avg_vel: anim::vek::Vec3::zero(), }, skeleton, } @@ -2750,10 +2768,10 @@ impl FigureState { pub fn update( &mut self, renderer: &mut Renderer, - pos: Vec3, - ori: Vec3, + pos: anim::vek::Vec3, + ori: anim::vek::Vec3, scale: f32, - col: Rgba, + col: vek::Rgba, dt: f32, state_animation_rate: f32, model: &FigureModel, @@ -2778,16 +2796,16 @@ impl FigureState { self.visible = visible; */ // What is going on here? // (note: that ori is now the slerped ori) - self.last_ori = Lerp::lerp(self.last_ori, ori, 15.0 * dt); + self.last_ori = vek::Lerp::lerp(self.last_ori, ori, 15.0 * dt); self.state_time += (dt * state_animation_rate) as f64; - let _focus_off = camera.get_focus_pos().map(|e| e.trunc()); - let mat = Mat4::::identity() + // let _focus_off = camera.get_focus_pos().map(|e| e.trunc()); + let mat = anim::vek::Mat4::::identity() // * Mat4::translation_3d(pos - focus_off) - * Mat4::rotation_z(-ori.x.atan2(ori.y)) - * Mat4::rotation_x(ori.z.atan2(Vec2::from(ori).magnitude())) - * Mat4::scaling_3d(Vec3::from(0.8 * scale)); + * anim::vek::Mat4::rotation_z(-ori.x.atan2(ori.y)) + * anim::vek::Mat4::rotation_x(ori.z.atan2(anim::vek::Vec2::from(ori).magnitude())) + * anim::vek::Mat4::scaling_3d(anim::vek::Vec3::from(0.8 * scale)); /* let dependents = camera.get_dependents(); let all_mat = dependents.proj_mat * dependents.view_mat; */ @@ -2797,7 +2815,7 @@ impl FigureState { mat, col, pos, - Vec2::new(atlas_offs.x, atlas_offs.y), + vek::Vec2::new(atlas_offs.x, atlas_offs.y), is_player, ); renderer.update_consts(&mut self.locals, &[locals]).unwrap(); @@ -2833,7 +2851,7 @@ impl FigureState { fn figure_bone_data_from_anim( mats: [anim::FigureBoneData; 16], - mut make_bone: impl FnMut(Mat4) -> FigureBoneData, + mut make_bone: impl FnMut(anim::vek::Mat4) -> FigureBoneData, ) -> [FigureBoneData; 16] { [ make_bone(mats[0].0), diff --git a/voxygen/src/scene/math.rs b/voxygen/src/scene/math.rs index c72f9be978..27047a132a 100644 --- a/voxygen/src/scene/math.rs +++ b/voxygen/src/scene/math.rs @@ -1,9 +1,9 @@ use core::{iter, mem}; use hashbrown::HashMap; use num::traits::Float; -pub use vek::{geom::repr_simd::*, mat::repr_simd::column_major::Mat4, ops::*, vec::repr_simd::*}; -// pub use vek::{geom::repr_c::*, mat::repr_c::column_major::Mat4, ops::*, -// vec::repr_c::*}; +// pub use vek::{geom::repr_simd::*, mat::repr_simd::column_major::Mat4, ops::*, +// vec::repr_simd::*}; +pub use vek::{geom::repr_c::*, mat::repr_c::column_major::Mat4, ops::*, vec::repr_c::*}; pub fn aabb_to_points(bounds: Aabb) -> [Vec3; 8] { [ diff --git a/voxygen/src/scene/mod.rs b/voxygen/src/scene/mod.rs index 01f8ec61fa..c42365c46e 100644 --- a/voxygen/src/scene/mod.rs +++ b/voxygen/src/scene/mod.rs @@ -358,6 +358,9 @@ impl Scene { /// Maintain data such as GPU constant buffers, models, etc. To be called /// once per tick. + // NOTE: All of the "useless" conversion reported here allow us to abstract over repr_c vs. + // simd vectors, so fixing this warning would make the code worse in this case. + #[allow(clippy::useless_conversion)] pub fn maintain( &mut self, renderer: &mut Renderer, diff --git a/voxygen/src/scene/simple.rs b/voxygen/src/scene/simple.rs index a3d9e74975..d25548394e 100644 --- a/voxygen/src/scene/simple.rs +++ b/voxygen/src/scene/simple.rs @@ -159,8 +159,8 @@ impl Scene { let model = col_lights.create_figure(renderer, greedy, mesh).unwrap(); state.update( renderer, - Vec3::zero(), - Vec3::new(start_angle.sin(), -start_angle.cos(), 0.0), + anim::vek::Vec3::zero(), + anim::vek::Vec3::new(start_angle.sin(), -start_angle.cos(), 0.0), 1.0, Rgba::broadcast(1.0), 15.0, // Want to get there immediately. @@ -310,8 +310,8 @@ impl Scene { .0; self.figure_state.update( renderer, - Vec3::zero(), - Vec3::new(self.char_ori.sin(), -self.char_ori.cos(), 0.0), + anim::vek::Vec3::zero(), + anim::vek::Vec3::new(self.char_ori.sin(), -self.char_ori.cos(), 0.0), 1.0, Rgba::broadcast(1.0), scene_data.delta_time, diff --git a/voxygen/src/scene/terrain.rs b/voxygen/src/scene/terrain.rs index ee27bfb30f..0fa8e1e016 100644 --- a/voxygen/src/scene/terrain.rs +++ b/voxygen/src/scene/terrain.rs @@ -2439,6 +2439,9 @@ impl Terrain { } /// Maintain terrain data. To be called once per tick. + // NOTE: All of the "useless" conversion reported here allow us to abstract over repr_c vs. + // simd vectors, so fixing this warning would make the code worse in this case. + #[allow(clippy::useless_conversion)] #[allow(clippy::for_loops_over_fallibles)] // TODO: Pending review in #587 #[allow(clippy::len_zero)] // TODO: Pending review in #587 pub fn maintain( diff --git a/voxygen/src/session.rs b/voxygen/src/session.rs index c1b1e91f9c..72a8f1a030 100644 --- a/voxygen/src/session.rs +++ b/voxygen/src/session.rs @@ -731,7 +731,9 @@ impl PlayState for SessionState { // Look for changes in the localization files if global_state.localization_watcher.reloaded() { - hud_events.push(HudEvent::ChangeLanguage(self.voxygen_i18n.metadata.clone())); + hud_events.push(HudEvent::ChangeLanguage(Box::new( + self.voxygen_i18n.metadata.clone(), + ))); } // Maintain the UI. @@ -930,9 +932,9 @@ impl PlayState for SessionState { global_state .window .renderer_mut() - .set_render_mode(new_render_mode) + .set_render_mode((&*new_render_mode).clone()) .unwrap(); - global_state.settings.graphics.render_mode = new_render_mode; + global_state.settings.graphics.render_mode = *new_render_mode; global_state.settings.save_to_file_warn(); }, HudEvent::ChangeLanguage(new_language) => { diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index 1c74601aec..e3bcfde8b9 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -570,7 +570,7 @@ impl Window { factory, win_color_view, win_depth_view, - settings.graphics.render_mode, + settings.graphics.render_mode.clone(), )?, window, cursor_grabbed: false,