From a1e74124ff12bffd4ed7dd7bda72a5e2f8420396 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 6 Oct 2002 14:40:58 +0000 Subject: [PATCH] R_ShadowMesh_Finish now discards empty meshs git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2507 d7cf8633-e32d-0410-b094-e92efae38249 --- model_shared.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/model_shared.c b/model_shared.c index a2e8013b..93d2524c 100644 --- a/model_shared.c +++ b/model_shared.c @@ -490,14 +490,17 @@ shadowmesh_t *Mod_ShadowMesh_Finish(mempool_t *mempool, shadowmesh_t *firstmesh) for (mesh = firstmesh, firstmesh = NULL;mesh;mesh = nextmesh) { nextmesh = mesh->next; - newmesh = Mod_ShadowMesh_ReAlloc(mempool, mesh); - newmesh->next = firstmesh; - firstmesh = newmesh; + if (mesh->numverts >= 3 && mesh->numtriangles >= 1) + { + newmesh = Mod_ShadowMesh_ReAlloc(mempool, mesh); + newmesh->next = firstmesh; + firstmesh = newmesh; + //Con_Printf("mesh\n"); + //for (i = 0;i < newmesh->numtriangles;i++) + // Con_Printf("tri %d %d %d\n", newmesh->elements[i * 3 + 0], newmesh->elements[i * 3 + 1], newmesh->elements[i * 3 + 2]); + Mod_BuildTriangleNeighbors(newmesh->neighbors, newmesh->elements, newmesh->numtriangles); + } Mem_Free(mesh); - //Con_Printf("mesh\n"); - //for (i = 0;i < newmesh->numtriangles;i++) - // Con_Printf("tri %d %d %d\n", newmesh->elements[i * 3 + 0], newmesh->elements[i * 3 + 1], newmesh->elements[i * 3 + 2]); - Mod_BuildTriangleNeighbors(newmesh->neighbors, newmesh->elements, newmesh->numtriangles); } return firstmesh; } -- 2.39.2