Compare commits
4 Commits
debug-bug3
...
master
Author | SHA1 | Date | |
---|---|---|---|
eb80c8b9b5
|
|||
63714f190d
|
|||
f50dfb9399
|
|||
9db39d2a62
|
573
Cargo.lock
generated
573
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -119,10 +119,11 @@ impl<F:Copy,M:MeshQuery<Normal=Vector3<F>,Offset=Fixed<4,128>>> FEV<M>
|
|||||||
},
|
},
|
||||||
&FEV::Edge(edge_id)=>{
|
&FEV::Edge(edge_id)=>{
|
||||||
//test each face collision time, ignoring roots with zero or conflicting derivative
|
//test each face collision time, ignoring roots with zero or conflicting derivative
|
||||||
let edge_n=mesh.edge_n(edge_id);
|
|
||||||
let edge_verts=mesh.edge_verts(edge_id);
|
let edge_verts=mesh.edge_verts(edge_id);
|
||||||
let &[ev0,ev1]=edge_verts.as_ref();
|
let &[ev0,ev1]=edge_verts.as_ref();
|
||||||
let delta_pos=body.position*2-(mesh.vert(ev0)+mesh.vert(ev1));
|
let (v0,v1)=(mesh.vert(ev0),mesh.vert(ev1));
|
||||||
|
let edge_n=v1-v0;
|
||||||
|
let delta_pos=body.position*2-(v0+v1);
|
||||||
for (i,&edge_face_id) in mesh.edge_faces(edge_id).as_ref().iter().enumerate(){
|
for (i,&edge_face_id) in mesh.edge_faces(edge_id).as_ref().iter().enumerate(){
|
||||||
let face_n=mesh.face_nd(edge_face_id).0;
|
let face_n=mesh.face_nd(edge_face_id).0;
|
||||||
//edge_n gets parity from the order of edge_faces
|
//edge_n gets parity from the order of edge_faces
|
||||||
|
@ -15,7 +15,7 @@ glam = "0.30.0"
|
|||||||
lazy-regex = "3.1.0"
|
lazy-regex = "3.1.0"
|
||||||
rbx_binary = { version = "1.1.0-sn4", registry = "strafesnet" }
|
rbx_binary = { version = "1.1.0-sn4", registry = "strafesnet" }
|
||||||
rbx_dom_weak = { version = "3.1.0-sn4", registry = "strafesnet", features = ["instance-userdata"] }
|
rbx_dom_weak = { version = "3.1.0-sn4", registry = "strafesnet", features = ["instance-userdata"] }
|
||||||
rbx_mesh = "0.3.1"
|
rbx_mesh = "0.4.0"
|
||||||
rbx_reflection = "5.0.0"
|
rbx_reflection = "5.0.0"
|
||||||
rbx_reflection_database = "1.0.0"
|
rbx_reflection_database = "1.0.0"
|
||||||
rbx_xml = { version = "1.1.0-sn4", registry = "strafesnet" }
|
rbx_xml = { version = "1.1.0-sn4", registry = "strafesnet" }
|
||||||
|
@ -154,7 +154,7 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->Result<MeshWithS
|
|||||||
}) as u32)
|
}) as u32)
|
||||||
};
|
};
|
||||||
match rbx_mesh::read_versioned(roblox_mesh_bytes.cursor()).map_err(Error::RbxMesh)?{
|
match rbx_mesh::read_versioned(roblox_mesh_bytes.cursor()).map_err(Error::RbxMesh)?{
|
||||||
rbx_mesh::mesh::VersionedMesh::Version1(mesh)=>{
|
rbx_mesh::mesh::Mesh::V1(mesh)=>{
|
||||||
let color_id=acquire_color_id([1.0f32;4]);
|
let color_id=acquire_color_id([1.0f32;4]);
|
||||||
polygon_groups.push(PolygonGroup::PolygonList(PolygonList::new(mesh.vertices.chunks_exact(3).map(|trip|{
|
polygon_groups.push(PolygonGroup::PolygonList(PolygonList::new(mesh.vertices.chunks_exact(3).map(|trip|{
|
||||||
let mut ingest_vertex1=|vertex:&rbx_mesh::mesh::Vertex1|Ok(acquire_vertex_id(IndexedVertex{
|
let mut ingest_vertex1=|vertex:&rbx_mesh::mesh::Vertex1|Ok(acquire_vertex_id(IndexedVertex{
|
||||||
@ -166,7 +166,7 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->Result<MeshWithS
|
|||||||
Ok(vec![ingest_vertex1(&trip[0])?,ingest_vertex1(&trip[1])?,ingest_vertex1(&trip[2])?])
|
Ok(vec![ingest_vertex1(&trip[0])?,ingest_vertex1(&trip[1])?,ingest_vertex1(&trip[2])?])
|
||||||
}).collect::<Result<_,_>>()?)));
|
}).collect::<Result<_,_>>()?)));
|
||||||
},
|
},
|
||||||
rbx_mesh::mesh::VersionedMesh::Version2(mesh)=>{
|
rbx_mesh::mesh::Mesh::V2(mesh)=>{
|
||||||
let vertex_id_map=match mesh.header.sizeof_vertex{
|
let vertex_id_map=match mesh.header.sizeof_vertex{
|
||||||
rbx_mesh::mesh::SizeOfVertex2::Truncated=>{
|
rbx_mesh::mesh::SizeOfVertex2::Truncated=>{
|
||||||
//pick white and make all the vertices white
|
//pick white and make all the vertices white
|
||||||
@ -180,7 +180,7 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->Result<MeshWithS
|
|||||||
vec![vertex_id_map[&face.0],vertex_id_map[&face.1],vertex_id_map[&face.2]]
|
vec![vertex_id_map[&face.0],vertex_id_map[&face.1],vertex_id_map[&face.2]]
|
||||||
).collect())));
|
).collect())));
|
||||||
},
|
},
|
||||||
rbx_mesh::mesh::VersionedMesh::Version3(mesh)=>{
|
rbx_mesh::mesh::Mesh::V3(mesh)=>{
|
||||||
let vertex_id_map=match mesh.header.sizeof_vertex{
|
let vertex_id_map=match mesh.header.sizeof_vertex{
|
||||||
rbx_mesh::mesh::SizeOfVertex2::Truncated=>{
|
rbx_mesh::mesh::SizeOfVertex2::Truncated=>{
|
||||||
let color_id=acquire_color_id([1.0f32;4]);
|
let color_id=acquire_color_id([1.0f32;4]);
|
||||||
@ -190,13 +190,13 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->Result<MeshWithS
|
|||||||
}?;
|
}?;
|
||||||
ingest_faces2_lods3(&mut polygon_groups,&vertex_id_map,&mesh.faces,&mesh.lods);
|
ingest_faces2_lods3(&mut polygon_groups,&vertex_id_map,&mesh.faces,&mesh.lods);
|
||||||
},
|
},
|
||||||
rbx_mesh::mesh::VersionedMesh::Version4(mesh)=>{
|
rbx_mesh::mesh::Mesh::V4(mesh)=>{
|
||||||
let vertex_id_map=ingest_vertices2(
|
let vertex_id_map=ingest_vertices2(
|
||||||
mesh.vertices,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,&mut acquire_color_id,&mut acquire_vertex_id
|
mesh.vertices,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,&mut acquire_color_id,&mut acquire_vertex_id
|
||||||
)?;
|
)?;
|
||||||
ingest_faces2_lods3(&mut polygon_groups,&vertex_id_map,&mesh.faces,&mesh.lods);
|
ingest_faces2_lods3(&mut polygon_groups,&vertex_id_map,&mesh.faces,&mesh.lods);
|
||||||
},
|
},
|
||||||
rbx_mesh::mesh::VersionedMesh::Version5(mesh)=>{
|
rbx_mesh::mesh::Mesh::V5(mesh)=>{
|
||||||
let vertex_id_map=ingest_vertices2(
|
let vertex_id_map=ingest_vertices2(
|
||||||
mesh.vertices,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,&mut acquire_color_id,&mut acquire_vertex_id
|
mesh.vertices,&mut acquire_pos_id,&mut acquire_tex_id,&mut acquire_normal_id,&mut acquire_color_id,&mut acquire_vertex_id
|
||||||
)?;
|
)?;
|
||||||
|
@ -81,8 +81,8 @@ pub fn convert(
|
|||||||
).map_err(Error::RobloxMeshData)?;
|
).map_err(Error::RobloxMeshData)?;
|
||||||
let graphics_mesh=match mesh_data{
|
let graphics_mesh=match mesh_data{
|
||||||
rbx_mesh::mesh_data::MeshData::CSGK(_)=>return Err(Error::Block),
|
rbx_mesh::mesh_data::MeshData::CSGK(_)=>return Err(Error::Block),
|
||||||
rbx_mesh::mesh_data::MeshData::CSGMDL(rbx_mesh::mesh_data::CSGMDL::CSGMDL2(mesh_data2))=>mesh_data2.mesh,
|
rbx_mesh::mesh_data::MeshData::CSGMDL(rbx_mesh::mesh_data::CSGMDL::V2(mesh_data2))=>mesh_data2.mesh,
|
||||||
rbx_mesh::mesh_data::MeshData::CSGMDL(rbx_mesh::mesh_data::CSGMDL::CSGMDL4(mesh_data4))=>mesh_data4.mesh,
|
rbx_mesh::mesh_data::MeshData::CSGMDL(rbx_mesh::mesh_data::CSGMDL::V4(mesh_data4))=>mesh_data4.mesh,
|
||||||
};
|
};
|
||||||
//autoscale to size, idk what roblox is doing with the graphics mesh size
|
//autoscale to size, idk what roblox is doing with the graphics mesh size
|
||||||
let mut pos_min=glam::Vec3::MAX;
|
let mut pos_min=glam::Vec3::MAX;
|
||||||
@ -153,10 +153,13 @@ pub fn convert(
|
|||||||
// have not seen this format in practice
|
// have not seen this format in practice
|
||||||
|rbx_mesh::physics_data::PhysicsData::CSGPHS(rbx_mesh::physics_data::CSGPHS::Block)
|
|rbx_mesh::physics_data::PhysicsData::CSGPHS(rbx_mesh::physics_data::CSGPHS::Block)
|
||||||
=>return Err(Error::Block),
|
=>return Err(Error::Block),
|
||||||
rbx_mesh::physics_data::PhysicsData::CSGPHS(rbx_mesh::physics_data::CSGPHS::Meshes(meshes))
|
rbx_mesh::physics_data::PhysicsData::CSGPHS(rbx_mesh::physics_data::CSGPHS::V3(meshes))
|
||||||
|
|rbx_mesh::physics_data::PhysicsData::CSGPHS(rbx_mesh::physics_data::CSGPHS::V5(meshes))
|
||||||
|
=>meshes.meshes,
|
||||||
|
rbx_mesh::physics_data::PhysicsData::CSGPHS(rbx_mesh::physics_data::CSGPHS::V6(meshes))
|
||||||
|
=>vec![meshes.mesh],
|
||||||
|
rbx_mesh::physics_data::PhysicsData::CSGPHS(rbx_mesh::physics_data::CSGPHS::V7(meshes))
|
||||||
=>meshes.meshes,
|
=>meshes.meshes,
|
||||||
rbx_mesh::physics_data::PhysicsData::CSGPHS(rbx_mesh::physics_data::CSGPHS::PhysicsInfoMesh(pim))
|
|
||||||
=>vec![pim.mesh],
|
|
||||||
};
|
};
|
||||||
let physics_convex_meshes_it=physics_convex_meshes.into_iter().map(|mesh|{
|
let physics_convex_meshes_it=physics_convex_meshes.into_iter().map(|mesh|{
|
||||||
// this can be factored out of the loop but I am lazy
|
// this can be factored out of the loop but I am lazy
|
||||||
|
@ -6,6 +6,6 @@ edition = "2024"
|
|||||||
# 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
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
binrw = "0.14.0"
|
binrw = "0.15.0"
|
||||||
id = { version = "0.1.0", registry = "strafesnet" }
|
id = { version = "0.1.0", registry = "strafesnet" }
|
||||||
strafesnet_common = { version = "0.7.0", path = "../common", registry = "strafesnet" }
|
strafesnet_common = { version = "0.7.0", path = "../common", registry = "strafesnet" }
|
||||||
|
Reference in New Issue
Block a user