v0.2.0 fixed wide vectors

This commit is contained in:
Quaternions 2024-09-16 15:46:52 -07:00
parent 4eb8ff1928
commit 39a7c31d32
7 changed files with 116 additions and 72 deletions

56
Cargo.lock generated
View File

@ -10,9 +10,9 @@ checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
[[package]] [[package]]
name = "arrayvec" name = "arrayvec"
version = "0.7.4" version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
[[package]] [[package]]
name = "binrw" name = "binrw"
@ -44,6 +44,12 @@ version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "bnum"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50202def95bf36cb7d1d7a7962cea1c36a3f8ad42425e5d2b71d7acb8041b5b8"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.16.3" version = "1.16.3"
@ -56,6 +62,18 @@ version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
[[package]]
name = "fixed_wide"
version = "0.1.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "7a8d6e10c51c9df39ead915c62288afbc41d13e00368e526037e530ee5c58e13"
dependencies = [
"arrayvec",
"bnum",
"paste",
"ratio_ops",
]
[[package]] [[package]]
name = "glam" name = "glam"
version = "0.28.0" version = "0.28.0"
@ -73,12 +91,29 @@ dependencies = [
"syn 2.0.72", "syn 2.0.72",
] ]
[[package]]
name = "linear_ops"
version = "0.1.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "b2e6977ac24f47086d8a7a2d4ae1c720e86dfdc8407cf5e34c18bfa01053c456"
dependencies = [
"fixed_wide",
"paste",
"ratio_ops",
]
[[package]] [[package]]
name = "owo-colors" name = "owo-colors"
version = "3.5.0" version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "paste"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.86" version = "1.0.86"
@ -98,20 +133,29 @@ dependencies = [
] ]
[[package]] [[package]]
name = "strafesnet_common" name = "ratio_ops"
version = "0.4.0" version = "0.1.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/" source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "ea4126f6fbf9aecf89c9e319290f0221d177dcaa8659b4b9e3d82acc37829f12" checksum = "01239195d6afe0509e7e3511b716c0540251dfe7ece0a9a5a27116afb766c42c"
[[package]]
name = "strafesnet_common"
version = "0.5.0"
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
checksum = "d8fcc44793ae84a1d80882f367980913292241c94eb87584de4010bdad4a918d"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bitflags", "bitflags",
"fixed_wide",
"glam", "glam",
"id", "id",
"linear_ops",
"ratio_ops",
] ]
[[package]] [[package]]
name = "strafesnet_snf" name = "strafesnet_snf"
version = "0.1.3" version = "0.2.0"
dependencies = [ dependencies = [
"binrw", "binrw",
"id", "id",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "strafesnet_snf" name = "strafesnet_snf"
version = "0.1.3" version = "0.2.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -8,4 +8,4 @@ edition = "2021"
[dependencies] [dependencies]
binrw = "0.14.0" binrw = "0.14.0"
id = { version = "0.1.0", registry = "strafesnet" } id = { version = "0.1.0", registry = "strafesnet" }
strafesnet_common = { version = "0.4.0", registry = "strafesnet" } strafesnet_common = { version = "0.5.0", registry = "strafesnet" }

View File

@ -357,7 +357,7 @@ pub fn write_map<W:BinWriterExt>(mut writer:W,map:strafesnet_common::map::Comple
let mesh=map.meshes.get(model.mesh.get() as usize).ok_or(Error::InvalidMeshId(model.mesh))?; let mesh=map.meshes.get(model.mesh.get() as usize).ok_or(Error::InvalidMeshId(model.mesh))?;
let mut aabb=strafesnet_common::aabb::Aabb::default(); let mut aabb=strafesnet_common::aabb::Aabb::default();
for &pos in &mesh.unique_pos{ for &pos in &mesh.unique_pos{
aabb.grow(model.transform.transform_point3(pos)); aabb.grow(model.transform.transform_point3(pos).fix_1());
} }
Ok(((model::ModelId::new(model_id as u32),model.into()),aabb)) Ok(((model::ModelId::new(model_id as u32),model.into()),aabb))
}).collect::<Result<Vec<_>,_>>()?; }).collect::<Result<Vec<_>,_>>()?;

View File

@ -8,16 +8,16 @@ pub struct Aabb{
impl Into<strafesnet_common::aabb::Aabb> for Aabb{ impl Into<strafesnet_common::aabb::Aabb> for Aabb{
fn into(self)->strafesnet_common::aabb::Aabb{ fn into(self)->strafesnet_common::aabb::Aabb{
strafesnet_common::aabb::Aabb::new( strafesnet_common::aabb::Aabb::new(
strafesnet_common::integer::Planar64Vec3::raw_array(self.min), strafesnet_common::integer::vec3::raw_array(self.min),
strafesnet_common::integer::Planar64Vec3::raw_array(self.max), strafesnet_common::integer::vec3::raw_array(self.max),
) )
} }
} }
impl From<strafesnet_common::aabb::Aabb> for Aabb{ impl From<strafesnet_common::aabb::Aabb> for Aabb{
fn from(value:strafesnet_common::aabb::Aabb)->Self{ fn from(value:strafesnet_common::aabb::Aabb)->Self{
Self{ Self{
max:value.max().get().to_array(), max:value.max().map(|t|t.to_raw()).to_array(),
min:value.min().get().to_array(), min:value.min().map(|t|t.to_raw()).to_array(),
} }
} }
} }

View File

@ -84,16 +84,16 @@ impl Into<strafesnet_common::gameplay_attributes::IntersectingWater> for Interse
strafesnet_common::gameplay_attributes::IntersectingWater{ strafesnet_common::gameplay_attributes::IntersectingWater{
viscosity:strafesnet_common::integer::Planar64::raw(self.viscosity), viscosity:strafesnet_common::integer::Planar64::raw(self.viscosity),
density:strafesnet_common::integer::Planar64::raw(self.density), density:strafesnet_common::integer::Planar64::raw(self.density),
velocity:strafesnet_common::integer::Planar64Vec3::raw_array(self.velocity), velocity:strafesnet_common::integer::vec3::raw_array(self.velocity),
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::IntersectingWater> for IntersectingWater{ impl From<strafesnet_common::gameplay_attributes::IntersectingWater> for IntersectingWater{
fn from(value:strafesnet_common::gameplay_attributes::IntersectingWater)->Self{ fn from(value:strafesnet_common::gameplay_attributes::IntersectingWater)->Self{
Self{ Self{
viscosity:value.viscosity.get(), viscosity:value.viscosity.to_raw(),
density:value.density.get(), density:value.density.to_raw(),
velocity:value.velocity.get().to_array(), velocity:value.velocity.map(|t|t.to_raw()).to_array(),
} }
} }
} }
@ -106,14 +106,14 @@ pub struct Accelerator{
impl Into<strafesnet_common::gameplay_attributes::Accelerator> for Accelerator{ impl Into<strafesnet_common::gameplay_attributes::Accelerator> for Accelerator{
fn into(self)->strafesnet_common::gameplay_attributes::Accelerator{ fn into(self)->strafesnet_common::gameplay_attributes::Accelerator{
strafesnet_common::gameplay_attributes::Accelerator{ strafesnet_common::gameplay_attributes::Accelerator{
acceleration:strafesnet_common::integer::Planar64Vec3::raw_array(self.acceleration) acceleration:strafesnet_common::integer::vec3::raw_array(self.acceleration)
} }
} }
} }
impl From<strafesnet_common::gameplay_attributes::Accelerator> for Accelerator{ impl From<strafesnet_common::gameplay_attributes::Accelerator> for Accelerator{
fn from(value:strafesnet_common::gameplay_attributes::Accelerator)->Self{ fn from(value:strafesnet_common::gameplay_attributes::Accelerator)->Self{
Self{ Self{
acceleration:value.acceleration.get().to_array(), acceleration:value.acceleration.map(|t|t.to_raw()).to_array(),
} }
} }
} }
@ -136,11 +136,11 @@ impl Into<strafesnet_common::gameplay_attributes::Booster> for Booster{
match self{ match self{
Booster::Velocity(velocity)=> Booster::Velocity(velocity)=>
strafesnet_common::gameplay_attributes::Booster::Velocity( strafesnet_common::gameplay_attributes::Booster::Velocity(
strafesnet_common::integer::Planar64Vec3::raw_array(velocity) strafesnet_common::integer::vec3::raw_array(velocity)
), ),
Booster::Energy{direction,energy}=> Booster::Energy{direction,energy}=>
strafesnet_common::gameplay_attributes::Booster::Energy{ strafesnet_common::gameplay_attributes::Booster::Energy{
direction:strafesnet_common::integer::Planar64Vec3::raw_array(direction), direction:strafesnet_common::integer::vec3::raw_array(direction),
energy:strafesnet_common::integer::Planar64::raw(energy) energy:strafesnet_common::integer::Planar64::raw(energy)
}, },
Booster::AirTime(time)=> Booster::AirTime(time)=>
@ -158,16 +158,16 @@ impl From<strafesnet_common::gameplay_attributes::Booster> for Booster{
fn from(value:strafesnet_common::gameplay_attributes::Booster)->Self{ fn from(value:strafesnet_common::gameplay_attributes::Booster)->Self{
match value{ match value{
strafesnet_common::gameplay_attributes::Booster::Velocity(velocity)=> strafesnet_common::gameplay_attributes::Booster::Velocity(velocity)=>
Booster::Velocity(velocity.get().to_array()), Booster::Velocity(velocity.map(|t|t.to_raw()).to_array()),
strafesnet_common::gameplay_attributes::Booster::Energy{direction,energy}=> strafesnet_common::gameplay_attributes::Booster::Energy{direction,energy}=>
Booster::Energy{ Booster::Energy{
direction:direction.get().to_array(), direction:direction.map(|t|t.to_raw()).to_array(),
energy:energy.get(), energy:energy.to_raw(),
}, },
strafesnet_common::gameplay_attributes::Booster::AirTime(time)=> strafesnet_common::gameplay_attributes::Booster::AirTime(time)=>
Booster::AirTime(time.get()), Booster::AirTime(time.get()),
strafesnet_common::gameplay_attributes::Booster::Height(height)=> strafesnet_common::gameplay_attributes::Booster::Height(height)=>
Booster::Height(height.get()), Booster::Height(height.to_raw()),
} }
} }
} }
@ -235,23 +235,23 @@ impl Into<strafesnet_common::gameplay_attributes::SetTrajectory> for SetTrajecto
), ),
SetTrajectory::DotVelocity{direction,dot}=> SetTrajectory::DotVelocity{direction,dot}=>
strafesnet_common::gameplay_attributes::SetTrajectory::DotVelocity{ strafesnet_common::gameplay_attributes::SetTrajectory::DotVelocity{
direction:strafesnet_common::integer::Planar64Vec3::raw_array(direction), direction:strafesnet_common::integer::vec3::raw_array(direction),
dot:strafesnet_common::integer::Planar64::raw(dot), dot:strafesnet_common::integer::Planar64::raw(dot),
}, },
SetTrajectory::TargetPointTime{target_point,time}=> SetTrajectory::TargetPointTime{target_point,time}=>
strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointTime{ strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointTime{
target_point:strafesnet_common::integer::Planar64Vec3::raw_array(target_point), target_point:strafesnet_common::integer::vec3::raw_array(target_point),
time:strafesnet_common::integer::Time::raw(time), time:strafesnet_common::integer::Time::raw(time),
}, },
SetTrajectory::TargetPointSpeed{target_point,speed,trajectory_choice}=> SetTrajectory::TargetPointSpeed{target_point,speed,trajectory_choice}=>
strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointSpeed{ strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointSpeed{
target_point:strafesnet_common::integer::Planar64Vec3::raw_array(target_point), target_point:strafesnet_common::integer::vec3::raw_array(target_point),
speed:strafesnet_common::integer::Planar64::raw(speed), speed:strafesnet_common::integer::Planar64::raw(speed),
trajectory_choice:trajectory_choice.into(), trajectory_choice:trajectory_choice.into(),
}, },
SetTrajectory::Velocity(velocity)=> SetTrajectory::Velocity(velocity)=>
strafesnet_common::gameplay_attributes::SetTrajectory::Velocity( strafesnet_common::gameplay_attributes::SetTrajectory::Velocity(
strafesnet_common::integer::Planar64Vec3::raw_array(velocity) strafesnet_common::integer::vec3::raw_array(velocity)
), ),
} }
} }
@ -265,27 +265,27 @@ impl From<strafesnet_common::gameplay_attributes::SetTrajectory> for SetTrajecto
), ),
strafesnet_common::gameplay_attributes::SetTrajectory::Height(height)=> strafesnet_common::gameplay_attributes::SetTrajectory::Height(height)=>
SetTrajectory::Height( SetTrajectory::Height(
height.get() height.to_raw()
), ),
strafesnet_common::gameplay_attributes::SetTrajectory::DotVelocity{direction,dot}=> strafesnet_common::gameplay_attributes::SetTrajectory::DotVelocity{direction,dot}=>
SetTrajectory::DotVelocity{ SetTrajectory::DotVelocity{
direction:direction.get().to_array(), direction:direction.map(|t|t.to_raw()).to_array(),
dot:dot.get(), dot:dot.to_raw(),
}, },
strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointTime{target_point,time}=> strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointTime{target_point,time}=>
SetTrajectory::TargetPointTime{ SetTrajectory::TargetPointTime{
target_point:target_point.get().to_array(), target_point:target_point.map(|t|t.to_raw()).to_array(),
time:time.get(), time:time.get(),
}, },
strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointSpeed{target_point,speed,trajectory_choice}=> strafesnet_common::gameplay_attributes::SetTrajectory::TargetPointSpeed{target_point,speed,trajectory_choice}=>
SetTrajectory::TargetPointSpeed{ SetTrajectory::TargetPointSpeed{
target_point:target_point.get().to_array(), target_point:target_point.map(|t|t.to_raw()).to_array(),
speed:speed.get(), speed:speed.to_raw(),
trajectory_choice:trajectory_choice.into(), trajectory_choice:trajectory_choice.into(),
}, },
strafesnet_common::gameplay_attributes::SetTrajectory::Velocity(velocity)=> strafesnet_common::gameplay_attributes::SetTrajectory::Velocity(velocity)=>
SetTrajectory::Velocity( SetTrajectory::Velocity(
velocity.get().to_array() velocity.map(|t|t.to_raw()).to_array()
), ),
} }
} }

View File

@ -68,9 +68,9 @@ impl TryInto<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifie
walk:self.walk.map(Into::into), walk:self.walk.map(Into::into),
ladder:self.ladder.map(Into::into), ladder:self.ladder.map(Into::into),
swim:self.swim.map(Into::into), swim:self.swim.map(Into::into),
gravity:strafesnet_common::integer::Planar64Vec3::raw_array(self.gravity), gravity:strafesnet_common::integer::vec3::raw_array(self.gravity),
hitbox:self.hitbox.into(), hitbox:self.hitbox.into(),
camera_offset:strafesnet_common::integer::Planar64Vec3::raw_array(self.camera_offset), camera_offset:strafesnet_common::integer::vec3::raw_array(self.camera_offset),
mass:strafesnet_common::integer::Planar64::raw(self.mass), mass:strafesnet_common::integer::Planar64::raw(self.mass),
}) })
} }
@ -94,10 +94,10 @@ impl From<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifiers{
walk:value.walk.map(Into::into), walk:value.walk.map(Into::into),
ladder:value.ladder.map(Into::into), ladder:value.ladder.map(Into::into),
swim:value.swim.map(Into::into), swim:value.swim.map(Into::into),
gravity:value.gravity.get().to_array(), gravity:value.gravity.map(|t|t.to_raw()).to_array(),
hitbox:value.hitbox.into(), hitbox:value.hitbox.into(),
camera_offset:value.camera_offset.get().to_array(), camera_offset:value.camera_offset.map(|t|t.to_raw()).to_array(),
mass:value.mass.get(), mass:value.mass.to_raw(),
} }
} }
} }
@ -148,9 +148,9 @@ impl From<strafesnet_common::gameplay_style::JumpImpulse> for JumpImpulse{
fn from(value:strafesnet_common::gameplay_style::JumpImpulse)->Self{ fn from(value:strafesnet_common::gameplay_style::JumpImpulse)->Self{
match value{ match value{
strafesnet_common::gameplay_style::JumpImpulse::Time(time)=>JumpImpulse::Time(time.get()), strafesnet_common::gameplay_style::JumpImpulse::Time(time)=>JumpImpulse::Time(time.get()),
strafesnet_common::gameplay_style::JumpImpulse::Height(height)=>JumpImpulse::Height(height.get()), strafesnet_common::gameplay_style::JumpImpulse::Height(height)=>JumpImpulse::Height(height.to_raw()),
strafesnet_common::gameplay_style::JumpImpulse::Linear(deltav)=>JumpImpulse::Linear(deltav.get()), strafesnet_common::gameplay_style::JumpImpulse::Linear(deltav)=>JumpImpulse::Linear(deltav.to_raw()),
strafesnet_common::gameplay_style::JumpImpulse::Energy(energy)=>JumpImpulse::Energy(energy.get()), strafesnet_common::gameplay_style::JumpImpulse::Energy(energy)=>JumpImpulse::Energy(energy.to_raw()),
} }
} }
} }
@ -223,8 +223,8 @@ impl From<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
Self{ Self{
header, header,
enable:value.enable.into(), enable:value.enable.into(),
mv:value.mv.get(), mv:value.mv.to_raw(),
air_accel_limit:value.air_accel_limit.map(|a|a.get()), air_accel_limit:value.air_accel_limit.map(|a|a.to_raw()),
tick_rate:value.tick_rate.into(), tick_rate:value.tick_rate.into(),
} }
} }
@ -245,7 +245,7 @@ impl Into<strafesnet_common::gameplay_style::PropulsionSettings> for PropulsionS
impl From<strafesnet_common::gameplay_style::PropulsionSettings> for PropulsionSettings{ impl From<strafesnet_common::gameplay_style::PropulsionSettings> for PropulsionSettings{
fn from(value:strafesnet_common::gameplay_style::PropulsionSettings)->Self{ fn from(value:strafesnet_common::gameplay_style::PropulsionSettings)->Self{
Self{ Self{
magnitude:value.magnitude.get(), magnitude:value.magnitude.to_raw(),
} }
} }
} }
@ -300,9 +300,9 @@ impl From<strafesnet_common::gameplay_style::JumpSettings> for JumpSettings{
fn from(value:strafesnet_common::gameplay_style::JumpSettings)->Self{ fn from(value:strafesnet_common::gameplay_style::JumpSettings)->Self{
let (impulse,impulse_header)=match value.impulse{ let (impulse,impulse_header)=match value.impulse{
strafesnet_common::gameplay_style::JumpImpulse::Time(impulse)=>(impulse.get(),0), strafesnet_common::gameplay_style::JumpImpulse::Time(impulse)=>(impulse.get(),0),
strafesnet_common::gameplay_style::JumpImpulse::Height(impulse)=>(impulse.get(),1), strafesnet_common::gameplay_style::JumpImpulse::Height(impulse)=>(impulse.to_raw(),1),
strafesnet_common::gameplay_style::JumpImpulse::Linear(impulse)=>(impulse.get(),2), strafesnet_common::gameplay_style::JumpImpulse::Linear(impulse)=>(impulse.to_raw(),2),
strafesnet_common::gameplay_style::JumpImpulse::Energy(impulse)=>(impulse.get(),3), strafesnet_common::gameplay_style::JumpImpulse::Energy(impulse)=>(impulse.to_raw(),3),
}; };
let calculation_header=match value.calculation{ let calculation_header=match value.calculation{
strafesnet_common::gameplay_style::JumpCalculation::Max=>0, strafesnet_common::gameplay_style::JumpCalculation::Max=>0,
@ -337,8 +337,8 @@ impl Into<strafesnet_common::gameplay_style::AccelerateSettings> for AccelerateS
impl From<strafesnet_common::gameplay_style::AccelerateSettings> for AccelerateSettings{ impl From<strafesnet_common::gameplay_style::AccelerateSettings> for AccelerateSettings{
fn from(value:strafesnet_common::gameplay_style::AccelerateSettings)->Self{ fn from(value:strafesnet_common::gameplay_style::AccelerateSettings)->Self{
Self{ Self{
accel:value.accel.get(), accel:value.accel.to_raw(),
topspeed:value.topspeed.get(), topspeed:value.topspeed.to_raw(),
} }
} }
} }
@ -365,9 +365,9 @@ impl From<strafesnet_common::gameplay_style::WalkSettings> for WalkSettings{
fn from(value:strafesnet_common::gameplay_style::WalkSettings)->Self{ fn from(value:strafesnet_common::gameplay_style::WalkSettings)->Self{
Self{ Self{
accelerate:value.accelerate.into(), accelerate:value.accelerate.into(),
static_friction:value.static_friction.get(), static_friction:value.static_friction.to_raw(),
kinetic_friction:value.kinetic_friction.get(), kinetic_friction:value.kinetic_friction.to_raw(),
surf_dot:value.surf_dot.get(), surf_dot:value.surf_dot.to_raw(),
} }
} }
} }
@ -390,7 +390,7 @@ impl From<strafesnet_common::gameplay_style::LadderSettings> for LadderSettings{
fn from(value:strafesnet_common::gameplay_style::LadderSettings)->Self{ fn from(value:strafesnet_common::gameplay_style::LadderSettings)->Self{
Self{ Self{
accelerate:value.accelerate.into(), accelerate:value.accelerate.into(),
dot:value.dot.get(), dot:value.dot.to_raw(),
} }
} }
} }
@ -427,7 +427,7 @@ pub struct Hitbox{
impl Into<strafesnet_common::gameplay_style::Hitbox> for Hitbox{ impl Into<strafesnet_common::gameplay_style::Hitbox> for Hitbox{
fn into(self)->strafesnet_common::gameplay_style::Hitbox{ fn into(self)->strafesnet_common::gameplay_style::Hitbox{
strafesnet_common::gameplay_style::Hitbox{ strafesnet_common::gameplay_style::Hitbox{
halfsize:strafesnet_common::integer::Planar64Vec3::raw_array(self.halfsize), halfsize:strafesnet_common::integer::vec3::raw_array(self.halfsize),
mesh:self.mesh.into(), mesh:self.mesh.into(),
} }
} }
@ -435,7 +435,7 @@ impl Into<strafesnet_common::gameplay_style::Hitbox> for Hitbox{
impl From<strafesnet_common::gameplay_style::Hitbox> for Hitbox{ impl From<strafesnet_common::gameplay_style::Hitbox> for Hitbox{
fn from(value:strafesnet_common::gameplay_style::Hitbox)->Self{ fn from(value:strafesnet_common::gameplay_style::Hitbox)->Self{
Self{ Self{
halfsize:value.halfsize.get().to_array(), halfsize:value.halfsize.map(|t|t.to_raw()).to_array(),
mesh:value.mesh.into(), mesh:value.mesh.into(),
} }
} }

View File

@ -153,8 +153,8 @@ pub struct Mesh{
impl Into<strafesnet_common::model::Mesh> for Mesh{ impl Into<strafesnet_common::model::Mesh> for Mesh{
fn into(self)->strafesnet_common::model::Mesh{ fn into(self)->strafesnet_common::model::Mesh{
strafesnet_common::model::Mesh{ strafesnet_common::model::Mesh{
unique_pos:self.unique_pos.into_iter().map(strafesnet_common::integer::Planar64Vec3::raw_array).collect(), unique_pos:self.unique_pos.into_iter().map(strafesnet_common::integer::vec3::raw_array).collect(),
unique_normal:self.unique_normal.into_iter().map(strafesnet_common::integer::Planar64Vec3::raw_array).collect(), unique_normal:self.unique_normal.into_iter().map(strafesnet_common::integer::vec3::raw_array).collect(),
unique_tex:self.unique_tex.into_iter().map(strafesnet_common::model::TextureCoordinate::from_array).collect(), unique_tex:self.unique_tex.into_iter().map(strafesnet_common::model::TextureCoordinate::from_array).collect(),
unique_color:self.unique_color.into_iter().map(strafesnet_common::model::Color4::from_array).collect(), unique_color:self.unique_color.into_iter().map(strafesnet_common::model::Color4::from_array).collect(),
unique_vertices:self.unique_vertices.into_iter().map(|vert|strafesnet_common::model::IndexedVertex{ unique_vertices:self.unique_vertices.into_iter().map(|vert|strafesnet_common::model::IndexedVertex{
@ -200,10 +200,10 @@ impl From<strafesnet_common::model::Mesh> for Mesh{
physics_groups:value.physics_groups.len() as u32, physics_groups:value.physics_groups.len() as u32,
}, },
unique_pos:value.unique_pos.into_iter() unique_pos:value.unique_pos.into_iter()
.map(|pos|pos.get().to_array()) .map(|pos|pos.map(|t|t.to_raw()).to_array())
.collect(), .collect(),
unique_normal:value.unique_normal.into_iter() unique_normal:value.unique_normal.into_iter()
.map(|normal|normal.get().to_array()) .map(|normal|normal.map(|t|t.to_raw()).to_array())
.collect(), .collect(),
unique_tex:value.unique_tex.into_iter() unique_tex:value.unique_tex.into_iter()
.map(|tex|tex.to_array()) .map(|tex|tex.to_array())
@ -243,12 +243,12 @@ impl Into<strafesnet_common::model::Model> for Model{
attributes:strafesnet_common::gameplay_attributes::CollisionAttributesId::new(self.attributes), attributes:strafesnet_common::gameplay_attributes::CollisionAttributesId::new(self.attributes),
color:strafesnet_common::model::Color4::from_array(self.color), color:strafesnet_common::model::Color4::from_array(self.color),
transform:strafesnet_common::integer::Planar64Affine3::new( transform:strafesnet_common::integer::Planar64Affine3::new(
strafesnet_common::integer::Planar64Mat3::from_cols( strafesnet_common::integer::Planar64Mat3::from_cols([
strafesnet_common::integer::Planar64Vec3::raw_xyz(_0,_1,_2), strafesnet_common::integer::vec3::raw_xyz(_0,_1,_2),
strafesnet_common::integer::Planar64Vec3::raw_xyz(_3,_4,_5), strafesnet_common::integer::vec3::raw_xyz(_3,_4,_5),
strafesnet_common::integer::Planar64Vec3::raw_xyz(_6,_7,_8) strafesnet_common::integer::vec3::raw_xyz(_6,_7,_8)
), ]),
strafesnet_common::integer::Planar64Vec3::raw_xyz(_9,_a,_b) strafesnet_common::integer::vec3::raw_xyz(_9,_a,_b)
), ),
} }
} }
@ -261,10 +261,10 @@ impl From<strafesnet_common::model::Model> for Model{
[_6,_7,_8], [_6,_7,_8],
[_9,_a,_b] [_9,_a,_b]
)=( )=(
value.transform.matrix3.x_axis.get().to_array(), value.transform.matrix3.x_axis.map(|t|t.to_raw()).to_array(),
value.transform.matrix3.y_axis.get().to_array(), value.transform.matrix3.y_axis.map(|t|t.to_raw()).to_array(),
value.transform.matrix3.z_axis.get().to_array(), value.transform.matrix3.z_axis.map(|t|t.to_raw()).to_array(),
value.transform.translation.get().to_array() value.transform.translation.map(|t|t.to_raw()).to_array()
); );
Self{ Self{
mesh:value.mesh.get(), mesh:value.mesh.get(),