Compare commits

...

1 Commits

Author SHA1 Message Date
fd82fa6203 reject meshes with zero vertices 2026-02-25 13:17:47 -08:00
2 changed files with 8 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ use crate::loader::MeshWithSize;
#[derive(Debug)] #[derive(Debug)]
pub enum Error{ pub enum Error{
ZeroVertices,
RbxMesh(rbx_mesh::mesh::Error) RbxMesh(rbx_mesh::mesh::Error)
} }
impl std::fmt::Display for Error{ impl std::fmt::Display for Error{
@@ -143,5 +144,8 @@ pub fn convert(roblox_mesh_bytes:crate::data::RobloxMeshBytes)->Result<MeshWithS
for &point in &mesh.unique_pos{ for &point in &mesh.unique_pos{
aabb.grow(point); aabb.grow(point);
} }
if mesh.unique_vertices.is_empty(){
return Err(Error::ZeroVertices);
}
Ok(MeshWithSize{mesh,size:aabb.size()}) Ok(MeshWithSize{mesh,size:aabb.size()})
} }

View File

@@ -10,6 +10,7 @@ use strafesnet_common::integer::vec3;
#[derive(Debug)] #[derive(Debug)]
pub enum Error{ pub enum Error{
Block, Block,
ZeroVertices,
MissingVertexId(u32), MissingVertexId(u32),
Planar64Vec3(strafesnet_common::integer::Planar64TryFromFloatError), Planar64Vec3(strafesnet_common::integer::Planar64TryFromFloatError),
RobloxPhysicsData(rbx_mesh::physics_data::Error), RobloxPhysicsData(rbx_mesh::physics_data::Error),
@@ -265,6 +266,9 @@ pub fn convert(
graphics_groups, graphics_groups,
physics_groups, physics_groups,
); );
if mesh.unique_vertices.is_empty(){
return Err(Error::ZeroVertices);
}
Ok(MeshWithSize{ Ok(MeshWithSize{
mesh, mesh,
size:vec3::ONE, size:vec3::ONE,