reject meshes with zero vertices

This commit is contained in:
2026-02-25 13:17:47 -08:00
parent 36f44ffd43
commit fd82fa6203
2 changed files with 8 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ use crate::loader::MeshWithSize;
#[derive(Debug)]
pub enum Error{
ZeroVertices,
RbxMesh(rbx_mesh::mesh::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{
aabb.grow(point);
}
if mesh.unique_vertices.is_empty(){
return Err(Error::ZeroVertices);
}
Ok(MeshWithSize{mesh,size:aabb.size()})
}

View File

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