]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
R_ShadowMesh_Finish now discards empty meshs
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 6 Oct 2002 14:40:58 +0000 (14:40 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 6 Oct 2002 14:40:58 +0000 (14:40 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2507 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index a2e8013b9ff72ba8c76fc3da11c9ba411be38b48..93d2524c99455c75dbc06376c10656d035a6179b 100644 (file)
@@ -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;
 }