Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
c7999d08af | |||
e0725cba8a | |||
5ec99a75dc | |||
943d78a9fb | |||
b6fede20bf | |||
020eae4781 |
61
Cargo.lock
generated
61
Cargo.lock
generated
@ -8,12 +8,6 @@ version = "2.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
|
checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "arrayvec"
|
|
||||||
version = "0.7.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "binrw"
|
name = "binrw"
|
||||||
version = "0.14.0"
|
version = "0.14.0"
|
||||||
@ -44,17 +38,11 @@ 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.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83"
|
checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "either"
|
name = "either"
|
||||||
@ -62,18 +50,6 @@ 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"
|
||||||
@ -91,29 +67,12 @@ 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"
|
||||||
@ -132,30 +91,20 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ratio_ops"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
|
||||||
checksum = "01239195d6afe0509e7e3511b716c0540251dfe7ece0a9a5a27116afb766c42c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strafesnet_common"
|
name = "strafesnet_common"
|
||||||
version = "0.5.0"
|
version = "0.1.3"
|
||||||
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
source = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
||||||
checksum = "d8fcc44793ae84a1d80882f367980913292241c94eb87584de4010bdad4a918d"
|
checksum = "10a7e3b69506893bbdde90ce8a9d75cd56d280c0424d2dfdf98f8520179d0c1b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"fixed_wide",
|
|
||||||
"glam",
|
"glam",
|
||||||
"id",
|
"id",
|
||||||
"linear_ops",
|
|
||||||
"ratio_ops",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strafesnet_snf"
|
name = "strafesnet_snf"
|
||||||
version = "0.2.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"binrw",
|
"binrw",
|
||||||
"id",
|
"id",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "strafesnet_snf"
|
name = "strafesnet_snf"
|
||||||
version = "0.2.0"
|
version = "0.1.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.5.0", registry = "strafesnet" }
|
strafesnet_common = { version = "0.1.3", registry = "strafesnet" }
|
||||||
|
@ -101,6 +101,7 @@ impl<R:BinReaderExt> File<R>{
|
|||||||
}
|
}
|
||||||
let block_start=self.header.block_location[block_id.get() as usize];
|
let block_start=self.header.block_location[block_id.get() as usize];
|
||||||
let block_end=self.header.block_location[block_id.get() as usize+1];
|
let block_end=self.header.block_location[block_id.get() as usize+1];
|
||||||
|
//println!("reading from {} to {}",block_start,block_end);
|
||||||
self.data.seek(std::io::SeekFrom::Start(block_start)).map_err(Error::Seek)?;
|
self.data.seek(std::io::SeekFrom::Start(block_start)).map_err(Error::Seek)?;
|
||||||
Ok(self.as_mut().take_seek(block_end-block_start))
|
Ok(self.as_mut().take_seek(block_end-block_start))
|
||||||
}
|
}
|
||||||
|
190
src/map.rs
190
src/map.rs
@ -12,7 +12,6 @@ use strafesnet_common::gameplay_modes;
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error{
|
pub enum Error{
|
||||||
InvalidHeader(binrw::Error),
|
InvalidHeader(binrw::Error),
|
||||||
InvalidMode(newtypes::gameplay_modes::ModeError),
|
|
||||||
InvalidBlockId(BlockId),
|
InvalidBlockId(BlockId),
|
||||||
InvalidMeshId(model::MeshId),
|
InvalidMeshId(model::MeshId),
|
||||||
InvalidModelId(model::ModelId),
|
InvalidModelId(model::ModelId),
|
||||||
@ -164,6 +163,114 @@ struct MapHeader{
|
|||||||
render_configs:Vec<newtypes::model::RenderConfig>,
|
render_configs:Vec<newtypes::model::RenderConfig>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn read_vec<'a,R:BinReaderExt,T:binrw::BinRead>(len:usize,input:&mut R)->Result<Vec<T>,binrw::Error>
|
||||||
|
where
|
||||||
|
<T as binrw::BinRead>::Args<'a>: Default
|
||||||
|
{
|
||||||
|
let mut vec=Vec::with_capacity(len);
|
||||||
|
for _ in 0..len{
|
||||||
|
vec.push(input.read_le()?);
|
||||||
|
}
|
||||||
|
Ok(vec)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_stage<R:BinReaderExt>(input:&mut R)->Result<newtypes::gameplay_modes::Stage,binrw::Error>{
|
||||||
|
let spawn=input.read_le()?;
|
||||||
|
let ordered_checkpoints_count=input.read_le()?;
|
||||||
|
let unordered_checkpoints_count=input.read_le()?;
|
||||||
|
//println!("ordered_checkpoints_count={ordered_checkpoints_count}");
|
||||||
|
//println!("unordered_checkpoints_count={unordered_checkpoints_count}");
|
||||||
|
let ordered_checkpoints=read_vec(ordered_checkpoints_count as usize,input)?;
|
||||||
|
let unordered_checkpoints=read_vec(unordered_checkpoints_count as usize,input)?;
|
||||||
|
Ok(newtypes::gameplay_modes::Stage{
|
||||||
|
spawn,
|
||||||
|
ordered_checkpoints_count,
|
||||||
|
unordered_checkpoints_count,
|
||||||
|
ordered_checkpoints,
|
||||||
|
unordered_checkpoints,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_stages<R:BinReaderExt>(len:usize,input:&mut R)->Result<Vec<newtypes::gameplay_modes::Stage>,binrw::Error>{
|
||||||
|
let mut vec=Vec::with_capacity(len);
|
||||||
|
for _ in 0..len{
|
||||||
|
vec.push(read_stage(input)?);
|
||||||
|
}
|
||||||
|
Ok(vec)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_mode<R:BinReaderExt>(input:&mut R)->Result<newtypes::gameplay_modes::Mode,binrw::Error>{
|
||||||
|
//println!("read_mode pos={}",input.stream_position().unwrap());
|
||||||
|
let header:newtypes::gameplay_modes::ModeHeader=input.read_le()?;
|
||||||
|
//println!("mode.header pos={}",input.stream_position().unwrap());
|
||||||
|
let style=input.read_le()?;
|
||||||
|
//println!("mode.style pos={}",input.stream_position().unwrap());
|
||||||
|
let start=input.read_le()?;
|
||||||
|
//println!("mode.start pos={}",input.stream_position().unwrap());
|
||||||
|
let zones=read_vec(header.zones as usize,input)?;
|
||||||
|
//println!("mode.zones pos={}",input.stream_position().unwrap());
|
||||||
|
let stages=read_stages(header.stages as usize,input)?;
|
||||||
|
//println!("mode.stages pos={}",input.stream_position().unwrap());
|
||||||
|
let elements=read_vec(header.elements as usize,input)?;
|
||||||
|
Ok(newtypes::gameplay_modes::Mode{
|
||||||
|
header,
|
||||||
|
style,
|
||||||
|
start,
|
||||||
|
zones,
|
||||||
|
stages,
|
||||||
|
elements,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_modes<R:BinReaderExt>(len:usize,input:&mut R)->Result<Vec<newtypes::gameplay_modes::Mode>,binrw::Error>{
|
||||||
|
let mut vec=Vec::with_capacity(len);
|
||||||
|
for _ in 0..len{
|
||||||
|
vec.push(read_mode(input)?);
|
||||||
|
}
|
||||||
|
Ok(vec)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_map_header<R:BinReaderExt>(input:&mut R)->Result<MapHeader,binrw::Error>{
|
||||||
|
let p=input.stream_position().unwrap();
|
||||||
|
println!("read_map_header pos={}",p);
|
||||||
|
let num_spacial_blocks:u32=input.read_le()?;
|
||||||
|
println!("map_header.num_spacial_blocks pos={}",input.stream_position().unwrap()-p);
|
||||||
|
let num_resource_blocks:u32=input.read_le()?;
|
||||||
|
println!("map_header.num_resource_blocks pos={}",input.stream_position().unwrap()-p);
|
||||||
|
//let num_resources_external:u32=input.read_le()?;
|
||||||
|
let num_modes:u32=input.read_le()?;
|
||||||
|
println!("map_header.num_modes pos={}",input.stream_position().unwrap()-p);
|
||||||
|
let num_attributes:u32=input.read_le()?;
|
||||||
|
println!("map_header.num_attributes pos={}",input.stream_position().unwrap()-p);
|
||||||
|
let num_render_configs:u32=input.read_le()?;
|
||||||
|
println!("map_header.num_render_configs pos={}",input.stream_position().unwrap()-p);
|
||||||
|
let spacial_blocks:Vec<SpacialBlockHeader>=read_vec(num_spacial_blocks as usize,input)?;
|
||||||
|
println!("map_header.spacial_blocks pos={}",input.stream_position().unwrap()-p);
|
||||||
|
let resource_blocks:Vec<ResourceBlockHeader>=read_vec(num_resource_blocks as usize,input)?;
|
||||||
|
println!("map_header.resource_blocks pos={}",input.stream_position().unwrap()-p);
|
||||||
|
//let external_resources:Vec<ResourceExternalHeader>=read_vec(num_resources_external as usize,input)?;
|
||||||
|
let modes:Vec<newtypes::gameplay_modes::Mode>=read_modes(num_modes as usize,input)?;
|
||||||
|
println!("map_header.modes pos={}",input.stream_position().unwrap()-p);
|
||||||
|
let attributes:Vec<newtypes::gameplay_attributes::CollisionAttributes>=read_vec(num_attributes as usize,input)?;
|
||||||
|
println!("map_header.attributes pos={} len={}",input.stream_position().unwrap()-p,num_attributes);
|
||||||
|
let render_configs:Vec<newtypes::model::RenderConfig>=read_vec(num_render_configs as usize,input)?;
|
||||||
|
println!("map_header.render_configs pos={} len={}",input.stream_position().unwrap()-p,num_render_configs);
|
||||||
|
Ok(MapHeader{
|
||||||
|
num_spacial_blocks,
|
||||||
|
num_resource_blocks,
|
||||||
|
//num_resources_external,
|
||||||
|
num_modes,
|
||||||
|
num_attributes,
|
||||||
|
num_render_configs,
|
||||||
|
spacial_blocks,
|
||||||
|
resource_blocks,
|
||||||
|
//external_resources,
|
||||||
|
modes,
|
||||||
|
attributes,
|
||||||
|
render_configs,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
struct Region{
|
struct Region{
|
||||||
@ -214,8 +321,13 @@ pub struct StreamableMap<R:BinReaderExt>{
|
|||||||
impl<R:BinReaderExt> StreamableMap<R>{
|
impl<R:BinReaderExt> StreamableMap<R>{
|
||||||
pub(crate) fn new(mut file:crate::file::File<R>)->Result<Self,Error>{
|
pub(crate) fn new(mut file:crate::file::File<R>)->Result<Self,Error>{
|
||||||
//assume the file seek is in the right place to start reading a map header
|
//assume the file seek is in the right place to start reading a map header
|
||||||
let header:MapHeader=file.as_mut().read_le().map_err(Error::InvalidHeader)?;
|
let mut f=file.as_mut();
|
||||||
let modes=header.modes.into_iter().map(TryInto::try_into).collect::<Result<_,_>>().map_err(Error::InvalidMode)?;
|
//let mut f=file.block_reader(BlockId::new(0)).map_err(Error::File)?;
|
||||||
|
println!("file header end position={}",f.stream_position().unwrap());
|
||||||
|
//let header:MapHeader=f.read_le().map_err(Error::InvalidHeader)?;
|
||||||
|
let header=read_map_header(&mut f).map_err(Error::InvalidHeader)?;
|
||||||
|
println!("map header end position={}",f.stream_position().unwrap());
|
||||||
|
let modes=header.modes.into_iter().map(Into::into).collect();
|
||||||
let attributes=header.attributes.into_iter().map(Into::into).collect();
|
let attributes=header.attributes.into_iter().map(Into::into).collect();
|
||||||
let render_configs=header.render_configs.into_iter().map(Into::into).collect();
|
let render_configs=header.render_configs.into_iter().map(Into::into).collect();
|
||||||
let bvh=header.spacial_blocks.into_iter().map(|spacial_block|
|
let bvh=header.spacial_blocks.into_iter().map(|spacial_block|
|
||||||
@ -306,6 +418,58 @@ impl<R:BinReaderExt> StreamableMap<R>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use binrw::BinWrite;
|
||||||
|
|
||||||
|
fn write_mode<W:std::io::Seek+std::io::Write>(mode:&newtypes::gameplay_modes::Mode,output:&mut W)->Result<(),binrw::Error>{
|
||||||
|
//println!("write_mode pos={}",output.stream_position().unwrap());
|
||||||
|
mode.header.write_le(output)?;
|
||||||
|
//println!("mode.header pos={}",output.stream_position().unwrap());
|
||||||
|
mode.style.write_le(output)?;
|
||||||
|
//println!("mode.style pos={}",output.stream_position().unwrap());
|
||||||
|
mode.start.write_le(output)?;
|
||||||
|
//println!("mode.start pos={}",output.stream_position().unwrap());
|
||||||
|
mode.zones.write_le(output)?;
|
||||||
|
//println!("mode.zones pos={}",output.stream_position().unwrap());
|
||||||
|
mode.stages.write_le(output)?;
|
||||||
|
//println!("mode.stages pos={}",output.stream_position().unwrap());
|
||||||
|
mode.elements.write_le(output)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_modes<W:std::io::Seek+std::io::Write>(modes:&Vec<newtypes::gameplay_modes::Mode>,output:&mut W)->Result<(),binrw::Error>{
|
||||||
|
for mode in modes{
|
||||||
|
write_mode(mode,output)?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_map_header<W:std::io::Seek+std::io::Write>(map_header:&MapHeader,output:&mut W)->Result<(),binrw::Error>{
|
||||||
|
println!("write_map_header pos={}",output.stream_position().unwrap());
|
||||||
|
map_header.num_spacial_blocks.write_le(output)?;
|
||||||
|
println!("map_header.num_spacial_blocks pos={}",output.stream_position().unwrap());
|
||||||
|
map_header.num_resource_blocks.write_le(output)?;
|
||||||
|
println!("map_header.num_resource_blocks pos={}",output.stream_position().unwrap());
|
||||||
|
//map_header.num_resources_external.write_le(output)?;
|
||||||
|
map_header.num_modes.write_le(output)?;
|
||||||
|
println!("map_header.num_modes pos={}",output.stream_position().unwrap());
|
||||||
|
map_header.num_attributes.write_le(output)?;
|
||||||
|
println!("map_header.num_attributes pos={}",output.stream_position().unwrap());
|
||||||
|
map_header.num_render_configs.write_le(output)?;
|
||||||
|
println!("map_header.num_render_configs pos={}",output.stream_position().unwrap());
|
||||||
|
map_header.spacial_blocks.write_le(output)?;
|
||||||
|
println!("map_header.spacial_blocks pos={}",output.stream_position().unwrap());
|
||||||
|
map_header.resource_blocks.write_le(output)?;
|
||||||
|
println!("map_header.resource_blocks pos={}",output.stream_position().unwrap());
|
||||||
|
//map_header.external_resources.write_le(output)?;
|
||||||
|
write_modes(&map_header.modes,output)?;
|
||||||
|
println!("map_header.modes pos={}",output.stream_position().unwrap());
|
||||||
|
map_header.attributes.write_le(output)?;
|
||||||
|
println!("map_header.attributes pos={}",output.stream_position().unwrap());
|
||||||
|
map_header.render_configs.write_le(output)?;
|
||||||
|
println!("map_header.render_configs pos={}",output.stream_position().unwrap());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
const BVH_NODE_MAX_WEIGHT:usize=64*1024;//64 kB
|
const BVH_NODE_MAX_WEIGHT:usize=64*1024;//64 kB
|
||||||
fn collect_spacial_blocks(
|
fn collect_spacial_blocks(
|
||||||
block_location:&mut Vec<u64>,
|
block_location:&mut Vec<u64>,
|
||||||
@ -357,7 +521,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).fix_1());
|
aabb.grow(model.transform.transform_point3(pos));
|
||||||
}
|
}
|
||||||
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<_>,_>>()?;
|
||||||
@ -374,6 +538,7 @@ pub fn write_map<W:BinWriterExt>(mut writer:W,map:strafesnet_common::map::Comple
|
|||||||
let mut cursor_to_data=std::io::Cursor::new(&mut sequential_block_data);
|
let mut cursor_to_data=std::io::Cursor::new(&mut sequential_block_data);
|
||||||
collect_spacial_blocks(&mut block_location,&mut spacial_blocks,&mut cursor_to_data,bvh)?;
|
collect_spacial_blocks(&mut block_location,&mut spacial_blocks,&mut cursor_to_data,bvh)?;
|
||||||
let mut block_count=spacial_blocks.len() as u32+1;//continue block id
|
let mut block_count=spacial_blocks.len() as u32+1;//continue block id
|
||||||
|
println!("spacial_blocks={}",block_count);
|
||||||
let mut resource_blocks=Vec::new();//for map header
|
let mut resource_blocks=Vec::new();//for map header
|
||||||
//meshes
|
//meshes
|
||||||
for mesh in map.meshes.into_iter(){
|
for mesh in map.meshes.into_iter(){
|
||||||
@ -386,6 +551,8 @@ pub fn write_map<W:BinWriterExt>(mut writer:W,map:strafesnet_common::map::Comple
|
|||||||
binrw::BinWrite::write_le(&serializable_mesh,&mut cursor_to_data).map_err(Error::InvalidData)?;
|
binrw::BinWrite::write_le(&serializable_mesh,&mut cursor_to_data).map_err(Error::InvalidData)?;
|
||||||
block_location.push(cursor_to_data.position());
|
block_location.push(cursor_to_data.position());
|
||||||
}
|
}
|
||||||
|
let aaa=block_count;
|
||||||
|
println!("mesh_blocks={}",block_count-(spacial_blocks.len() as u32));
|
||||||
//textures
|
//textures
|
||||||
for mut texture in map.textures.into_iter(){
|
for mut texture in map.textures.into_iter(){
|
||||||
resource_blocks.push(ResourceBlockHeader{
|
resource_blocks.push(ResourceBlockHeader{
|
||||||
@ -396,6 +563,7 @@ pub fn write_map<W:BinWriterExt>(mut writer:W,map:strafesnet_common::map::Comple
|
|||||||
sequential_block_data.append(&mut texture);
|
sequential_block_data.append(&mut texture);
|
||||||
block_location.push(sequential_block_data.len() as u64);
|
block_location.push(sequential_block_data.len() as u64);
|
||||||
}
|
}
|
||||||
|
println!("texture_blocks={}",block_count-aaa);
|
||||||
//build header
|
//build header
|
||||||
let map_header=MapHeader{
|
let map_header=MapHeader{
|
||||||
num_spacial_blocks:spacial_blocks.len() as u32,
|
num_spacial_blocks:spacial_blocks.len() as u32,
|
||||||
@ -423,7 +591,7 @@ pub fn write_map<W:BinWriterExt>(mut writer:W,map:strafesnet_common::map::Comple
|
|||||||
let mut file_header_data=Vec::new();
|
let mut file_header_data=Vec::new();
|
||||||
binrw::BinWrite::write_le(&file_header,&mut std::io::Cursor::new(&mut file_header_data)).map_err(Error::InvalidData)?;
|
binrw::BinWrite::write_le(&file_header,&mut std::io::Cursor::new(&mut file_header_data)).map_err(Error::InvalidData)?;
|
||||||
let mut map_header_data=Vec::new();
|
let mut map_header_data=Vec::new();
|
||||||
binrw::BinWrite::write_le(&map_header,&mut std::io::Cursor::new(&mut map_header_data)).map_err(Error::InvalidData)?;
|
write_map_header(&map_header,&mut std::io::Cursor::new(&mut map_header_data)).map_err(Error::InvalidData)?;
|
||||||
|
|
||||||
//update file header according to probe data
|
//update file header according to probe data
|
||||||
let mut offset=file_header_data.len() as u64;
|
let mut offset=file_header_data.len() as u64;
|
||||||
@ -434,6 +602,18 @@ pub fn write_map<W:BinWriterExt>(mut writer:W,map:strafesnet_common::map::Comple
|
|||||||
*position+=offset;
|
*position+=offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//debug
|
||||||
|
println!("block_count={}",file_header.block_count);
|
||||||
|
println!("block_locations[0..10]={:?}",&file_header.block_location[0..10]);
|
||||||
|
println!("file header len={}",file_header_data.len());
|
||||||
|
println!("map header len={}",map_header_data.len());
|
||||||
|
println!("num_spacial_blocks={}",map_header.num_spacial_blocks);
|
||||||
|
println!("num_resource_blocks={}",map_header.num_resource_blocks);
|
||||||
|
//println!("num_resources_external={}",map_header.num_resources_external);
|
||||||
|
println!("num_modes={}",map_header.num_modes);
|
||||||
|
println!("num_attributes={}",map_header.num_attributes);
|
||||||
|
println!("num_render_configs={}",map_header.num_render_configs);
|
||||||
|
|
||||||
//write (updated) file header
|
//write (updated) file header
|
||||||
writer.write_le(&file_header).map_err(Error::InvalidData)?;
|
writer.write_le(&file_header).map_err(Error::InvalidData)?;
|
||||||
//write map header
|
//write map header
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
mod common;
|
|
||||||
pub mod aabb;
|
pub mod aabb;
|
||||||
pub mod model;
|
pub mod model;
|
||||||
pub mod integer;
|
pub mod integer;
|
||||||
|
@ -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::vec3::raw_array(self.min),
|
strafesnet_common::integer::Planar64Vec3::raw_array(self.min),
|
||||||
strafesnet_common::integer::vec3::raw_array(self.max),
|
strafesnet_common::integer::Planar64Vec3::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().map(|t|t.to_raw()).to_array(),
|
max:value.max().get().to_array(),
|
||||||
min:value.min().map(|t|t.to_raw()).to_array(),
|
min:value.min().get().to_array(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
pub const fn flag(b:bool,mask:u8)->u8{
|
|
||||||
(-(b as i8) as u8)&mask
|
|
||||||
}
|
|
||||||
|
|
||||||
#[binrw::binrw]
|
|
||||||
#[brw(little,repr=u8)]
|
|
||||||
pub enum Boolio{
|
|
||||||
True,
|
|
||||||
False
|
|
||||||
}
|
|
||||||
impl Into<bool> for Boolio{
|
|
||||||
fn into(self)->bool{
|
|
||||||
match self{
|
|
||||||
Boolio::True=>true,
|
|
||||||
Boolio::False=>false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<bool> for Boolio{
|
|
||||||
fn from(value:bool)->Self{
|
|
||||||
match value{
|
|
||||||
true=>Boolio::True,
|
|
||||||
false=>Boolio::False,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,28 @@
|
|||||||
use super::common::{flag,Boolio};
|
|
||||||
use super::integer::{Time,Planar64,Planar64Vec3};
|
use super::integer::{Time,Planar64,Planar64Vec3};
|
||||||
|
|
||||||
|
#[binrw::binrw]
|
||||||
|
#[brw(little,repr=u8)]
|
||||||
|
pub enum Boolio{
|
||||||
|
True,
|
||||||
|
False
|
||||||
|
}
|
||||||
|
impl Into<bool> for Boolio{
|
||||||
|
fn into(self)->bool{
|
||||||
|
match self{
|
||||||
|
Boolio::True=>true,
|
||||||
|
Boolio::False=>false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl From<bool> for Boolio{
|
||||||
|
fn from(value:bool)->Self{
|
||||||
|
match value{
|
||||||
|
true=>Boolio::True,
|
||||||
|
false=>Boolio::False,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct ContactingLadder{
|
pub struct ContactingLadder{
|
||||||
@ -84,16 +106,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::vec3::raw_array(self.velocity),
|
velocity:strafesnet_common::integer::Planar64Vec3::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.to_raw(),
|
viscosity:value.viscosity.get(),
|
||||||
density:value.density.to_raw(),
|
density:value.density.get(),
|
||||||
velocity:value.velocity.map(|t|t.to_raw()).to_array(),
|
velocity:value.velocity.get().to_array(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,14 +128,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::vec3::raw_array(self.acceleration)
|
acceleration:strafesnet_common::integer::Planar64Vec3::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.map(|t|t.to_raw()).to_array(),
|
acceleration:value.acceleration.get().to_array(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,32 +147,19 @@ pub enum Booster{
|
|||||||
Velocity(Planar64Vec3),
|
Velocity(Planar64Vec3),
|
||||||
#[brw(magic=1u8)]
|
#[brw(magic=1u8)]
|
||||||
Energy{direction:Planar64Vec3,energy:Planar64},
|
Energy{direction:Planar64Vec3,energy:Planar64},
|
||||||
#[brw(magic=2u8)]
|
|
||||||
AirTime(Time),
|
|
||||||
#[brw(magic=3u8)]
|
|
||||||
Height(Planar64),
|
|
||||||
|
|
||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_attributes::Booster> for Booster{
|
impl Into<strafesnet_common::gameplay_attributes::Booster> for Booster{
|
||||||
fn into(self)->strafesnet_common::gameplay_attributes::Booster{
|
fn into(self)->strafesnet_common::gameplay_attributes::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::vec3::raw_array(velocity)
|
strafesnet_common::integer::Planar64Vec3::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::vec3::raw_array(direction),
|
direction:strafesnet_common::integer::Planar64Vec3::raw_array(direction),
|
||||||
energy:strafesnet_common::integer::Planar64::raw(energy)
|
energy:strafesnet_common::integer::Planar64::raw(energy)
|
||||||
},
|
},
|
||||||
Booster::AirTime(time)=>
|
|
||||||
strafesnet_common::gameplay_attributes::Booster::AirTime(
|
|
||||||
strafesnet_common::integer::Time::raw(time)
|
|
||||||
),
|
|
||||||
Booster::Height(height)=>
|
|
||||||
strafesnet_common::gameplay_attributes::Booster::Height(
|
|
||||||
strafesnet_common::integer::Planar64::raw(height)
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,16 +167,12 @@ 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.map(|t|t.to_raw()).to_array()),
|
Booster::Velocity(velocity.get().to_array()),
|
||||||
strafesnet_common::gameplay_attributes::Booster::Energy{direction,energy}=>
|
strafesnet_common::gameplay_attributes::Booster::Energy{direction,energy}=>
|
||||||
Booster::Energy{
|
Booster::Energy{
|
||||||
direction:direction.map(|t|t.to_raw()).to_array(),
|
direction:direction.get().to_array(),
|
||||||
energy:energy.to_raw(),
|
energy:energy.get(),
|
||||||
},
|
},
|
||||||
strafesnet_common::gameplay_attributes::Booster::AirTime(time)=>
|
|
||||||
Booster::AirTime(time.get()),
|
|
||||||
strafesnet_common::gameplay_attributes::Booster::Height(height)=>
|
|
||||||
Booster::Height(height.to_raw()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,23 +240,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::vec3::raw_array(direction),
|
direction:strafesnet_common::integer::Planar64Vec3::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::vec3::raw_array(target_point),
|
target_point:strafesnet_common::integer::Planar64Vec3::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::vec3::raw_array(target_point),
|
target_point:strafesnet_common::integer::Planar64Vec3::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::vec3::raw_array(velocity)
|
strafesnet_common::integer::Planar64Vec3::raw_array(velocity)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,27 +270,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.to_raw()
|
height.get()
|
||||||
),
|
),
|
||||||
strafesnet_common::gameplay_attributes::SetTrajectory::DotVelocity{direction,dot}=>
|
strafesnet_common::gameplay_attributes::SetTrajectory::DotVelocity{direction,dot}=>
|
||||||
SetTrajectory::DotVelocity{
|
SetTrajectory::DotVelocity{
|
||||||
direction:direction.map(|t|t.to_raw()).to_array(),
|
direction:direction.get().to_array(),
|
||||||
dot:dot.to_raw(),
|
dot:dot.get(),
|
||||||
},
|
},
|
||||||
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.map(|t|t.to_raw()).to_array(),
|
target_point:target_point.get().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.map(|t|t.to_raw()).to_array(),
|
target_point:target_point.get().to_array(),
|
||||||
speed:speed.to_raw(),
|
speed:speed.get(),
|
||||||
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.map(|t|t.to_raw()).to_array()
|
velocity.get().to_array()
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -313,46 +318,48 @@ impl From<strafesnet_common::gameplay_attributes::Wormhole> for Wormhole{
|
|||||||
|
|
||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct GeneralAttributes{
|
pub struct GeneralAttributesHeader{
|
||||||
pub header:u8,
|
pub booster:u8,
|
||||||
#[br(if(header&Self::BOOSTER!=0))]
|
pub trajectory:u8,
|
||||||
pub booster:Option<Booster>,
|
pub wormhole:u8,
|
||||||
#[br(if(header&Self::TRAJECTORY!=0))]
|
pub accelerator:u8,
|
||||||
pub trajectory:Option<SetTrajectory>,
|
|
||||||
#[br(if(header&Self::WORMHOLE!=0))]
|
|
||||||
pub wormhole:Option<Wormhole>,
|
|
||||||
#[br(if(header&Self::ACCELERATOR!=0))]
|
|
||||||
pub accelerator:Option<Accelerator>,
|
|
||||||
}
|
}
|
||||||
impl GeneralAttributes{
|
#[binrw::binrw]
|
||||||
const BOOSTER:u8=1<<0;
|
#[brw(little)]
|
||||||
const TRAJECTORY:u8=1<<1;
|
pub struct GeneralAttributes{
|
||||||
const WORMHOLE:u8=1<<2;
|
pub header:GeneralAttributesHeader,
|
||||||
const ACCELERATOR:u8=1<<3;
|
#[br(count=header.booster)]
|
||||||
|
pub booster:Vec<Booster>,
|
||||||
|
#[br(count=header.trajectory)]
|
||||||
|
pub trajectory:Vec<SetTrajectory>,
|
||||||
|
#[br(count=header.wormhole)]
|
||||||
|
pub wormhole:Vec<Wormhole>,
|
||||||
|
#[br(count=header.accelerator)]
|
||||||
|
pub accelerator:Vec<Accelerator>,
|
||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_attributes::GeneralAttributes> for GeneralAttributes{
|
impl Into<strafesnet_common::gameplay_attributes::GeneralAttributes> for GeneralAttributes{
|
||||||
fn into(self)->strafesnet_common::gameplay_attributes::GeneralAttributes{
|
fn into(mut self)->strafesnet_common::gameplay_attributes::GeneralAttributes{
|
||||||
strafesnet_common::gameplay_attributes::GeneralAttributes{
|
strafesnet_common::gameplay_attributes::GeneralAttributes{
|
||||||
booster:self.booster.map(Into::into),
|
booster:self.booster.pop().map(Into::into),
|
||||||
trajectory:self.trajectory.map(Into::into),
|
trajectory:self.trajectory.pop().map(Into::into),
|
||||||
wormhole:self.wormhole.map(Into::into),
|
wormhole:self.wormhole.pop().map(Into::into),
|
||||||
accelerator:self.accelerator.map(Into::into),
|
accelerator:self.accelerator.pop().map(Into::into),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_attributes::GeneralAttributes> for GeneralAttributes{
|
impl From<strafesnet_common::gameplay_attributes::GeneralAttributes> for GeneralAttributes{
|
||||||
fn from(value:strafesnet_common::gameplay_attributes::GeneralAttributes)->Self{
|
fn from(value:strafesnet_common::gameplay_attributes::GeneralAttributes)->Self{
|
||||||
let header=
|
|
||||||
flag(value.booster.is_some(),GeneralAttributes::BOOSTER)
|
|
||||||
|flag(value.trajectory.is_some(),GeneralAttributes::TRAJECTORY)
|
|
||||||
|flag(value.wormhole.is_some(),GeneralAttributes::WORMHOLE)
|
|
||||||
|flag(value.accelerator.is_some(),GeneralAttributes::ACCELERATOR);
|
|
||||||
Self{
|
Self{
|
||||||
header,
|
header:GeneralAttributesHeader{
|
||||||
booster:value.booster.map(Into::into),
|
booster:value.booster.is_some() as u8,
|
||||||
trajectory:value.trajectory.map(Into::into),
|
trajectory:value.trajectory.is_some() as u8,
|
||||||
wormhole:value.wormhole.map(Into::into),
|
wormhole:value.wormhole.is_some() as u8,
|
||||||
accelerator:value.accelerator.map(Into::into),
|
accelerator:value.accelerator.is_some() as u8,
|
||||||
|
},
|
||||||
|
booster:super::gameplay_style::stupid(value.booster.map(Into::into)),
|
||||||
|
trajectory:super::gameplay_style::stupid(value.trajectory.map(Into::into)),
|
||||||
|
wormhole:super::gameplay_style::stupid(value.wormhole.map(Into::into)),
|
||||||
|
accelerator:super::gameplay_style::stupid(value.accelerator.map(Into::into)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -360,25 +367,22 @@ impl From<strafesnet_common::gameplay_attributes::GeneralAttributes> for General
|
|||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct ContactingAttributes{
|
pub struct ContactingAttributes{
|
||||||
pub header:u8,
|
pub contact_behaviour_enabled:u8,
|
||||||
#[br(if(header&Self::CONTACTING_BEHAVIOUR!=0))]
|
#[br(count=contact_behaviour_enabled)]
|
||||||
pub contact_behaviour:Option<ContactingBehaviour>,
|
pub contact_behaviour:Vec<ContactingBehaviour>,
|
||||||
}
|
|
||||||
impl ContactingAttributes{
|
|
||||||
const CONTACTING_BEHAVIOUR:u8=1<<0;
|
|
||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_attributes::ContactingAttributes> for ContactingAttributes{
|
impl Into<strafesnet_common::gameplay_attributes::ContactingAttributes> for ContactingAttributes{
|
||||||
fn into(self)->strafesnet_common::gameplay_attributes::ContactingAttributes{
|
fn into(mut self)->strafesnet_common::gameplay_attributes::ContactingAttributes{
|
||||||
strafesnet_common::gameplay_attributes::ContactingAttributes{
|
strafesnet_common::gameplay_attributes::ContactingAttributes{
|
||||||
contact_behaviour:self.contact_behaviour.map(Into::into),
|
contact_behaviour:self.contact_behaviour.pop().map(Into::into),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_attributes::ContactingAttributes> for ContactingAttributes{
|
impl From<strafesnet_common::gameplay_attributes::ContactingAttributes> for ContactingAttributes{
|
||||||
fn from(value:strafesnet_common::gameplay_attributes::ContactingAttributes)->Self{
|
fn from(value:strafesnet_common::gameplay_attributes::ContactingAttributes)->Self{
|
||||||
Self{
|
Self{
|
||||||
header:flag(value.contact_behaviour.is_some(),ContactingAttributes::CONTACTING_BEHAVIOUR),
|
contact_behaviour_enabled:value.contact_behaviour.is_some() as u8,
|
||||||
contact_behaviour:value.contact_behaviour.map(Into::into),
|
contact_behaviour:super::gameplay_style::stupid(value.contact_behaviour.map(Into::into)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -386,71 +390,22 @@ impl From<strafesnet_common::gameplay_attributes::ContactingAttributes> for Cont
|
|||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct IntersectingAttributes{
|
pub struct IntersectingAttributes{
|
||||||
pub header:u8,
|
pub water_enabled:u8,
|
||||||
#[br(if(header&Self::INTERSECTING_WATER!=0))]
|
#[br(count=water_enabled)]
|
||||||
pub water:Option<IntersectingWater>,
|
pub water:Vec<IntersectingWater>,
|
||||||
}
|
|
||||||
impl IntersectingAttributes{
|
|
||||||
const INTERSECTING_WATER:u8=1<<0;
|
|
||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_attributes::IntersectingAttributes> for IntersectingAttributes{
|
impl Into<strafesnet_common::gameplay_attributes::IntersectingAttributes> for IntersectingAttributes{
|
||||||
fn into(self)->strafesnet_common::gameplay_attributes::IntersectingAttributes{
|
fn into(mut self)->strafesnet_common::gameplay_attributes::IntersectingAttributes{
|
||||||
strafesnet_common::gameplay_attributes::IntersectingAttributes{
|
strafesnet_common::gameplay_attributes::IntersectingAttributes{
|
||||||
water:self.water.map(Into::into),
|
water:self.water.pop().map(Into::into),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_attributes::IntersectingAttributes> for IntersectingAttributes{
|
impl From<strafesnet_common::gameplay_attributes::IntersectingAttributes> for IntersectingAttributes{
|
||||||
fn from(value:strafesnet_common::gameplay_attributes::IntersectingAttributes)->Self{
|
fn from(value:strafesnet_common::gameplay_attributes::IntersectingAttributes)->Self{
|
||||||
Self{
|
Self{
|
||||||
header:flag(value.water.is_some(),IntersectingAttributes::INTERSECTING_WATER),
|
water_enabled:value.water.is_some() as u8,
|
||||||
water:value.water.map(Into::into),
|
water:super::gameplay_style::stupid(value.water.map(Into::into)),
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[binrw::binrw]
|
|
||||||
#[brw(little)]
|
|
||||||
pub struct ContactAttributes{
|
|
||||||
contacting:ContactingAttributes,
|
|
||||||
general:GeneralAttributes,
|
|
||||||
}
|
|
||||||
impl Into<strafesnet_common::gameplay_attributes::ContactAttributes> for ContactAttributes{
|
|
||||||
fn into(self)->strafesnet_common::gameplay_attributes::ContactAttributes{
|
|
||||||
strafesnet_common::gameplay_attributes::ContactAttributes{
|
|
||||||
contacting:self.contacting.into(),
|
|
||||||
general:self.general.into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<strafesnet_common::gameplay_attributes::ContactAttributes> for ContactAttributes{
|
|
||||||
fn from(value:strafesnet_common::gameplay_attributes::ContactAttributes)->Self{
|
|
||||||
Self{
|
|
||||||
contacting:value.contacting.into(),
|
|
||||||
general:value.general.into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[binrw::binrw]
|
|
||||||
#[brw(little)]
|
|
||||||
pub struct IntersectAttributes{
|
|
||||||
intersecting:IntersectingAttributes,
|
|
||||||
general:GeneralAttributes,
|
|
||||||
}
|
|
||||||
impl Into<strafesnet_common::gameplay_attributes::IntersectAttributes> for IntersectAttributes{
|
|
||||||
fn into(self)->strafesnet_common::gameplay_attributes::IntersectAttributes{
|
|
||||||
strafesnet_common::gameplay_attributes::IntersectAttributes{
|
|
||||||
intersecting:self.intersecting.into(),
|
|
||||||
general:self.general.into(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<strafesnet_common::gameplay_attributes::IntersectAttributes> for IntersectAttributes{
|
|
||||||
fn from(value:strafesnet_common::gameplay_attributes::IntersectAttributes)->Self{
|
|
||||||
Self{
|
|
||||||
intersecting:value.intersecting.into(),
|
|
||||||
general:value.general.into(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -461,19 +416,25 @@ pub enum CollisionAttributes{
|
|||||||
#[brw(magic=0u8)]
|
#[brw(magic=0u8)]
|
||||||
Decoration,
|
Decoration,
|
||||||
#[brw(magic=1u8)]
|
#[brw(magic=1u8)]
|
||||||
Contact(ContactAttributes),
|
Contact{
|
||||||
|
contacting:ContactingAttributes,
|
||||||
|
general:GeneralAttributes,
|
||||||
|
},
|
||||||
#[brw(magic=2u8)]
|
#[brw(magic=2u8)]
|
||||||
Intersect(IntersectAttributes),
|
Intersect{
|
||||||
|
intersecting:IntersectingAttributes,
|
||||||
|
general:GeneralAttributes,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_attributes::CollisionAttributes> for CollisionAttributes{
|
impl Into<strafesnet_common::gameplay_attributes::CollisionAttributes> for CollisionAttributes{
|
||||||
fn into(self)->strafesnet_common::gameplay_attributes::CollisionAttributes{
|
fn into(self)->strafesnet_common::gameplay_attributes::CollisionAttributes{
|
||||||
match self{
|
match self{
|
||||||
CollisionAttributes::Decoration=>
|
CollisionAttributes::Decoration=>
|
||||||
strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration,
|
strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration,
|
||||||
CollisionAttributes::Contact(attr)=>
|
CollisionAttributes::Contact{contacting,general}=>
|
||||||
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact(attr.into()),
|
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact{contacting:contacting.into(),general:general.into()},
|
||||||
CollisionAttributes::Intersect(attr)=>
|
CollisionAttributes::Intersect{intersecting,general}=>
|
||||||
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect(attr.into()),
|
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect{intersecting:intersecting.into(),general:general.into()},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -482,10 +443,10 @@ impl From<strafesnet_common::gameplay_attributes::CollisionAttributes> for Colli
|
|||||||
match value{
|
match value{
|
||||||
strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration=>
|
strafesnet_common::gameplay_attributes::CollisionAttributes::Decoration=>
|
||||||
CollisionAttributes::Decoration,
|
CollisionAttributes::Decoration,
|
||||||
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact(attr)=>
|
strafesnet_common::gameplay_attributes::CollisionAttributes::Contact{contacting,general}=>
|
||||||
CollisionAttributes::Contact(attr.into()),
|
CollisionAttributes::Contact{contacting:contacting.into(),general:general.into()},
|
||||||
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect(attr)=>
|
strafesnet_common::gameplay_attributes::CollisionAttributes::Intersect{intersecting,general}=>
|
||||||
CollisionAttributes::Intersect(attr.into()),
|
CollisionAttributes::Intersect{intersecting:intersecting.into(),general:general.into()},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,74 +1,68 @@
|
|||||||
use super::common::flag;
|
#[binrw::binrw]
|
||||||
|
#[brw(little,repr=u8)]
|
||||||
pub type ModeId=u32;
|
pub enum StageElementBehaviour{
|
||||||
pub type StageId=u32;
|
SpawnAt,//must be standing on top to get effect. except cancollide false
|
||||||
|
Trigger,
|
||||||
|
Teleport,
|
||||||
|
Platform,
|
||||||
|
//Check(point) acts like a trigger if you haven't hit all the checkpoints on previous stages yet.
|
||||||
|
//Note that all stage elements act like this, this is just the isolated behaviour.
|
||||||
|
Check,
|
||||||
|
Checkpoint,//this is a combined behaviour for Ordered & Unordered in case a model is used multiple times or for both.
|
||||||
|
}
|
||||||
|
impl Into<strafesnet_common::gameplay_modes::StageElementBehaviour> for StageElementBehaviour{
|
||||||
|
fn into(self)->strafesnet_common::gameplay_modes::StageElementBehaviour{
|
||||||
|
match self{
|
||||||
|
StageElementBehaviour::SpawnAt=>strafesnet_common::gameplay_modes::StageElementBehaviour::SpawnAt,
|
||||||
|
StageElementBehaviour::Trigger=>strafesnet_common::gameplay_modes::StageElementBehaviour::Trigger,
|
||||||
|
StageElementBehaviour::Teleport=>strafesnet_common::gameplay_modes::StageElementBehaviour::Teleport,
|
||||||
|
StageElementBehaviour::Platform=>strafesnet_common::gameplay_modes::StageElementBehaviour::Platform,
|
||||||
|
StageElementBehaviour::Check=>strafesnet_common::gameplay_modes::StageElementBehaviour::Check,
|
||||||
|
StageElementBehaviour::Checkpoint=>strafesnet_common::gameplay_modes::StageElementBehaviour::Checkpoint,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl From<strafesnet_common::gameplay_modes::StageElementBehaviour> for StageElementBehaviour{
|
||||||
|
fn from(value:strafesnet_common::gameplay_modes::StageElementBehaviour)->Self{
|
||||||
|
match value{
|
||||||
|
strafesnet_common::gameplay_modes::StageElementBehaviour::SpawnAt=>StageElementBehaviour::SpawnAt,
|
||||||
|
strafesnet_common::gameplay_modes::StageElementBehaviour::Trigger=>StageElementBehaviour::Trigger,
|
||||||
|
strafesnet_common::gameplay_modes::StageElementBehaviour::Teleport=>StageElementBehaviour::Teleport,
|
||||||
|
strafesnet_common::gameplay_modes::StageElementBehaviour::Platform=>StageElementBehaviour::Platform,
|
||||||
|
strafesnet_common::gameplay_modes::StageElementBehaviour::Check=>StageElementBehaviour::Check,
|
||||||
|
strafesnet_common::gameplay_modes::StageElementBehaviour::Checkpoint=>StageElementBehaviour::Checkpoint,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct StageElement{
|
pub struct StageElement{
|
||||||
pub header:u8,
|
pub stage_id:u32,//which stage spawn to send to
|
||||||
pub stage_id:StageId,
|
pub behaviour:StageElementBehaviour,
|
||||||
#[br(if(header&Self::JUMP_LIMIT!=0))]
|
pub jump_limit_enabled:u8,
|
||||||
pub jump_limit:Option<u8>,
|
#[br(count=jump_limit_enabled)]
|
||||||
|
pub jump_limit:Vec<u8>,
|
||||||
|
pub force:super::gameplay_attributes::Boolio,//allow setting to lower spawn id i.e. 7->3
|
||||||
}
|
}
|
||||||
impl StageElement{
|
impl Into<strafesnet_common::gameplay_modes::StageElement> for StageElement{
|
||||||
const BEHAVIOUR:u8=0b00111;
|
fn into(mut self)->strafesnet_common::gameplay_modes::StageElement{
|
||||||
const JUMP_LIMIT:u8=1<<3;
|
strafesnet_common::gameplay_modes::StageElement::new(
|
||||||
const FORCE:u8=1<<4;
|
|
||||||
const fn behaviour(&self)->Option<strafesnet_common::gameplay_modes::StageElementBehaviour>{
|
|
||||||
match self.header&Self::BEHAVIOUR{
|
|
||||||
0=>Some(strafesnet_common::gameplay_modes::StageElementBehaviour::SpawnAt),
|
|
||||||
1=>Some(strafesnet_common::gameplay_modes::StageElementBehaviour::Trigger),
|
|
||||||
2=>Some(strafesnet_common::gameplay_modes::StageElementBehaviour::Teleport),
|
|
||||||
3=>Some(strafesnet_common::gameplay_modes::StageElementBehaviour::Platform),
|
|
||||||
4=>Some(strafesnet_common::gameplay_modes::StageElementBehaviour::Check),
|
|
||||||
5=>Some(strafesnet_common::gameplay_modes::StageElementBehaviour::Checkpoint),
|
|
||||||
_=>None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const fn force(&self)->bool{
|
|
||||||
self.header&Self::FORCE!=0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum StageElementError{
|
|
||||||
InvalidBehaviour,
|
|
||||||
}
|
|
||||||
impl std::fmt::Display for StageElementError{
|
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
|
||||||
write!(f,"{self:?}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl std::error::Error for StageElementError{}
|
|
||||||
impl TryInto<strafesnet_common::gameplay_modes::StageElement> for StageElement{
|
|
||||||
type Error=StageElementError;
|
|
||||||
fn try_into(self)->Result<strafesnet_common::gameplay_modes::StageElement,Self::Error>{
|
|
||||||
Ok(strafesnet_common::gameplay_modes::StageElement::new(
|
|
||||||
strafesnet_common::gameplay_modes::StageId::new(self.stage_id),
|
strafesnet_common::gameplay_modes::StageId::new(self.stage_id),
|
||||||
self.force(),
|
self.force.into(),
|
||||||
self.behaviour().ok_or(StageElementError::InvalidBehaviour)?,
|
self.behaviour.into(),
|
||||||
self.jump_limit,
|
self.jump_limit.pop(),
|
||||||
))
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_modes::StageElement> for StageElement{
|
impl From<strafesnet_common::gameplay_modes::StageElement> for StageElement{
|
||||||
fn from(value:strafesnet_common::gameplay_modes::StageElement)->Self{
|
fn from(value:strafesnet_common::gameplay_modes::StageElement)->Self{
|
||||||
let behaviour=match value.behaviour(){
|
|
||||||
strafesnet_common::gameplay_modes::StageElementBehaviour::SpawnAt=>0,
|
|
||||||
strafesnet_common::gameplay_modes::StageElementBehaviour::Trigger=>1,
|
|
||||||
strafesnet_common::gameplay_modes::StageElementBehaviour::Teleport=>2,
|
|
||||||
strafesnet_common::gameplay_modes::StageElementBehaviour::Platform=>3,
|
|
||||||
strafesnet_common::gameplay_modes::StageElementBehaviour::Check=>4,
|
|
||||||
strafesnet_common::gameplay_modes::StageElementBehaviour::Checkpoint=>5,
|
|
||||||
};
|
|
||||||
let header=
|
|
||||||
behaviour
|
|
||||||
|flag(value.jump_limit().is_some(),StageElement::JUMP_LIMIT)
|
|
||||||
|flag(value.force(),StageElement::FORCE);
|
|
||||||
Self{
|
Self{
|
||||||
header,
|
|
||||||
stage_id:value.stage_id().get(),
|
stage_id:value.stage_id().get(),
|
||||||
jump_limit:value.jump_limit(),
|
behaviour:value.behaviour().into(),
|
||||||
|
jump_limit_enabled:value.jump_limit().is_some() as u8,
|
||||||
|
jump_limit:super::gameplay_style::stupid(value.jump_limit()),
|
||||||
|
force:value.force().into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +117,8 @@ impl From<strafesnet_common::gameplay_modes::Stage> for Stage{
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little,repr=u8)]
|
#[brw(little,repr=u32)]
|
||||||
|
#[repr(u32)]
|
||||||
pub enum Zone{
|
pub enum Zone{
|
||||||
Start,
|
Start,
|
||||||
Finish,
|
Finish,
|
||||||
@ -150,6 +145,7 @@ impl From<strafesnet_common::gameplay_modes::Zone> for Zone{
|
|||||||
|
|
||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct ModeHeader{
|
pub struct ModeHeader{
|
||||||
pub zones:u32,
|
pub zones:u32,
|
||||||
pub stages:u32,
|
pub stages:u32,
|
||||||
@ -168,31 +164,19 @@ pub struct Mode{
|
|||||||
#[br(count=header.elements)]
|
#[br(count=header.elements)]
|
||||||
pub elements:Vec<(u32,StageElement)>,
|
pub elements:Vec<(u32,StageElement)>,
|
||||||
}
|
}
|
||||||
#[derive(Debug)]
|
impl Into<strafesnet_common::gameplay_modes::Mode> for Mode{
|
||||||
pub enum ModeError{
|
fn into(self)->strafesnet_common::gameplay_modes::Mode{
|
||||||
StyleModifier(super::gameplay_style::StyleModifierError),
|
strafesnet_common::gameplay_modes::Mode::new(
|
||||||
StageElement(StageElementError),
|
self.style.into(),
|
||||||
}
|
|
||||||
impl std::fmt::Display for ModeError{
|
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
|
||||||
write!(f,"{self:?}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl std::error::Error for ModeError{}
|
|
||||||
impl TryInto<strafesnet_common::gameplay_modes::Mode> for Mode{
|
|
||||||
type Error=ModeError;
|
|
||||||
fn try_into(self)->Result<strafesnet_common::gameplay_modes::Mode,Self::Error>{
|
|
||||||
Ok(strafesnet_common::gameplay_modes::Mode::new(
|
|
||||||
self.style.try_into().map_err(ModeError::StyleModifier)?,
|
|
||||||
strafesnet_common::model::ModelId::new(self.start),
|
strafesnet_common::model::ModelId::new(self.start),
|
||||||
self.zones.into_iter().map(|(model_id,zone)|
|
self.zones.into_iter().map(|(model_id,zone)|
|
||||||
(strafesnet_common::model::ModelId::new(model_id),zone.into())
|
(strafesnet_common::model::ModelId::new(model_id),zone.into())
|
||||||
).collect(),
|
).collect(),
|
||||||
self.stages.into_iter().map(Into::into).collect(),
|
self.stages.into_iter().map(Into::into).collect(),
|
||||||
self.elements.into_iter().map(|(model_id,stage_element)|
|
self.elements.into_iter().map(|(model_id,stage_element)|
|
||||||
Ok((strafesnet_common::model::ModelId::new(model_id),stage_element.try_into()?))
|
(strafesnet_common::model::ModelId::new(model_id),stage_element.into())
|
||||||
).collect::<Result<_,_>>().map_err(ModeError::StageElement)?,
|
).collect(),
|
||||||
))
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_modes::Mode> for Mode{
|
impl From<strafesnet_common::gameplay_modes::Mode> for Mode{
|
||||||
|
@ -1,103 +1,89 @@
|
|||||||
use super::common::flag;
|
|
||||||
use super::integer::{Time,Ratio64,Planar64,Planar64Vec3};
|
use super::integer::{Time,Ratio64,Planar64,Planar64Vec3};
|
||||||
|
|
||||||
pub type Controls=u32;
|
pub type Controls=u32;
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum ControlsError{
|
#[binrw::binrw]
|
||||||
UnknownBits,
|
#[brw(little)]
|
||||||
|
pub struct StyleModifiersHeader{
|
||||||
|
pub strafe:u8,
|
||||||
|
pub rocket:u8,
|
||||||
|
pub jump:u8,
|
||||||
|
pub walk:u8,
|
||||||
|
pub ladder:u8,
|
||||||
|
pub swim:u8,
|
||||||
}
|
}
|
||||||
impl std::fmt::Display for ControlsError{
|
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
|
||||||
write!(f,"{self:?}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl std::error::Error for ControlsError{}
|
|
||||||
|
|
||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct StyleModifiers{
|
pub struct StyleModifiers{
|
||||||
pub header:u8,
|
pub header:StyleModifiersHeader,
|
||||||
pub controls_mask:Controls,
|
pub controls_mask:Controls,
|
||||||
pub controls_mask_state:Controls,
|
pub controls_mask_state:Controls,
|
||||||
#[br(if(header&Self::STRAFE!=0))]
|
#[br(count=header.strafe)]
|
||||||
pub strafe:Option<StrafeSettings>,
|
pub strafe:Vec<StrafeSettings>,
|
||||||
#[br(if(header&Self::ROCKET!=0))]
|
#[br(count=header.rocket)]
|
||||||
pub rocket:Option<PropulsionSettings>,
|
pub rocket:Vec<PropulsionSettings>,
|
||||||
#[br(if(header&Self::JUMP!=0))]
|
#[br(count=header.jump)]
|
||||||
pub jump:Option<JumpSettings>,
|
pub jump:Vec<JumpSettings>,
|
||||||
#[br(if(header&Self::WALK!=0))]
|
#[br(count=header.walk)]
|
||||||
pub walk:Option<WalkSettings>,
|
pub walk:Vec<WalkSettings>,
|
||||||
#[br(if(header&Self::LADDER!=0))]
|
#[br(count=header.ladder)]
|
||||||
pub ladder:Option<LadderSettings>,
|
pub ladder:Vec<LadderSettings>,
|
||||||
#[br(if(header&Self::SWIM!=0))]
|
#[br(count=header.swim)]
|
||||||
pub swim:Option<PropulsionSettings>,
|
pub swim:Vec<PropulsionSettings>,
|
||||||
pub gravity:Planar64Vec3,
|
pub gravity:Planar64Vec3,
|
||||||
pub hitbox:Hitbox,
|
pub hitbox:Hitbox,
|
||||||
pub camera_offset:Planar64Vec3,
|
pub camera_offset:Planar64Vec3,
|
||||||
pub mass:Planar64,
|
pub mass:Planar64,
|
||||||
}
|
}
|
||||||
impl StyleModifiers{
|
impl Into<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifiers{
|
||||||
const STRAFE:u8=1<<0;
|
fn into(mut self)->strafesnet_common::gameplay_style::StyleModifiers{
|
||||||
const ROCKET:u8=1<<1;
|
strafesnet_common::gameplay_style::StyleModifiers{
|
||||||
const JUMP:u8=1<<2;
|
//TODO: fail gracefully in binrw instead of panicing here
|
||||||
const WALK:u8=1<<3;
|
controls_mask:strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_mask).unwrap(),
|
||||||
const LADDER:u8=1<<4;
|
controls_mask_state:strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_mask_state).unwrap(),
|
||||||
const SWIM:u8=1<<5;
|
strafe:self.strafe.pop().map(Into::into),
|
||||||
}
|
rocket:self.rocket.pop().map(Into::into),
|
||||||
#[derive(Debug)]
|
jump:self.jump.pop().map(Into::into),
|
||||||
pub enum StyleModifierError{
|
walk:self.walk.pop().map(Into::into),
|
||||||
Controls(ControlsError),
|
ladder:self.ladder.pop().map(Into::into),
|
||||||
JumpSettings(JumpSettingsError),
|
swim:self.swim.pop().map(Into::into),
|
||||||
StrafeSettings(StrafeSettingsError),
|
gravity:strafesnet_common::integer::Planar64Vec3::raw_array(self.gravity),
|
||||||
}
|
hitbox:self.hitbox.into(),
|
||||||
impl std::fmt::Display for StyleModifierError{
|
camera_offset:strafesnet_common::integer::Planar64Vec3::raw_array(self.camera_offset),
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
mass:strafesnet_common::integer::Planar64::raw(self.mass),
|
||||||
write!(f,"{self:?}")
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl std::error::Error for StyleModifierError{}
|
pub(crate) fn stupid<T>(o:Option<T>)->Vec<T>{
|
||||||
impl TryInto<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifiers{
|
match o{
|
||||||
type Error=StyleModifierError;
|
Some(v)=>vec![v],
|
||||||
fn try_into(self)->Result<strafesnet_common::gameplay_style::StyleModifiers,Self::Error>{
|
None=>Vec::new(),
|
||||||
Ok(strafesnet_common::gameplay_style::StyleModifiers{
|
|
||||||
controls_mask:strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_mask).ok_or(StyleModifierError::Controls(ControlsError::UnknownBits))?,
|
|
||||||
controls_mask_state:strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_mask_state).ok_or(StyleModifierError::Controls(ControlsError::UnknownBits))?,
|
|
||||||
strafe:self.strafe.map(TryInto::try_into).transpose().map_err(StyleModifierError::StrafeSettings)?,
|
|
||||||
rocket:self.rocket.map(Into::into),
|
|
||||||
jump:self.jump.map(TryInto::try_into).transpose().map_err(StyleModifierError::JumpSettings)?,
|
|
||||||
walk:self.walk.map(Into::into),
|
|
||||||
ladder:self.ladder.map(Into::into),
|
|
||||||
swim:self.swim.map(Into::into),
|
|
||||||
gravity:strafesnet_common::integer::vec3::raw_array(self.gravity),
|
|
||||||
hitbox:self.hitbox.into(),
|
|
||||||
camera_offset:strafesnet_common::integer::vec3::raw_array(self.camera_offset),
|
|
||||||
mass:strafesnet_common::integer::Planar64::raw(self.mass),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifiers{
|
impl From<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifiers{
|
||||||
fn from(value:strafesnet_common::gameplay_style::StyleModifiers)->Self{
|
fn from(value:strafesnet_common::gameplay_style::StyleModifiers)->Self{
|
||||||
let header=
|
|
||||||
flag(value.strafe.is_some(),StyleModifiers::STRAFE)
|
|
||||||
|flag(value.rocket.is_some(),StyleModifiers::ROCKET)
|
|
||||||
|flag(value.jump.is_some(),StyleModifiers::JUMP)
|
|
||||||
|flag(value.walk.is_some(),StyleModifiers::WALK)
|
|
||||||
|flag(value.ladder.is_some(),StyleModifiers::LADDER)
|
|
||||||
|flag(value.swim.is_some(),StyleModifiers::SWIM);
|
|
||||||
Self{
|
Self{
|
||||||
header,
|
header:StyleModifiersHeader{
|
||||||
|
strafe:value.strafe.is_some() as u8,
|
||||||
|
rocket:value.rocket.is_some() as u8,
|
||||||
|
jump:value.jump.is_some() as u8,
|
||||||
|
walk:value.walk.is_some() as u8,
|
||||||
|
ladder:value.ladder.is_some() as u8,
|
||||||
|
swim:value.swim.is_some() as u8,
|
||||||
|
},
|
||||||
controls_mask:value.controls_mask.bits(),
|
controls_mask:value.controls_mask.bits(),
|
||||||
controls_mask_state:value.controls_mask_state.bits(),
|
controls_mask_state:value.controls_mask_state.bits(),
|
||||||
strafe:value.strafe.map(Into::into),
|
strafe:stupid(value.strafe.map(Into::into)),
|
||||||
rocket:value.rocket.map(Into::into),
|
rocket:stupid(value.rocket.map(Into::into)),
|
||||||
jump:value.jump.map(Into::into),
|
jump:stupid(value.jump.map(Into::into)),
|
||||||
walk:value.walk.map(Into::into),
|
walk:stupid(value.walk.map(Into::into)),
|
||||||
ladder:value.ladder.map(Into::into),
|
ladder:stupid(value.ladder.map(Into::into)),
|
||||||
swim:value.swim.map(Into::into),
|
swim:stupid(value.swim.map(Into::into)),
|
||||||
gravity:value.gravity.map(|t|t.to_raw()).to_array(),
|
gravity:value.gravity.get().to_array(),
|
||||||
hitbox:value.hitbox.into(),
|
hitbox:value.hitbox.into(),
|
||||||
camera_offset:value.camera_offset.map(|t|t.to_raw()).to_array(),
|
camera_offset:value.camera_offset.get().to_array(),
|
||||||
mass:value.mass.to_raw(),
|
mass:value.mass.get(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,52 +91,54 @@ impl From<strafesnet_common::gameplay_style::StyleModifiers> for StyleModifiers{
|
|||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little,repr=u8)]
|
#[brw(little,repr=u8)]
|
||||||
pub enum JumpCalculation{
|
pub enum JumpCalculation{
|
||||||
Max,
|
Capped,
|
||||||
BoostThenJump,
|
Energy,
|
||||||
JumpThenBoost,
|
Linear,
|
||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_style::JumpCalculation> for JumpCalculation{
|
impl Into<strafesnet_common::gameplay_style::JumpCalculation> for JumpCalculation{
|
||||||
fn into(self)->strafesnet_common::gameplay_style::JumpCalculation{
|
fn into(self)->strafesnet_common::gameplay_style::JumpCalculation{
|
||||||
match self{
|
match self{
|
||||||
JumpCalculation::Max=>strafesnet_common::gameplay_style::JumpCalculation::Max,
|
JumpCalculation::Capped=>strafesnet_common::gameplay_style::JumpCalculation::Capped,
|
||||||
JumpCalculation::BoostThenJump=>strafesnet_common::gameplay_style::JumpCalculation::BoostThenJump,
|
JumpCalculation::Energy=>strafesnet_common::gameplay_style::JumpCalculation::Energy,
|
||||||
JumpCalculation::JumpThenBoost=>strafesnet_common::gameplay_style::JumpCalculation::JumpThenBoost,
|
JumpCalculation::Linear=>strafesnet_common::gameplay_style::JumpCalculation::Linear,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_style::JumpCalculation> for JumpCalculation{
|
impl From<strafesnet_common::gameplay_style::JumpCalculation> for JumpCalculation{
|
||||||
fn from(value:strafesnet_common::gameplay_style::JumpCalculation)->Self{
|
fn from(value:strafesnet_common::gameplay_style::JumpCalculation)->Self{
|
||||||
match value{
|
match value{
|
||||||
strafesnet_common::gameplay_style::JumpCalculation::Max=>JumpCalculation::Max,
|
strafesnet_common::gameplay_style::JumpCalculation::Capped=>JumpCalculation::Capped,
|
||||||
strafesnet_common::gameplay_style::JumpCalculation::BoostThenJump=>JumpCalculation::BoostThenJump,
|
strafesnet_common::gameplay_style::JumpCalculation::Energy=>JumpCalculation::Energy,
|
||||||
strafesnet_common::gameplay_style::JumpCalculation::JumpThenBoost=>JumpCalculation::JumpThenBoost,
|
strafesnet_common::gameplay_style::JumpCalculation::Linear=>JumpCalculation::Linear,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[binrw::binrw]
|
||||||
|
#[brw(little)]
|
||||||
pub enum JumpImpulse{
|
pub enum JumpImpulse{
|
||||||
Time(Time),
|
FromTime(Time),
|
||||||
Height(Planar64),
|
FromHeight(Planar64),
|
||||||
Linear(Planar64),
|
FromDeltaV(Planar64),
|
||||||
Energy(Planar64),
|
FromEnergy(Planar64),
|
||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_style::JumpImpulse> for JumpImpulse{
|
impl Into<strafesnet_common::gameplay_style::JumpImpulse> for JumpImpulse{
|
||||||
fn into(self)->strafesnet_common::gameplay_style::JumpImpulse{
|
fn into(self)->strafesnet_common::gameplay_style::JumpImpulse{
|
||||||
match self{
|
match self{
|
||||||
JumpImpulse::Time(time)=>strafesnet_common::gameplay_style::JumpImpulse::Time(strafesnet_common::integer::Time::raw(time)),
|
JumpImpulse::FromTime(time)=>strafesnet_common::gameplay_style::JumpImpulse::FromTime(strafesnet_common::integer::Time::raw(time)),
|
||||||
JumpImpulse::Height(height)=>strafesnet_common::gameplay_style::JumpImpulse::Height(strafesnet_common::integer::Planar64::raw(height)),
|
JumpImpulse::FromHeight(height)=>strafesnet_common::gameplay_style::JumpImpulse::FromHeight(strafesnet_common::integer::Planar64::raw(height)),
|
||||||
JumpImpulse::Linear(deltav)=>strafesnet_common::gameplay_style::JumpImpulse::Linear(strafesnet_common::integer::Planar64::raw(deltav)),
|
JumpImpulse::FromDeltaV(deltav)=>strafesnet_common::gameplay_style::JumpImpulse::FromDeltaV(strafesnet_common::integer::Planar64::raw(deltav)),
|
||||||
JumpImpulse::Energy(energy)=>strafesnet_common::gameplay_style::JumpImpulse::Energy(strafesnet_common::integer::Planar64::raw(energy)),
|
JumpImpulse::FromEnergy(energy)=>strafesnet_common::gameplay_style::JumpImpulse::FromEnergy(strafesnet_common::integer::Planar64::raw(energy)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_style::JumpImpulse> for JumpImpulse{
|
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::FromTime(time)=>JumpImpulse::FromTime(time.get()),
|
||||||
strafesnet_common::gameplay_style::JumpImpulse::Height(height)=>JumpImpulse::Height(height.to_raw()),
|
strafesnet_common::gameplay_style::JumpImpulse::FromHeight(height)=>JumpImpulse::FromHeight(height.get()),
|
||||||
strafesnet_common::gameplay_style::JumpImpulse::Linear(deltav)=>JumpImpulse::Linear(deltav.to_raw()),
|
strafesnet_common::gameplay_style::JumpImpulse::FromDeltaV(deltav)=>JumpImpulse::FromDeltaV(deltav.get()),
|
||||||
strafesnet_common::gameplay_style::JumpImpulse::Energy(energy)=>JumpImpulse::Energy(energy.to_raw()),
|
strafesnet_common::gameplay_style::JumpImpulse::FromEnergy(energy)=>JumpImpulse::FromEnergy(energy.get()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,22 +150,21 @@ pub struct ControlsActivation{
|
|||||||
controls_intersects:Controls,
|
controls_intersects:Controls,
|
||||||
controls_contains:Controls,
|
controls_contains:Controls,
|
||||||
}
|
}
|
||||||
impl TryInto<strafesnet_common::gameplay_style::ControlsActivation> for ControlsActivation{
|
impl Into<strafesnet_common::gameplay_style::ControlsActivation> for ControlsActivation{
|
||||||
type Error=ControlsError;
|
fn into(self)->strafesnet_common::gameplay_style::ControlsActivation{
|
||||||
fn try_into(self)->Result<strafesnet_common::gameplay_style::ControlsActivation,Self::Error>{
|
strafesnet_common::gameplay_style::ControlsActivation::new(
|
||||||
Ok(strafesnet_common::gameplay_style::ControlsActivation{
|
strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_mask).unwrap(),
|
||||||
controls_mask:strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_mask).ok_or(ControlsError::UnknownBits)?,
|
strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_intersects).unwrap(),
|
||||||
controls_intersects:strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_intersects).ok_or(ControlsError::UnknownBits)?,
|
strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_contains).unwrap(),
|
||||||
controls_contains:strafesnet_common::controls_bitflag::Controls::from_bits(self.controls_contains).ok_or(ControlsError::UnknownBits)?,
|
)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_style::ControlsActivation> for ControlsActivation{
|
impl From<strafesnet_common::gameplay_style::ControlsActivation> for ControlsActivation{
|
||||||
fn from(value:strafesnet_common::gameplay_style::ControlsActivation)->Self{
|
fn from(value:strafesnet_common::gameplay_style::ControlsActivation)->Self{
|
||||||
Self{
|
Self{
|
||||||
controls_mask:value.controls_mask.bits(),
|
controls_mask:value.controls_mask().bits(),
|
||||||
controls_intersects:value.controls_intersects.bits(),
|
controls_intersects:value.controls_intersects().bits(),
|
||||||
controls_contains:value.controls_contains.bits(),
|
controls_contains:value.controls_contains().bits(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,47 +172,32 @@ impl From<strafesnet_common::gameplay_style::ControlsActivation> for ControlsAct
|
|||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct StrafeSettings{
|
pub struct StrafeSettings{
|
||||||
header:u8,
|
|
||||||
enable:ControlsActivation,
|
enable:ControlsActivation,
|
||||||
mv:Planar64,
|
mv:Planar64,
|
||||||
#[br(if(header&Self::AIR_ACCEL_LIMIT!=0))]
|
air_accel_limit_enabled:u8,
|
||||||
air_accel_limit:Option<Planar64>,
|
#[br(count=air_accel_limit_enabled)]
|
||||||
|
air_accel_limit:Vec<Planar64>,
|
||||||
tick_rate:Ratio64,
|
tick_rate:Ratio64,
|
||||||
}
|
}
|
||||||
impl StrafeSettings{
|
impl Into<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
|
||||||
const AIR_ACCEL_LIMIT:u8=1<<0;
|
fn into(mut self)->strafesnet_common::gameplay_style::StrafeSettings{
|
||||||
}
|
strafesnet_common::gameplay_style::StrafeSettings::new(
|
||||||
#[derive(Debug)]
|
self.enable.into(),
|
||||||
pub enum StrafeSettingsError{
|
strafesnet_common::integer::Planar64::raw(self.mv),
|
||||||
Ratio(super::integer::RatioError),
|
self.air_accel_limit.pop().map(strafesnet_common::integer::Planar64::raw),
|
||||||
Controls(ControlsError),
|
self.tick_rate.into(),
|
||||||
}
|
)
|
||||||
impl std::fmt::Display for StrafeSettingsError{
|
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
|
||||||
write!(f,"{self:?}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl std::error::Error for StrafeSettingsError{}
|
|
||||||
impl TryInto<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
|
|
||||||
type Error=StrafeSettingsError;
|
|
||||||
fn try_into(self)->Result<strafesnet_common::gameplay_style::StrafeSettings,Self::Error>{
|
|
||||||
Ok(strafesnet_common::gameplay_style::StrafeSettings{
|
|
||||||
enable:self.enable.try_into().map_err(StrafeSettingsError::Controls)?,
|
|
||||||
mv:strafesnet_common::integer::Planar64::raw(self.mv),
|
|
||||||
air_accel_limit:self.air_accel_limit.map(strafesnet_common::integer::Planar64::raw),
|
|
||||||
tick_rate:self.tick_rate.try_into().map_err(StrafeSettingsError::Ratio)?,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
|
impl From<strafesnet_common::gameplay_style::StrafeSettings> for StrafeSettings{
|
||||||
fn from(value:strafesnet_common::gameplay_style::StrafeSettings)->Self{
|
fn from(value:strafesnet_common::gameplay_style::StrafeSettings)->Self{
|
||||||
let header=flag(value.air_accel_limit.is_some(),StrafeSettings::AIR_ACCEL_LIMIT);
|
let (enable,mv,air_accel_limit,tick_rate)=value.into_inner();
|
||||||
Self{
|
Self{
|
||||||
header,
|
enable:enable.into(),
|
||||||
enable:value.enable.into(),
|
mv:mv.get(),
|
||||||
mv:value.mv.to_raw(),
|
air_accel_limit_enabled:air_accel_limit.is_some() as u8,
|
||||||
air_accel_limit:value.air_accel_limit.map(|a|a.to_raw()),
|
air_accel_limit:stupid(air_accel_limit.map(|a|a.get())),
|
||||||
tick_rate:value.tick_rate.into(),
|
tick_rate:tick_rate.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,15 +209,15 @@ pub struct PropulsionSettings{
|
|||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_style::PropulsionSettings> for PropulsionSettings{
|
impl Into<strafesnet_common::gameplay_style::PropulsionSettings> for PropulsionSettings{
|
||||||
fn into(self)->strafesnet_common::gameplay_style::PropulsionSettings{
|
fn into(self)->strafesnet_common::gameplay_style::PropulsionSettings{
|
||||||
strafesnet_common::gameplay_style::PropulsionSettings{
|
strafesnet_common::gameplay_style::PropulsionSettings::new(
|
||||||
magnitude:strafesnet_common::integer::Planar64::raw(self.magnitude)
|
strafesnet_common::integer::Planar64::raw(self.magnitude)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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.to_raw(),
|
magnitude:value.magnitude().get(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,69 +225,23 @@ impl From<strafesnet_common::gameplay_style::PropulsionSettings> for PropulsionS
|
|||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct JumpSettings{
|
pub struct JumpSettings{
|
||||||
header:u8,
|
impulse:JumpImpulse,
|
||||||
impulse:i64,
|
calculation:JumpCalculation,
|
||||||
}
|
}
|
||||||
impl JumpSettings{
|
impl Into<strafesnet_common::gameplay_style::JumpSettings> for JumpSettings{
|
||||||
const IMPULSE:u8=0b00011;
|
fn into(self)->strafesnet_common::gameplay_style::JumpSettings{
|
||||||
const CALCULATION:u8=0b01100;
|
strafesnet_common::gameplay_style::JumpSettings::new(
|
||||||
const LIMIT_MINIMUM:u8=0b10000;
|
self.impulse.into(),
|
||||||
const fn impulse(&self)->Option<strafesnet_common::gameplay_style::JumpImpulse>{
|
self.calculation.into(),
|
||||||
match self.header&Self::IMPULSE{
|
)
|
||||||
0=>Some(strafesnet_common::gameplay_style::JumpImpulse::Time(strafesnet_common::integer::Time::raw(self.impulse))),
|
|
||||||
1=>Some(strafesnet_common::gameplay_style::JumpImpulse::Height(strafesnet_common::integer::Planar64::raw(self.impulse))),
|
|
||||||
2=>Some(strafesnet_common::gameplay_style::JumpImpulse::Linear(strafesnet_common::integer::Planar64::raw(self.impulse))),
|
|
||||||
3=>Some(strafesnet_common::gameplay_style::JumpImpulse::Energy(strafesnet_common::integer::Planar64::raw(self.impulse))),
|
|
||||||
_=>None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const fn calculation(&self)->Option<strafesnet_common::gameplay_style::JumpCalculation>{
|
|
||||||
match (self.header&Self::CALCULATION)>>2{
|
|
||||||
0=>Some(strafesnet_common::gameplay_style::JumpCalculation::Max),
|
|
||||||
1=>Some(strafesnet_common::gameplay_style::JumpCalculation::JumpThenBoost),
|
|
||||||
2=>Some(strafesnet_common::gameplay_style::JumpCalculation::BoostThenJump),
|
|
||||||
_=>None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const fn limit_minimum(&self)->bool{
|
|
||||||
self.header&Self::LIMIT_MINIMUM!=0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum JumpSettingsError{
|
|
||||||
InvalidImpulseDiscriminant,
|
|
||||||
InvalidCalculationDiscriminant,
|
|
||||||
}
|
|
||||||
impl TryInto<strafesnet_common::gameplay_style::JumpSettings> for JumpSettings{
|
|
||||||
type Error=JumpSettingsError;
|
|
||||||
fn try_into(self)->Result<strafesnet_common::gameplay_style::JumpSettings,Self::Error>{
|
|
||||||
Ok(strafesnet_common::gameplay_style::JumpSettings{
|
|
||||||
impulse:self.impulse().ok_or(JumpSettingsError::InvalidImpulseDiscriminant)?,
|
|
||||||
calculation:self.calculation().ok_or(JumpSettingsError::InvalidCalculationDiscriminant)?,
|
|
||||||
limit_minimum:self.limit_minimum(),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_style::JumpSettings> for JumpSettings{
|
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,calculation)=value.into_inner();
|
||||||
strafesnet_common::gameplay_style::JumpImpulse::Time(impulse)=>(impulse.get(),0),
|
|
||||||
strafesnet_common::gameplay_style::JumpImpulse::Height(impulse)=>(impulse.to_raw(),1),
|
|
||||||
strafesnet_common::gameplay_style::JumpImpulse::Linear(impulse)=>(impulse.to_raw(),2),
|
|
||||||
strafesnet_common::gameplay_style::JumpImpulse::Energy(impulse)=>(impulse.to_raw(),3),
|
|
||||||
};
|
|
||||||
let calculation_header=match value.calculation{
|
|
||||||
strafesnet_common::gameplay_style::JumpCalculation::Max=>0,
|
|
||||||
strafesnet_common::gameplay_style::JumpCalculation::JumpThenBoost=>1,
|
|
||||||
strafesnet_common::gameplay_style::JumpCalculation::BoostThenJump=>2,
|
|
||||||
};
|
|
||||||
let header=
|
|
||||||
impulse_header
|
|
||||||
|(calculation_header<<2)
|
|
||||||
|((value.limit_minimum as u8)<<4);
|
|
||||||
Self{
|
Self{
|
||||||
header,
|
impulse:impulse.into(),
|
||||||
impulse,
|
calculation:calculation.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,17 +254,17 @@ pub struct AccelerateSettings{
|
|||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_style::AccelerateSettings> for AccelerateSettings{
|
impl Into<strafesnet_common::gameplay_style::AccelerateSettings> for AccelerateSettings{
|
||||||
fn into(self)->strafesnet_common::gameplay_style::AccelerateSettings{
|
fn into(self)->strafesnet_common::gameplay_style::AccelerateSettings{
|
||||||
strafesnet_common::gameplay_style::AccelerateSettings{
|
strafesnet_common::gameplay_style::AccelerateSettings::new(
|
||||||
accel:strafesnet_common::integer::Planar64::raw(self.accel),
|
strafesnet_common::integer::Planar64::raw(self.accel),
|
||||||
topspeed:strafesnet_common::integer::Planar64::raw(self.topspeed),
|
strafesnet_common::integer::Planar64::raw(self.topspeed),
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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.to_raw(),
|
accel:value.accel().get(),
|
||||||
topspeed:value.topspeed.to_raw(),
|
topspeed:value.topspeed().get(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,21 +279,22 @@ pub struct WalkSettings{
|
|||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_style::WalkSettings> for WalkSettings{
|
impl Into<strafesnet_common::gameplay_style::WalkSettings> for WalkSettings{
|
||||||
fn into(self)->strafesnet_common::gameplay_style::WalkSettings{
|
fn into(self)->strafesnet_common::gameplay_style::WalkSettings{
|
||||||
strafesnet_common::gameplay_style::WalkSettings{
|
strafesnet_common::gameplay_style::WalkSettings::new(
|
||||||
accelerate:self.accelerate.into(),
|
self.accelerate.into(),
|
||||||
static_friction:strafesnet_common::integer::Planar64::raw(self.static_friction),
|
strafesnet_common::integer::Planar64::raw(self.static_friction),
|
||||||
kinetic_friction:strafesnet_common::integer::Planar64::raw(self.kinetic_friction),
|
strafesnet_common::integer::Planar64::raw(self.kinetic_friction),
|
||||||
surf_dot:strafesnet_common::integer::Planar64::raw(self.surf_dot),
|
strafesnet_common::integer::Planar64::raw(self.surf_dot),
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_style::WalkSettings> for WalkSettings{
|
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{
|
||||||
|
let (accelerate,static_friction,kinetic_friction,surf_dot)=value.into_inner();
|
||||||
Self{
|
Self{
|
||||||
accelerate:value.accelerate.into(),
|
accelerate:accelerate.into(),
|
||||||
static_friction:value.static_friction.to_raw(),
|
static_friction:static_friction.get(),
|
||||||
kinetic_friction:value.kinetic_friction.to_raw(),
|
kinetic_friction:kinetic_friction.get(),
|
||||||
surf_dot:value.surf_dot.to_raw(),
|
surf_dot:surf_dot.get(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,17 +307,18 @@ pub struct LadderSettings{
|
|||||||
}
|
}
|
||||||
impl Into<strafesnet_common::gameplay_style::LadderSettings> for LadderSettings{
|
impl Into<strafesnet_common::gameplay_style::LadderSettings> for LadderSettings{
|
||||||
fn into(self)->strafesnet_common::gameplay_style::LadderSettings{
|
fn into(self)->strafesnet_common::gameplay_style::LadderSettings{
|
||||||
strafesnet_common::gameplay_style::LadderSettings{
|
strafesnet_common::gameplay_style::LadderSettings::new(
|
||||||
accelerate:self.accelerate.into(),
|
self.accelerate.into(),
|
||||||
dot:strafesnet_common::integer::Planar64::raw(self.dot),
|
strafesnet_common::integer::Planar64::raw(self.dot),
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::gameplay_style::LadderSettings> for LadderSettings{
|
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{
|
||||||
|
let (accelerate,dot)=value.into_inner();
|
||||||
Self{
|
Self{
|
||||||
accelerate:value.accelerate.into(),
|
accelerate:accelerate.into(),
|
||||||
dot:value.dot.to_raw(),
|
dot:dot.get(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -427,7 +355,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::vec3::raw_array(self.halfsize),
|
halfsize:strafesnet_common::integer::Planar64Vec3::raw_array(self.halfsize),
|
||||||
mesh:self.mesh.into(),
|
mesh:self.mesh.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -435,7 +363,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.map(|t|t.to_raw()).to_array(),
|
halfsize:value.halfsize.get().to_array(),
|
||||||
mesh:value.mesh.into(),
|
mesh:value.mesh.into(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,21 +6,9 @@ pub struct Ratio64{
|
|||||||
num:i64,
|
num:i64,
|
||||||
den:u64,
|
den:u64,
|
||||||
}
|
}
|
||||||
#[derive(Debug)]
|
impl Into<strafesnet_common::integer::Ratio64> for Ratio64{
|
||||||
pub enum RatioError{
|
fn into(self)->strafesnet_common::integer::Ratio64{
|
||||||
ZeroDenominator,
|
strafesnet_common::integer::Ratio64::new(self.num,self.den).unwrap()
|
||||||
}
|
|
||||||
impl std::fmt::Display for RatioError{
|
|
||||||
fn fmt(&self,f:&mut std::fmt::Formatter<'_>)->std::fmt::Result{
|
|
||||||
write!(f,"{self:?}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl std::error::Error for RatioError{}
|
|
||||||
impl TryInto<strafesnet_common::integer::Ratio64> for Ratio64{
|
|
||||||
type Error=RatioError;
|
|
||||||
fn try_into(self)->Result<strafesnet_common::integer::Ratio64,Self::Error>{
|
|
||||||
strafesnet_common::integer::Ratio64::new(self.num,self.den)
|
|
||||||
.ok_or(RatioError::ZeroDenominator)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::integer::Ratio64> for Ratio64{
|
impl From<strafesnet_common::integer::Ratio64> for Ratio64{
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use super::common::flag;
|
|
||||||
use strafesnet_common::model::PolygonIter;
|
use strafesnet_common::model::PolygonIter;
|
||||||
|
|
||||||
use super::integer::{Planar64Vec3,Planar64Affine3};
|
use super::integer::{Planar64Vec3,Planar64Affine3};
|
||||||
@ -61,26 +60,22 @@ impl From<strafesnet_common::model::PolygonGroup> for PolygonGroup{
|
|||||||
#[binrw::binrw]
|
#[binrw::binrw]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
pub struct RenderConfig{
|
pub struct RenderConfig{
|
||||||
pub header:u8,
|
pub texture_enabled:u8,
|
||||||
#[br(if(header&Self::TEXTURE!=0))]
|
#[br(count=texture_enabled)]
|
||||||
pub texture:Option<u32>,
|
pub texture:Vec<u32>,
|
||||||
}
|
|
||||||
impl RenderConfig{
|
|
||||||
const TEXTURE:u8=1<<0;
|
|
||||||
}
|
}
|
||||||
impl Into<strafesnet_common::model::RenderConfig> for RenderConfig{
|
impl Into<strafesnet_common::model::RenderConfig> for RenderConfig{
|
||||||
fn into(self)->strafesnet_common::model::RenderConfig{
|
fn into(mut self)->strafesnet_common::model::RenderConfig{
|
||||||
strafesnet_common::model::RenderConfig{
|
strafesnet_common::model::RenderConfig{
|
||||||
texture:self.texture.map(strafesnet_common::model::TextureId::new),
|
texture:self.texture.pop().map(strafesnet_common::model::TextureId::new),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl From<strafesnet_common::model::RenderConfig> for RenderConfig{
|
impl From<strafesnet_common::model::RenderConfig> for RenderConfig{
|
||||||
fn from(value:strafesnet_common::model::RenderConfig)->Self{
|
fn from(value:strafesnet_common::model::RenderConfig)->Self{
|
||||||
let header=flag(value.texture.is_some(),RenderConfig::TEXTURE);
|
|
||||||
Self{
|
Self{
|
||||||
header,
|
texture_enabled:value.texture.is_some() as u8,
|
||||||
texture:value.texture.map(|texture_id|texture_id.get()),
|
texture:super::gameplay_style::stupid(value.texture.map(|texture_id|texture_id.get())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -153,8 +148,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::vec3::raw_array).collect(),
|
unique_pos:self.unique_pos.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_normal:self.unique_normal.into_iter().map(strafesnet_common::integer::Planar64Vec3::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 +195,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.map(|t|t.to_raw()).to_array())
|
.map(|pos|pos.get().to_array())
|
||||||
.collect(),
|
.collect(),
|
||||||
unique_normal:value.unique_normal.into_iter()
|
unique_normal:value.unique_normal.into_iter()
|
||||||
.map(|normal|normal.map(|t|t.to_raw()).to_array())
|
.map(|normal|normal.get().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 +238,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::vec3::raw_xyz(_0,_1,_2),
|
strafesnet_common::integer::Planar64Vec3::raw_xyz(_0,_1,_2),
|
||||||
strafesnet_common::integer::vec3::raw_xyz(_3,_4,_5),
|
strafesnet_common::integer::Planar64Vec3::raw_xyz(_3,_4,_5),
|
||||||
strafesnet_common::integer::vec3::raw_xyz(_6,_7,_8)
|
strafesnet_common::integer::Planar64Vec3::raw_xyz(_6,_7,_8)
|
||||||
]),
|
),
|
||||||
strafesnet_common::integer::vec3::raw_xyz(_9,_a,_b)
|
strafesnet_common::integer::Planar64Vec3::raw_xyz(_9,_a,_b)
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,10 +256,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.map(|t|t.to_raw()).to_array(),
|
value.transform.matrix3.x_axis.get().to_array(),
|
||||||
value.transform.matrix3.y_axis.map(|t|t.to_raw()).to_array(),
|
value.transform.matrix3.y_axis.get().to_array(),
|
||||||
value.transform.matrix3.z_axis.map(|t|t.to_raw()).to_array(),
|
value.transform.matrix3.z_axis.get().to_array(),
|
||||||
value.transform.translation.map(|t|t.to_raw()).to_array()
|
value.transform.translation.get().to_array()
|
||||||
);
|
);
|
||||||
Self{
|
Self{
|
||||||
mesh:value.mesh.get(),
|
mesh:value.mesh.get(),
|
||||||
|
Loading…
Reference in New Issue
Block a user