From: divverent Date: Fri, 9 Jul 2010 17:21:51 +0000 (+0000) Subject: cleanup mempool use when generating a shadow mesh (one instance that used "loadmodel... X-Git-Tag: xonotic-v0.1.0preview~230^2~202 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a19a4d85d2b64f05334d015c6ccbe5c61166243a;p=xonotic%2Fdarkplaces.git cleanup mempool use when generating a shadow mesh (one instance that used "loadmodel->mempool" that shouldn't) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10276 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_shared.c b/model_shared.c index 5599b020..f5a4b4ea 100644 --- a/model_shared.c +++ b/model_shared.c @@ -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); }