+static void VM_ResizePolygons(vmpolygons_t *polys)
+{
+ float *oldvertex3f = polys->data_vertex3f;
+ float *oldcolor4f = polys->data_color4f;
+ float *oldtexcoord2f = polys->data_texcoord2f;
+ vmpolygons_triangle_t *oldtriangles = polys->data_triangles;
+ int *oldsortedelement3i = polys->data_sortedelement3i;
+ polys->max_vertices = polys->max_triangles*3;
+ polys->data_vertex3f = (float *)Mem_Alloc(polys->pool, polys->max_vertices*sizeof(float[3]));
+ polys->data_color4f = (float *)Mem_Alloc(polys->pool, polys->max_vertices*sizeof(float[4]));
+ polys->data_texcoord2f = (float *)Mem_Alloc(polys->pool, polys->max_vertices*sizeof(float[2]));
+ polys->data_triangles = (vmpolygons_triangle_t *)Mem_Alloc(polys->pool, polys->max_triangles*sizeof(vmpolygons_triangle_t));
+ polys->data_sortedelement3i = (int *)Mem_Alloc(polys->pool, polys->max_triangles*sizeof(int[3]));
+ if (polys->num_vertices)
+ {
+ memcpy(polys->data_vertex3f, oldvertex3f, polys->num_vertices*sizeof(float[3]));
+ memcpy(polys->data_color4f, oldcolor4f, polys->num_vertices*sizeof(float[4]));
+ memcpy(polys->data_texcoord2f, oldtexcoord2f, polys->num_vertices*sizeof(float[2]));
+ }
+ if (polys->num_triangles)
+ {
+ memcpy(polys->data_triangles, oldtriangles, polys->num_triangles*sizeof(vmpolygons_triangle_t));
+ memcpy(polys->data_sortedelement3i, oldsortedelement3i, polys->num_triangles*sizeof(int[3]));
+ }
+ if (oldvertex3f)
+ Mem_Free(oldvertex3f);
+ if (oldcolor4f)
+ Mem_Free(oldcolor4f);
+ if (oldtexcoord2f)
+ Mem_Free(oldtexcoord2f);
+ if (oldtriangles)
+ Mem_Free(oldtriangles);
+ if (oldsortedelement3i)
+ Mem_Free(oldsortedelement3i);
+}