]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
cleanup mempool use when generating a shadow mesh (one instance that used "loadmodel...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 9 Jul 2010 17:21:51 +0000 (17:21 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 9 Jul 2010 17:21:51 +0000 (17:21 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10276 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index 5599b0204d512a16ed75241b5a309269cfb53744..f5a4b4eac831436af99de877fe61c064d1faad72 100644 (file)
@@ -1185,7 +1185,7 @@ shadowmesh_t *Mod_ShadowMesh_Begin(mempool_t *mempool, int maxverts, int maxtria
        return Mod_ShadowMesh_Alloc(mempool, maxverts, maxtriangles, map_diffuse, map_specular, map_normal, light, neighbors, expandable);
 }
 
-static void Mod_ShadowMesh_CreateVBOs(shadowmesh_t *mesh)
+static void Mod_ShadowMesh_CreateVBOs(shadowmesh_t *mesh, mempool_t *mempool)
 {
        if (!mesh->numverts)
                return;
@@ -1197,7 +1197,7 @@ static void Mod_ShadowMesh_CreateVBOs(shadowmesh_t *mesh)
                int vertexindex;
                int numvertices = mesh->numverts;
                r_vertexmesh_t *vertexmesh;
-               mesh->vertexmesh = vertexmesh = (r_vertexmesh_t*)Mem_Alloc(loadmodel->mempool, numvertices * sizeof(*mesh->vertexmesh));
+               mesh->vertexmesh = vertexmesh = (r_vertexmesh_t*)Mem_Alloc(mempool, numvertices * sizeof(*mesh->vertexmesh));
                for (vertexindex = 0;vertexindex < numvertices;vertexindex++, vertexmesh++)
                {
                        VectorCopy(mesh->vertex3f + 3*vertexindex, vertexmesh->vertex3f);
@@ -1280,7 +1280,7 @@ shadowmesh_t *Mod_ShadowMesh_Finish(mempool_t *mempool, shadowmesh_t *firstmesh,
                                        newmesh->element3s[i] = newmesh->element3i[i];
                        }
                        if (createvbo)
-                               Mod_ShadowMesh_CreateVBOs(newmesh);
+                               Mod_ShadowMesh_CreateVBOs(newmesh, mempool);
                }
                Mem_Free(mesh);
        }