mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Abstract over simd vs. repr_c vectors.
Also some minor improvements to Event size.
This commit is contained in:
parent
d4d4956e92
commit
125d7fc6c4
@ -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 std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
|
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
|
||||||
//use std::f32::consts::PI;
|
//use std::f32::consts::PI;
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
|
@ -8,9 +8,8 @@ pub use self::{
|
|||||||
idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, wield::WieldAnimation,
|
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 common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct BipedLargeSkeleton {
|
pub struct BipedLargeSkeleton {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
BipedLargeSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
|
@ -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 std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct WieldAnimation;
|
pub struct WieldAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
BirdMediumSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct FeedAnimation;
|
pub struct FeedAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
BirdMediumSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct FlyAnimation;
|
pub struct FlyAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
BirdMediumSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -6,9 +6,8 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{feed::FeedAnimation, fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
|
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 common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct BirdMediumSkeleton {
|
pub struct BirdMediumSkeleton {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
BirdMediumSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr};
|
use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr};
|
||||||
//use std::{f32::consts::PI, ops::Mul};
|
//use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr};
|
use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr};
|
||||||
//use std::f32::consts::PI;
|
//use std::f32::consts::PI;
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
||||||
|
|
||||||
use super::{Bone, FigureBoneData, Skeleton};
|
use super::{vek::Vec3, Bone, FigureBoneData, Skeleton};
|
||||||
use common::comp::{self};
|
use common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct BirdSmallSkeleton {
|
pub struct BirdSmallSkeleton {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr};
|
use super::{super::Animation, BirdSmallSkeleton, SkeletonAttr};
|
||||||
//use std::{f32::consts::PI, ops::Mul};
|
//use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct AlphaAnimation;
|
pub struct AlphaAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct BetaAnimation;
|
pub struct BetaAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
pub attack: bool,
|
pub attack: bool,
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
pub attack: bool,
|
pub attack: bool,
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct ChargeAnimation;
|
pub struct ChargeAnimation;
|
||||||
|
|
||||||
@ -62,7 +64,7 @@ impl Animation for ChargeAnimation {
|
|||||||
|
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.001 && m.is_finite())
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct ClimbAnimation;
|
pub struct ClimbAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct DanceAnimation;
|
pub struct DanceAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
pub attack: bool,
|
pub attack: bool,
|
||||||
|
@ -2,7 +2,7 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
|||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
|
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct EquipAnimation;
|
pub struct EquipAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct GlideWieldAnimation;
|
pub struct GlideWieldAnimation;
|
||||||
|
|
||||||
@ -96,7 +98,7 @@ impl Animation for GlideWieldAnimation {
|
|||||||
|
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.001 && m.is_finite())
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct GlidingAnimation;
|
pub struct GlidingAnimation;
|
||||||
|
|
||||||
@ -56,7 +58,7 @@ impl Animation for GlidingAnimation {
|
|||||||
|
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.0001 && m.is_finite())
|
.map(|m| m > 0.0001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
impl Animation for JumpAnimation {
|
impl Animation for JumpAnimation {
|
||||||
@ -41,7 +43,7 @@ impl Animation for JumpAnimation {
|
|||||||
|
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.001 && m.is_finite())
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
/* use std::f32::consts::PI; */
|
/* use std::f32::consts::PI; */
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct LeapAnimation;
|
pub struct LeapAnimation;
|
||||||
|
|
||||||
|
@ -33,9 +33,11 @@ pub use self::{
|
|||||||
stand::StandAnimation, swim::SwimAnimation, wield::WieldAnimation,
|
stand::StandAnimation, swim::SwimAnimation, wield::WieldAnimation,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{Bone, FigureBoneData, Skeleton};
|
use super::{
|
||||||
|
vek::{Vec3, Vec4},
|
||||||
|
Bone, FigureBoneData, Skeleton,
|
||||||
|
};
|
||||||
use common::comp;
|
use common::comp;
|
||||||
use vek::{Vec3, Vec4};
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct CharacterSkeleton {
|
pub struct CharacterSkeleton {
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RollAnimation;
|
pub struct RollAnimation;
|
||||||
|
|
||||||
@ -33,7 +35,7 @@ impl Animation for RollAnimation {
|
|||||||
let spin = anim_time as f32;
|
let spin = anim_time as f32;
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.0001 && m.is_finite())
|
.map(|m| m > 0.0001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -98,7 +100,7 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.001 && m.is_finite())
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct ShootAnimation;
|
pub struct ShootAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct SitAnimation;
|
pub struct SitAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
pub attack: bool,
|
pub attack: bool,
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct SpinMeleeAnimation;
|
pub struct SpinMeleeAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct StandAnimation;
|
pub struct StandAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct SwimAnimation;
|
pub struct SwimAnimation;
|
||||||
|
|
||||||
@ -59,7 +61,7 @@ impl Animation for SwimAnimation {
|
|||||||
);
|
);
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.001 && m.is_finite())
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use common::comp::item::{Hands, ToolKind};
|
use common::comp::item::{Hands, ToolKind};
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct WieldAnimation;
|
pub struct WieldAnimation;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::{super::Animation, CritterAttr, CritterSkeleton};
|
use super::{super::Animation, CritterAttr, CritterSkeleton};
|
||||||
//use std::{f32::consts::PI, ops::Mul};
|
//use std::{f32::consts::PI, ops::Mul};
|
||||||
|
use super::super::vek::*;
|
||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, CritterAttr, CritterSkeleton};
|
use super::{super::Animation, CritterAttr, CritterSkeleton};
|
||||||
//use std::f32::consts::PI;
|
//use std::f32::consts::PI;
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
||||||
|
|
||||||
use super::{Bone, FigureBoneData, Skeleton};
|
use super::{vek::Vec3, Bone, FigureBoneData, Skeleton};
|
||||||
use common::comp::{self};
|
use common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct CritterSkeleton {
|
pub struct CritterSkeleton {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::{super::Animation, CritterAttr, CritterSkeleton};
|
use super::{super::Animation, CritterAttr, CritterSkeleton};
|
||||||
//use std::{f32::consts::PI, ops::Mul};
|
//use std::{f32::consts::PI, ops::Mul};
|
||||||
|
use super::super::vek::*;
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
DragonSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct FlyAnimation;
|
pub struct FlyAnimation;
|
||||||
|
|
||||||
|
@ -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 std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{fly::FlyAnimation, idle::IdleAnimation, run::RunAnimation};
|
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 common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct DragonSkeleton {
|
pub struct DragonSkeleton {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, DragonSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
DragonSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -37,7 +39,7 @@ impl Animation for RunAnimation {
|
|||||||
//
|
//
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.001 && m.is_finite())
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
||||||
//use std::{f32::consts::PI, ops::Mul};
|
//use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
||||||
//use std::f32::consts::PI;
|
//use std::f32::consts::PI;
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
||||||
|
|
||||||
use super::{Bone, FigureBoneData, Skeleton};
|
use super::{vek::Vec3, Bone, FigureBoneData, Skeleton};
|
||||||
use common::comp::{self};
|
use common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct FishMediumSkeleton {
|
pub struct FishMediumSkeleton {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
use super::{super::Animation, FishMediumSkeleton, SkeletonAttr};
|
||||||
//use std::f32::consts::PI;
|
//use std::f32::consts::PI;
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, FishSmallSkeleton, SkeletonAttr};
|
use super::{super::Animation, FishSmallSkeleton, SkeletonAttr};
|
||||||
//use std::{f32::consts::PI, ops::Mul};
|
//use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, FishSmallSkeleton, SkeletonAttr};
|
use super::{super::Animation, FishSmallSkeleton, SkeletonAttr};
|
||||||
//use std::f32::consts::PI;
|
//use std::f32::consts::PI;
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
||||||
|
|
||||||
use super::{Bone, FigureBoneData, Skeleton};
|
use super::{vek::Vec3, Bone, FigureBoneData, Skeleton};
|
||||||
use common::comp::{self};
|
use common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct FishSmallSkeleton {
|
pub struct FishSmallSkeleton {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, FishSmallSkeleton, SkeletonAttr};
|
use super::{super::Animation, FishSmallSkeleton, SkeletonAttr};
|
||||||
//use std::{f32::consts::PI, ops::Mul};
|
//use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
use super::{FigureBoneData, Skeleton};
|
use super::{
|
||||||
use vek::Vec3;
|
vek::{Mat4, Vec3},
|
||||||
|
FigureBoneData, Skeleton,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct FixtureSkeleton;
|
pub struct FixtureSkeleton;
|
||||||
@ -24,22 +26,22 @@ impl Skeleton for FixtureSkeleton {
|
|||||||
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
|
||||||
(
|
(
|
||||||
[
|
[
|
||||||
FigureBoneData::new(vek::Mat4::identity()), // <-- This is actually a bone!
|
FigureBoneData::new(Mat4::identity()), // <-- This is actually a bone!
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
],
|
],
|
||||||
Vec3::default(),
|
Vec3::default(),
|
||||||
)
|
)
|
||||||
|
@ -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 std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use super::{super::Animation, GolemSkeleton, SkeletonAttr};
|
use super::{super::Animation, GolemSkeleton, SkeletonAttr};
|
||||||
//use std::f32::consts::PI;
|
//use std::f32::consts::PI;
|
||||||
use vek::*;
|
use super::super::vek::*;
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
|
@ -5,9 +5,8 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
||||||
|
|
||||||
use super::{Bone, FigureBoneData, Skeleton};
|
use super::{vek::Vec3, Bone, FigureBoneData, Skeleton};
|
||||||
use common::comp::{self};
|
use common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct GolemSkeleton {
|
pub struct GolemSkeleton {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, GolemSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
GolemSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
|
@ -16,13 +16,15 @@ pub mod object;
|
|||||||
pub mod quadruped_low;
|
pub mod quadruped_low;
|
||||||
pub mod quadruped_medium;
|
pub mod quadruped_medium;
|
||||||
pub mod quadruped_small;
|
pub mod quadruped_small;
|
||||||
|
pub mod vek;
|
||||||
|
|
||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
pub use dyn_lib::init;
|
pub use dyn_lib::init;
|
||||||
|
|
||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
use vek::*;
|
|
||||||
|
use self::vek::*;
|
||||||
|
|
||||||
// TODO: replace with inner type everywhere
|
// TODO: replace with inner type everywhere
|
||||||
pub struct FigureBoneData(pub Mat4<f32>);
|
pub struct FigureBoneData(pub Mat4<f32>);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::{FigureBoneData, Skeleton};
|
use super::{vek::*, FigureBoneData, Skeleton};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ObjectSkeleton;
|
pub struct ObjectSkeleton;
|
||||||
@ -25,21 +24,21 @@ impl Skeleton for ObjectSkeleton {
|
|||||||
(
|
(
|
||||||
[
|
[
|
||||||
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
|
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
FigureBoneData::new(vek::Mat4::identity()),
|
FigureBoneData::new(Mat4::identity()),
|
||||||
],
|
],
|
||||||
Vec3::default(),
|
Vec3::default(),
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
QuadrupedLowSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct AlphaAnimation;
|
pub struct AlphaAnimation;
|
||||||
|
|
||||||
|
@ -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 std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr};
|
use super::{
|
||||||
use vek::*;
|
super::{vek::*, Animation},
|
||||||
|
QuadrupedLowSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
|
@ -8,9 +8,8 @@ pub use self::{
|
|||||||
alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation,
|
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 common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct QuadrupedLowSkeleton {
|
pub struct QuadrupedLowSkeleton {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, QuadrupedLowSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
QuadrupedLowSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -72,7 +74,7 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.001 && m.is_finite())
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
QuadrupedMediumSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct AlphaAnimation;
|
pub struct AlphaAnimation;
|
||||||
|
|
||||||
|
@ -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 std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
|
use super::{
|
||||||
use vek::*;
|
super::{vek::*, Animation},
|
||||||
|
QuadrupedMediumSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
|
@ -8,9 +8,8 @@ pub use self::{
|
|||||||
alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation,
|
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 common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct QuadrupedMediumSkeleton {
|
pub struct QuadrupedMediumSkeleton {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
QuadrupedMediumSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -59,7 +61,7 @@ impl Animation for RunAnimation {
|
|||||||
//
|
//
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.001 && m.is_finite())
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -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 std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct FeedAnimation;
|
pub struct FeedAnimation;
|
||||||
|
|
||||||
|
@ -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 std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct IdleAnimation;
|
pub struct IdleAnimation;
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr};
|
use super::{
|
||||||
use vek::*;
|
super::{vek::*, Animation},
|
||||||
|
QuadrupedSmallSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct JumpAnimation;
|
pub struct JumpAnimation;
|
||||||
|
|
||||||
|
@ -6,9 +6,8 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{feed::FeedAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
|
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 common::comp::{self};
|
||||||
use vek::Vec3;
|
|
||||||
|
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct QuadrupedSmallSkeleton {
|
pub struct QuadrupedSmallSkeleton {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr};
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
QuadrupedSmallSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
pub struct RunAnimation;
|
pub struct RunAnimation;
|
||||||
|
|
||||||
@ -35,7 +37,7 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||||
let last_ori = Vec2::from(last_ori);
|
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(|o| o.magnitude_squared())
|
||||||
.map(|m| m > 0.001 && m.is_finite())
|
.map(|m| m > 0.001 && m.is_finite())
|
||||||
.reduce_and()
|
.reduce_and()
|
||||||
|
@ -288,15 +288,15 @@ pub enum Event {
|
|||||||
UseSlot(comp::slot::Slot),
|
UseSlot(comp::slot::Slot),
|
||||||
SwapSlots(comp::slot::Slot, comp::slot::Slot),
|
SwapSlots(comp::slot::Slot, comp::slot::Slot),
|
||||||
DropSlot(comp::slot::Slot),
|
DropSlot(comp::slot::Slot),
|
||||||
ChangeHotbarState(HotbarState),
|
ChangeHotbarState(Box<HotbarState>),
|
||||||
Ability3(bool),
|
Ability3(bool),
|
||||||
Logout,
|
Logout,
|
||||||
Quit,
|
Quit,
|
||||||
ChangeLanguage(LanguageMetadata),
|
ChangeLanguage(Box<LanguageMetadata>),
|
||||||
ChangeBinding(GameInput),
|
ChangeBinding(GameInput),
|
||||||
ResetBindings,
|
ResetBindings,
|
||||||
ChangeFreeLookBehavior(PressBehavior),
|
ChangeFreeLookBehavior(PressBehavior),
|
||||||
ChangeRenderMode(RenderMode),
|
ChangeRenderMode(Box<RenderMode>),
|
||||||
ChangeAutoWalkBehavior(PressBehavior),
|
ChangeAutoWalkBehavior(PressBehavior),
|
||||||
ChangeStopAutoWalkOnInput(bool),
|
ChangeStopAutoWalkOnInput(bool),
|
||||||
CraftRecipe(String),
|
CraftRecipe(String),
|
||||||
@ -2006,10 +2006,10 @@ impl Hud {
|
|||||||
events.push(Event::SwapSlots(a, b));
|
events.push(Event::SwapSlots(a, b));
|
||||||
} else if let (Inventory(i), Hotbar(h)) = (a, b) {
|
} else if let (Inventory(i), Hotbar(h)) = (a, b) {
|
||||||
self.hotbar.add_inventory_link(h, i.0);
|
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) {
|
} else if let (Hotbar(a), Hotbar(b)) = (a, b) {
|
||||||
self.hotbar.swap(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) => {
|
slot::Event::Dropped(from) => {
|
||||||
@ -2018,7 +2018,7 @@ impl Hud {
|
|||||||
events.push(Event::DropSlot(from));
|
events.push(Event::DropSlot(from));
|
||||||
} else if let Hotbar(h) = from {
|
} else if let Hotbar(h) = from {
|
||||||
self.hotbar.clear_slot(h);
|
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) => {
|
slot::Event::Used(from) => {
|
||||||
|
@ -245,7 +245,7 @@ pub enum Event {
|
|||||||
AdjustGamma(f32),
|
AdjustGamma(f32),
|
||||||
AdjustWindowSize([u16; 2]),
|
AdjustWindowSize([u16; 2]),
|
||||||
ToggleFullscreen,
|
ToggleFullscreen,
|
||||||
ChangeRenderMode(RenderMode),
|
ChangeRenderMode(Box<RenderMode>),
|
||||||
AdjustMusicVolume(f32),
|
AdjustMusicVolume(f32),
|
||||||
AdjustSfxVolume(f32),
|
AdjustSfxVolume(f32),
|
||||||
ChangeAudioDevice(String),
|
ChangeAudioDevice(String),
|
||||||
@ -260,7 +260,7 @@ pub enum Event {
|
|||||||
SctDamageBatch(bool),
|
SctDamageBatch(bool),
|
||||||
SpeechBubbleDarkMode(bool),
|
SpeechBubbleDarkMode(bool),
|
||||||
SpeechBubbleIcon(bool),
|
SpeechBubbleIcon(bool),
|
||||||
ChangeLanguage(LanguageMetadata),
|
ChangeLanguage(Box<LanguageMetadata>),
|
||||||
ChangeBinding(GameInput),
|
ChangeBinding(GameInput),
|
||||||
ResetBindings,
|
ResetBindings,
|
||||||
ChangeFreeLookBehavior(PressBehavior),
|
ChangeFreeLookBehavior(PressBehavior),
|
||||||
@ -1226,7 +1226,9 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.label_font_id(self.fonts.cyri.conrod_id)
|
.label_font_id(self.fonts.cyri.conrod_id)
|
||||||
.set(state.ids.languages_list, ui)
|
.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)
|
.color(TEXT_COLOR)
|
||||||
.set(state.ids.figure_dist_value, ui);
|
.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
|
// AaMode
|
||||||
Text::new(&self.localized_strings.get("hud.settings.antialiasing_mode"))
|
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)
|
.down_from(state.ids.aa_mode_text, 8.0)
|
||||||
.set(state.ids.aa_mode_list, ui)
|
.set(state.ids.aa_mode_list, ui)
|
||||||
{
|
{
|
||||||
events.push(Event::ChangeRenderMode(RenderMode {
|
events.push(Event::ChangeRenderMode(Box::new(RenderMode {
|
||||||
aa: mode_list[clicked],
|
aa: mode_list[clicked],
|
||||||
..render_mode
|
..render_mode.clone()
|
||||||
}));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// CloudMode
|
// CloudMode
|
||||||
@ -2017,10 +2019,10 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.down_from(state.ids.cloud_mode_text, 8.0)
|
.down_from(state.ids.cloud_mode_text, 8.0)
|
||||||
.set(state.ids.cloud_mode_list, ui)
|
.set(state.ids.cloud_mode_list, ui)
|
||||||
{
|
{
|
||||||
events.push(Event::ChangeRenderMode(RenderMode {
|
events.push(Event::ChangeRenderMode(Box::new(RenderMode {
|
||||||
cloud: mode_list[clicked],
|
cloud: mode_list[clicked],
|
||||||
..render_mode
|
..render_mode.clone()
|
||||||
}));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FluidMode
|
// FluidMode
|
||||||
@ -2056,10 +2058,10 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.down_from(state.ids.fluid_mode_text, 8.0)
|
.down_from(state.ids.fluid_mode_text, 8.0)
|
||||||
.set(state.ids.fluid_mode_list, ui)
|
.set(state.ids.fluid_mode_list, ui)
|
||||||
{
|
{
|
||||||
events.push(Event::ChangeRenderMode(RenderMode {
|
events.push(Event::ChangeRenderMode(Box::new(RenderMode {
|
||||||
fluid: mode_list[clicked],
|
fluid: mode_list[clicked],
|
||||||
..render_mode
|
..render_mode.clone()
|
||||||
}));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// LightingMode
|
// LightingMode
|
||||||
@ -2102,10 +2104,10 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.down_from(state.ids.lighting_mode_text, 8.0)
|
.down_from(state.ids.lighting_mode_text, 8.0)
|
||||||
.set(state.ids.lighting_mode_list, ui)
|
.set(state.ids.lighting_mode_list, ui)
|
||||||
{
|
{
|
||||||
events.push(Event::ChangeRenderMode(RenderMode {
|
events.push(Event::ChangeRenderMode(Box::new(RenderMode {
|
||||||
lighting: mode_list[clicked],
|
lighting: mode_list[clicked],
|
||||||
..render_mode
|
..render_mode.clone()
|
||||||
}));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShadowMode
|
// ShadowMode
|
||||||
@ -2149,10 +2151,10 @@ impl<'a> Widget for SettingsWindow<'a> {
|
|||||||
.down_from(state.ids.shadow_mode_text, 8.0)
|
.down_from(state.ids.shadow_mode_text, 8.0)
|
||||||
.set(state.ids.shadow_mode_list, ui)
|
.set(state.ids.shadow_mode_list, ui)
|
||||||
{
|
{
|
||||||
events.push(Event::ChangeRenderMode(RenderMode {
|
events.push(Event::ChangeRenderMode(Box::new(RenderMode {
|
||||||
shadow: mode_list[clicked],
|
shadow: mode_list[clicked],
|
||||||
..render_mode
|
..render_mode.clone()
|
||||||
}));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(shadow_map_mode) = shadow_map_mode {
|
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))
|
.pad_track((5.0, 5.0))
|
||||||
.set(state.ids.shadow_mode_map_resolution_slider, ui)
|
.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 {
|
shadow: ShadowMode::Map(ShadowMapMode {
|
||||||
resolution: 2.0f32.powf(f32::from(new_val) / 4.0),
|
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
|
// TODO: Consider fixing to avoid allocation (it's probably not a bottleneck but
|
||||||
|
@ -247,7 +247,7 @@ impl ShadowMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Render modes
|
/// Render modes
|
||||||
#[derive(PartialEq, Clone, Copy, Debug, Default, Serialize, Deserialize)]
|
#[derive(PartialEq, Clone, Debug, Default, Serialize, Deserialize)]
|
||||||
pub struct RenderMode {
|
pub struct RenderMode {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub aa: AaMode,
|
pub aa: AaMode,
|
||||||
|
@ -64,41 +64,11 @@ gfx_defines! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Vertex {
|
|
||||||
#[allow(clippy::collapsible_if)]
|
|
||||||
pub fn new(pos: Vec3<f32>, norm: Vec3<f32>, col: Rgb<f32>, 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 {
|
impl Locals {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
model_mat: Mat4<f32>,
|
model_mat: anim::vek::Mat4<f32>,
|
||||||
col: Rgba<f32>,
|
col: Rgba<f32>,
|
||||||
pos: Vec3<f32>,
|
pos: anim::vek::Vec3<f32>,
|
||||||
atlas_offs: Vec2<i32>,
|
atlas_offs: Vec2<i32>,
|
||||||
is_player: bool,
|
is_player: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
@ -118,9 +88,9 @@ impl Locals {
|
|||||||
impl Default for Locals {
|
impl Default for Locals {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new(
|
Self::new(
|
||||||
Mat4::identity(),
|
anim::vek::Mat4::identity(),
|
||||||
Rgba::broadcast(1.0),
|
Rgba::broadcast(1.0),
|
||||||
Vec3::default(),
|
anim::vek::Vec3::default(),
|
||||||
Vec2::default(),
|
Vec2::default(),
|
||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
@ -128,7 +98,7 @@ impl Default for Locals {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl BoneData {
|
impl BoneData {
|
||||||
pub fn new(bone_mat: Mat4<f32>, normals_mat: Mat4<f32>) -> Self {
|
pub fn new(bone_mat: anim::vek::Mat4<f32>, normals_mat: anim::vek::Mat4<f32>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
bone_mat: bone_mat.into_col_arrays(),
|
bone_mat: bone_mat.into_col_arrays(),
|
||||||
normals_mat: normals_mat.into_col_arrays(),
|
normals_mat: normals_mat.into_col_arrays(),
|
||||||
@ -137,7 +107,7 @@ impl BoneData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Default for 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;
|
pub struct FigurePipeline;
|
||||||
|
@ -43,7 +43,6 @@ use guillotiere::AtlasAllocator;
|
|||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use specs::{Entity as EcsEntity, Join, LazyUpdate, WorldExt};
|
use specs::{Entity as EcsEntity, Join, LazyUpdate, WorldExt};
|
||||||
use treeculler::{BVol, BoundingSphere};
|
use treeculler::{BVol, BoundingSphere};
|
||||||
use vek::*;
|
|
||||||
|
|
||||||
const DAMAGE_FADE_COEFFICIENT: f64 = 5.0;
|
const DAMAGE_FADE_COEFFICIENT: f64 = 5.0;
|
||||||
const MOVING_THRESHOLD: f32 = 0.7;
|
const MOVING_THRESHOLD: f32 = 0.7;
|
||||||
@ -348,7 +347,11 @@ impl FigureMgr {
|
|||||||
self.golem_model_cache.clean(&mut self.col_lights, tick);
|
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) {
|
pub fn update_lighting(&mut self, scene_data: &SceneData) {
|
||||||
let ecs = scene_data.state.ecs();
|
let ecs = scene_data.state.ecs();
|
||||||
for (entity, light_emitter) in (&ecs.entities(), &ecs.read_storage::<LightEmitter>()).join()
|
for (entity, light_emitter) in (&ecs.entities(), &ecs.read_storage::<LightEmitter>()).join()
|
||||||
@ -357,7 +360,7 @@ impl FigureMgr {
|
|||||||
let mut anim_storage = ecs.write_storage::<LightAnimation>();
|
let mut anim_storage = ecs.write_storage::<LightAnimation>();
|
||||||
if let None = anim_storage.get_mut(entity) {
|
if let None = anim_storage.get_mut(entity) {
|
||||||
let anim = LightAnimation {
|
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,
|
col: light_emitter.col,
|
||||||
strength: 0.0,
|
strength: 0.0,
|
||||||
};
|
};
|
||||||
@ -387,13 +390,13 @@ impl FigureMgr {
|
|||||||
emitter.animated,
|
emitter.animated,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
(Rgb::zero(), 0.0, 0.0, true)
|
(vek::Rgb::zero(), 0.0, 0.0, true)
|
||||||
};
|
};
|
||||||
if let Some(_) = waypoint {
|
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) {
|
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() {
|
if !light_anim.strength.is_normal() {
|
||||||
light_anim.strength = 0.0;
|
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(
|
pub fn maintain(
|
||||||
&mut self,
|
&mut self,
|
||||||
renderer: &mut Renderer,
|
renderer: &mut Renderer,
|
||||||
@ -432,7 +439,7 @@ impl FigureMgr {
|
|||||||
// Visible chunk data.
|
// Visible chunk data.
|
||||||
visible_psr_bounds: math::Aabr<f32>,
|
visible_psr_bounds: math::Aabr<f32>,
|
||||||
camera: &Camera,
|
camera: &Camera,
|
||||||
) -> Aabb<f32> {
|
) -> anim::vek::Aabb<f32> {
|
||||||
let state = scene_data.state;
|
let state = scene_data.state;
|
||||||
let time = state.get_time();
|
let time = state.get_time();
|
||||||
let tick = scene_data.tick;
|
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()
|
a.min.partial_cmple(&b.max).reduce_and() && a.max.partial_cmpge(&b.min).reduce_and()
|
||||||
};
|
};
|
||||||
// println!("Aabr: {:?}", visible_bounds);
|
// println!("Aabr: {:?}", visible_bounds);
|
||||||
move |pos: Pos, radius: f32| {
|
move |pos: (anim::vek::Vec3<f32>,), radius: f32| {
|
||||||
// Short circuit when there are no shadows to cast.
|
// Short circuit when there are no shadows to cast.
|
||||||
if !can_shadow_sun {
|
if !can_shadow_sun {
|
||||||
return false;
|
return false;
|
||||||
@ -519,12 +526,14 @@ impl FigureMgr {
|
|||||||
let player_pos = ecs
|
let player_pos = ecs
|
||||||
.read_storage::<Pos>()
|
.read_storage::<Pos>()
|
||||||
.get(scene_data.player_entity)
|
.get(scene_data.player_entity)
|
||||||
.map_or(Vec3::zero(), |pos| pos.0);
|
.map_or(anim::vek::Vec3::zero(), |pos| anim::vek::Vec3::from(pos.0));
|
||||||
let mut visible_aabb = Aabb {
|
let visible_aabb = anim::vek::Aabb {
|
||||||
min: player_pos - 2.0,
|
min: player_pos - 2.0,
|
||||||
max: player_pos + 2.0,
|
max: player_pos + 2.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let focus_pos = anim::vek::Vec3::<f32>::from(camera.get_focus_pos());
|
||||||
|
|
||||||
for (
|
for (
|
||||||
i,
|
i,
|
||||||
(
|
(
|
||||||
@ -556,10 +565,19 @@ impl FigureMgr {
|
|||||||
.join()
|
.join()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
{
|
{
|
||||||
|
let vel = (anim::vek::Vec3::<f32>::from(vel.0),);
|
||||||
let is_player = scene_data.player_entity == entity;
|
let is_player = scene_data.player_entity == entity;
|
||||||
let (pos, ori) = interpolated
|
let (pos, ori) = interpolated
|
||||||
.map(|i| (Pos(i.pos), *i.ori))
|
.map(|i| {
|
||||||
.unwrap_or((*pos, Vec3::unit_y()));
|
(
|
||||||
|
(anim::vek::Vec3::from(i.pos),),
|
||||||
|
anim::vek::Vec3::from(*i.ori),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.unwrap_or((
|
||||||
|
(anim::vek::Vec3::<f32>::from(pos.0),),
|
||||||
|
anim::vek::Vec3::<f32>::unit_y(),
|
||||||
|
));
|
||||||
|
|
||||||
// Maintaining figure data and sending new figure data to the GPU turns out to
|
// 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
|
// 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;
|
const MIN_PERFECT_RATE_DIST: f32 = 50.0;
|
||||||
|
|
||||||
if (i as u64 + tick)
|
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))
|
- MIN_PERFECT_RATE_DIST.powf(0.5))
|
||||||
.max(0.0)
|
.max(0.0)
|
||||||
/ 3.0) as u64)
|
/ 3.0) as u64)
|
||||||
@ -588,10 +606,11 @@ impl FigureMgr {
|
|||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
|
||||||
// Don't process figures outside the vd
|
// Don't process figures outside the vd
|
||||||
let vd_frac = Vec2::from(pos.0 - player_pos)
|
let vd_frac = anim::vek::Vec2::from(pos.0 - player_pos)
|
||||||
.map2(TerrainChunk::RECT_SIZE, |d: f32, sz| {
|
.map2(
|
||||||
d.abs() as f32 / sz as f32
|
anim::vek::Vec2::<u32>::from(TerrainChunk::RECT_SIZE),
|
||||||
})
|
|d: f32, sz| d.abs() as f32 / sz as f32,
|
||||||
|
)
|
||||||
.magnitude()
|
.magnitude()
|
||||||
/ view_distance as f32;
|
/ view_distance as f32;
|
||||||
|
|
||||||
@ -620,11 +639,11 @@ impl FigureMgr {
|
|||||||
meta.visible = in_frustum;
|
meta.visible = in_frustum;
|
||||||
meta.lpindex = lpindex;
|
meta.lpindex = lpindex;
|
||||||
if in_frustum {
|
if in_frustum {
|
||||||
// Update visible bounds.
|
/* // Update visible bounds.
|
||||||
visible_aabb.expand_to_contain(Aabb {
|
visible_aabb.expand_to_contain(Aabb {
|
||||||
min: pos.0 - radius,
|
min: pos.0 - radius,
|
||||||
max: pos.0 + radius,
|
max: pos.0 + radius,
|
||||||
});
|
}); */
|
||||||
} else {
|
} else {
|
||||||
// Check whether we can shadow.
|
// Check whether we can shadow.
|
||||||
meta.can_shadow_sun = can_shadow_sun(pos, radius);
|
meta.can_shadow_sun = can_shadow_sun(pos, radius);
|
||||||
@ -637,12 +656,12 @@ impl FigureMgr {
|
|||||||
// Change in health as color!
|
// Change in health as color!
|
||||||
let col = stats
|
let col = stats
|
||||||
.map(|s| {
|
.map(|s| {
|
||||||
Rgba::broadcast(1.0)
|
vek::Rgba::broadcast(1.0)
|
||||||
+ Rgba::new(2.0, 2.0, 2., 0.00).map(|c| {
|
+ 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
|
(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);
|
let scale = scale.map(|s| s.0).unwrap_or(1.0);
|
||||||
|
|
||||||
@ -1968,7 +1987,6 @@ impl FigureMgr {
|
|||||||
.entry(entity)
|
.entry(entity)
|
||||||
.or_insert_with(|| FigureState::new(renderer, ObjectSkeleton::new()));
|
.or_insert_with(|| FigureState::new(renderer, ObjectSkeleton::new()));
|
||||||
|
|
||||||
state.skeleton = state.skeleton_mut().clone();
|
|
||||||
state.update(
|
state.update(
|
||||||
renderer,
|
renderer,
|
||||||
pos.0,
|
pos.0,
|
||||||
@ -2226,7 +2244,7 @@ impl FigureMgr {
|
|||||||
loadout: Option<&Loadout>,
|
loadout: Option<&Loadout>,
|
||||||
is_player: bool,
|
is_player: bool,
|
||||||
// is_shadow: bool,
|
// is_shadow: bool,
|
||||||
pos: Vec3<f32>,
|
pos: vek::Vec3<f32>,
|
||||||
figure_lod_render_distance: f32,
|
figure_lod_render_distance: f32,
|
||||||
filter_state: impl Fn(&FigureStateMeta) -> bool,
|
filter_state: impl Fn(&FigureStateMeta) -> bool,
|
||||||
) -> Option<(
|
) -> Option<(
|
||||||
@ -2593,11 +2611,11 @@ impl FigureColLights {
|
|||||||
// println!("Allocation {:?} for {:?} (original size = {:?}... ugh)",
|
// println!("Allocation {:?} for {:?} (original size = {:?}... ugh)",
|
||||||
// allocation, response.pos, tex_size); NOTE: Cast is safe since the
|
// allocation, response.pos, tex_size); NOTE: Cast is safe since the
|
||||||
// origin was a u16.
|
// origin was a u16.
|
||||||
let atlas_offs = Vec2::new(
|
let atlas_offs = vek::Vec2::new(
|
||||||
allocation.rectangle.min.x as u16,
|
allocation.rectangle.min.x as u16,
|
||||||
allocation.rectangle.min.y 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!("Model: {:?}", &response.opaque_mesh.vertices());
|
||||||
// println!("Texture: {:?}", tex);
|
// println!("Texture: {:?}", tex);
|
||||||
}
|
}
|
||||||
@ -2689,14 +2707,14 @@ impl FigureColLights {
|
|||||||
pub struct FigureStateMeta {
|
pub struct FigureStateMeta {
|
||||||
bone_consts: Consts<FigureBoneData>,
|
bone_consts: Consts<FigureBoneData>,
|
||||||
locals: Consts<FigureLocals>,
|
locals: Consts<FigureLocals>,
|
||||||
lantern_offset: Vec3<f32>,
|
lantern_offset: anim::vek::Vec3<f32>,
|
||||||
state_time: f64,
|
state_time: f64,
|
||||||
last_ori: Vec3<f32>,
|
last_ori: anim::vek::Vec3<f32>,
|
||||||
lpindex: u8,
|
lpindex: u8,
|
||||||
can_shadow_sun: bool,
|
can_shadow_sun: bool,
|
||||||
visible: bool,
|
visible: bool,
|
||||||
last_pos: Option<Vec3<f32>>,
|
last_pos: Option<anim::vek::Vec3<f32>>,
|
||||||
avg_vel: Vec3<f32>,
|
avg_vel: anim::vek::Vec3<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FigureStateMeta {
|
impl FigureStateMeta {
|
||||||
@ -2735,12 +2753,12 @@ impl<S: Skeleton> FigureState<S> {
|
|||||||
locals: renderer.create_consts(&[FigureLocals::default()]).unwrap(),
|
locals: renderer.create_consts(&[FigureLocals::default()]).unwrap(),
|
||||||
lantern_offset,
|
lantern_offset,
|
||||||
state_time: 0.0,
|
state_time: 0.0,
|
||||||
last_ori: Vec3::zero(),
|
last_ori: anim::vek::Vec3::zero(),
|
||||||
lpindex: 0,
|
lpindex: 0,
|
||||||
visible: false,
|
visible: false,
|
||||||
can_shadow_sun: false,
|
can_shadow_sun: false,
|
||||||
last_pos: None,
|
last_pos: None,
|
||||||
avg_vel: Vec3::zero(),
|
avg_vel: anim::vek::Vec3::zero(),
|
||||||
},
|
},
|
||||||
skeleton,
|
skeleton,
|
||||||
}
|
}
|
||||||
@ -2750,10 +2768,10 @@ impl<S: Skeleton> FigureState<S> {
|
|||||||
pub fn update(
|
pub fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
renderer: &mut Renderer,
|
renderer: &mut Renderer,
|
||||||
pos: Vec3<f32>,
|
pos: anim::vek::Vec3<f32>,
|
||||||
ori: Vec3<f32>,
|
ori: anim::vek::Vec3<f32>,
|
||||||
scale: f32,
|
scale: f32,
|
||||||
col: Rgba<f32>,
|
col: vek::Rgba<f32>,
|
||||||
dt: f32,
|
dt: f32,
|
||||||
state_animation_rate: f32,
|
state_animation_rate: f32,
|
||||||
model: &FigureModel,
|
model: &FigureModel,
|
||||||
@ -2778,16 +2796,16 @@ impl<S: Skeleton> FigureState<S> {
|
|||||||
self.visible = visible; */
|
self.visible = visible; */
|
||||||
// What is going on here?
|
// What is going on here?
|
||||||
// (note: that ori is now the slerped ori)
|
// (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;
|
self.state_time += (dt * state_animation_rate) as f64;
|
||||||
|
|
||||||
let _focus_off = camera.get_focus_pos().map(|e| e.trunc());
|
// let _focus_off = camera.get_focus_pos().map(|e| e.trunc());
|
||||||
let mat = Mat4::<f32>::identity()
|
let mat = anim::vek::Mat4::<f32>::identity()
|
||||||
// * Mat4::translation_3d(pos - focus_off)
|
// * Mat4::translation_3d(pos - focus_off)
|
||||||
* Mat4::rotation_z(-ori.x.atan2(ori.y))
|
* anim::vek::Mat4::rotation_z(-ori.x.atan2(ori.y))
|
||||||
* Mat4::rotation_x(ori.z.atan2(Vec2::from(ori).magnitude()))
|
* anim::vek::Mat4::rotation_x(ori.z.atan2(anim::vek::Vec2::from(ori).magnitude()))
|
||||||
* Mat4::scaling_3d(Vec3::from(0.8 * scale));
|
* anim::vek::Mat4::scaling_3d(anim::vek::Vec3::from(0.8 * scale));
|
||||||
|
|
||||||
/* let dependents = camera.get_dependents();
|
/* let dependents = camera.get_dependents();
|
||||||
let all_mat = dependents.proj_mat * dependents.view_mat; */
|
let all_mat = dependents.proj_mat * dependents.view_mat; */
|
||||||
@ -2797,7 +2815,7 @@ impl<S: Skeleton> FigureState<S> {
|
|||||||
mat,
|
mat,
|
||||||
col,
|
col,
|
||||||
pos,
|
pos,
|
||||||
Vec2::new(atlas_offs.x, atlas_offs.y),
|
vek::Vec2::new(atlas_offs.x, atlas_offs.y),
|
||||||
is_player,
|
is_player,
|
||||||
);
|
);
|
||||||
renderer.update_consts(&mut self.locals, &[locals]).unwrap();
|
renderer.update_consts(&mut self.locals, &[locals]).unwrap();
|
||||||
@ -2833,7 +2851,7 @@ impl<S: Skeleton> FigureState<S> {
|
|||||||
|
|
||||||
fn figure_bone_data_from_anim(
|
fn figure_bone_data_from_anim(
|
||||||
mats: [anim::FigureBoneData; 16],
|
mats: [anim::FigureBoneData; 16],
|
||||||
mut make_bone: impl FnMut(Mat4<f32>) -> FigureBoneData,
|
mut make_bone: impl FnMut(anim::vek::Mat4<f32>) -> FigureBoneData,
|
||||||
) -> [FigureBoneData; 16] {
|
) -> [FigureBoneData; 16] {
|
||||||
[
|
[
|
||||||
make_bone(mats[0].0),
|
make_bone(mats[0].0),
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
use core::{iter, mem};
|
use core::{iter, mem};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use num::traits::Float;
|
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_simd::*, mat::repr_simd::column_major::Mat4, ops::*,
|
||||||
// pub use vek::{geom::repr_c::*, mat::repr_c::column_major::Mat4, ops::*,
|
// vec::repr_simd::*};
|
||||||
// vec::repr_c::*};
|
pub use vek::{geom::repr_c::*, mat::repr_c::column_major::Mat4, ops::*, vec::repr_c::*};
|
||||||
|
|
||||||
pub fn aabb_to_points<T: Float>(bounds: Aabb<T>) -> [Vec3<T>; 8] {
|
pub fn aabb_to_points<T: Float>(bounds: Aabb<T>) -> [Vec3<T>; 8] {
|
||||||
[
|
[
|
||||||
|
@ -358,6 +358,9 @@ impl Scene {
|
|||||||
|
|
||||||
/// Maintain data such as GPU constant buffers, models, etc. To be called
|
/// Maintain data such as GPU constant buffers, models, etc. To be called
|
||||||
/// once per tick.
|
/// 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(
|
pub fn maintain(
|
||||||
&mut self,
|
&mut self,
|
||||||
renderer: &mut Renderer,
|
renderer: &mut Renderer,
|
||||||
|
@ -159,8 +159,8 @@ impl Scene {
|
|||||||
let model = col_lights.create_figure(renderer, greedy, mesh).unwrap();
|
let model = col_lights.create_figure(renderer, greedy, mesh).unwrap();
|
||||||
state.update(
|
state.update(
|
||||||
renderer,
|
renderer,
|
||||||
Vec3::zero(),
|
anim::vek::Vec3::zero(),
|
||||||
Vec3::new(start_angle.sin(), -start_angle.cos(), 0.0),
|
anim::vek::Vec3::new(start_angle.sin(), -start_angle.cos(), 0.0),
|
||||||
1.0,
|
1.0,
|
||||||
Rgba::broadcast(1.0),
|
Rgba::broadcast(1.0),
|
||||||
15.0, // Want to get there immediately.
|
15.0, // Want to get there immediately.
|
||||||
@ -310,8 +310,8 @@ impl Scene {
|
|||||||
.0;
|
.0;
|
||||||
self.figure_state.update(
|
self.figure_state.update(
|
||||||
renderer,
|
renderer,
|
||||||
Vec3::zero(),
|
anim::vek::Vec3::zero(),
|
||||||
Vec3::new(self.char_ori.sin(), -self.char_ori.cos(), 0.0),
|
anim::vek::Vec3::new(self.char_ori.sin(), -self.char_ori.cos(), 0.0),
|
||||||
1.0,
|
1.0,
|
||||||
Rgba::broadcast(1.0),
|
Rgba::broadcast(1.0),
|
||||||
scene_data.delta_time,
|
scene_data.delta_time,
|
||||||
|
@ -2439,6 +2439,9 @@ impl<V: RectRasterableVol> Terrain<V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Maintain terrain data. To be called once per tick.
|
/// 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::for_loops_over_fallibles)] // TODO: Pending review in #587
|
||||||
#[allow(clippy::len_zero)] // TODO: Pending review in #587
|
#[allow(clippy::len_zero)] // TODO: Pending review in #587
|
||||||
pub fn maintain(
|
pub fn maintain(
|
||||||
|
@ -731,7 +731,9 @@ impl PlayState for SessionState {
|
|||||||
|
|
||||||
// Look for changes in the localization files
|
// Look for changes in the localization files
|
||||||
if global_state.localization_watcher.reloaded() {
|
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.
|
// Maintain the UI.
|
||||||
@ -930,9 +932,9 @@ impl PlayState for SessionState {
|
|||||||
global_state
|
global_state
|
||||||
.window
|
.window
|
||||||
.renderer_mut()
|
.renderer_mut()
|
||||||
.set_render_mode(new_render_mode)
|
.set_render_mode((&*new_render_mode).clone())
|
||||||
.unwrap();
|
.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();
|
global_state.settings.save_to_file_warn();
|
||||||
},
|
},
|
||||||
HudEvent::ChangeLanguage(new_language) => {
|
HudEvent::ChangeLanguage(new_language) => {
|
||||||
|
@ -570,7 +570,7 @@ impl Window {
|
|||||||
factory,
|
factory,
|
||||||
win_color_view,
|
win_color_view,
|
||||||
win_depth_view,
|
win_depth_view,
|
||||||
settings.graphics.render_mode,
|
settings.graphics.render_mode.clone(),
|
||||||
)?,
|
)?,
|
||||||
window,
|
window,
|
||||||
cursor_grabbed: false,
|
cursor_grabbed: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user