quick and dirty fix of allocation of array buffers
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 17 Oct 2010 13:18:40 +0000 (13:18 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 17 Oct 2010 13:18:40 +0000 (13:18 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10541 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 1788800..26ef8ec 100644 (file)
@@ -10829,8 +10829,7 @@ void RSurf_ActiveWorldEntity(void)
        rsurface.ent_qwskin = -1;
        rsurface.ent_shadertime = 0;
        rsurface.ent_flags = r_refdef.scene.worldentity->flags;
-       if (rsurface.array_size < model->surfmesh.num_vertices)
-               R_Mesh_ResizeArrays(model->surfmesh.num_vertices);
+       R_Mesh_ResizeArrays(max(model->surfmesh.num_vertices, model->surfmesh.num_triangles));
        rsurface.matrix = identitymatrix;
        rsurface.inversematrix = identitymatrix;
        rsurface.matrixscale = 1;
@@ -10944,8 +10943,7 @@ void RSurf_ActiveModelEntity(const entity_render_t *ent, qboolean wantnormals, q
        rsurface.ent_qwskin = (ent->entitynumber <= cl.maxclients && ent->entitynumber >= 1 && cls.protocol == PROTOCOL_QUAKEWORLD && cl.scores[ent->entitynumber - 1].qw_skin[0] && !strcmp(ent->model->name, "progs/player.mdl")) ? (ent->entitynumber - 1) : -1;
        rsurface.ent_shadertime = ent->shadertime;
        rsurface.ent_flags = ent->flags;
-       if (rsurface.array_size < model->surfmesh.num_vertices)
-               R_Mesh_ResizeArrays(model->surfmesh.num_vertices);
+       R_Mesh_ResizeArrays(max(model->surfmesh.num_vertices, model->surfmesh.num_triangles));
        rsurface.matrix = ent->matrix;
        rsurface.inversematrix = ent->inversematrix;
        rsurface.matrixscale = Matrix4x4_ScaleFromMatrix(&rsurface.matrix);
@@ -11125,8 +11123,7 @@ void RSurf_ActiveCustomEntity(const matrix4x4_t *matrix, const matrix4x4_t *inve
        rsurface.ent_flags = entflags;
        rsurface.modelnumvertices = numvertices;
        rsurface.modelnumtriangles = numtriangles;
-       if (rsurface.array_size < rsurface.modelnumvertices)
-               R_Mesh_ResizeArrays(rsurface.modelnumvertices);
+       R_Mesh_ResizeArrays(rsurface.modelnumvertices, rsurface.modelnumtriangles);
        rsurface.matrix = *matrix;
        rsurface.inversematrix = *inversematrix;
        rsurface.matrixscale = Matrix4x4_ScaleFromMatrix(&rsurface.matrix);