detect a fully degenerated mesh and avoid using it and so crashing ubOde

avinationmerge
UbitUmarov 2015-10-12 00:49:07 +01:00
parent af5ea18f33
commit 3d8384b696
2 changed files with 18 additions and 1 deletions

View File

@ -278,6 +278,16 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
return new Vector3(x, y, z);
}
public int numberVertices()
{
return m_bdata.m_vertices.Count;
}
public int numberTriangles()
{
return m_bdata.m_triangles.Count;
}
public List<Vector3> getVertexList()
{
List<Vector3> result = new List<Vector3>();

View File

@ -337,7 +337,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
return null;
}
primShape.SculptData = Utils.EmptyBytes;
int numCoords = coords.Count;
int numFaces = faces.Count;
@ -355,6 +354,14 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
coords.Clear();
faces.Clear();
if(mesh.numberVertices() < 3 || mesh.numberTriangles() < 1)
{
m_log.ErrorFormat("[MESH]: invalid degenerated mesh for prim " + primName + " ignored");
return null;
}
primShape.SculptData = Utils.EmptyBytes;
return mesh;
}