Con_Printf("warning: empty submodel *%i in %s\n", i+1, loadmodel->name);
}
//mod->brushq1.num_visleafs = bm->visleafs;
- }
-
- Mod_Q1BSP_LoadMapBrushes();
- //Mod_Q1BSP_ProcessLightList();
+ // generate VBOs and other shared data before cloning submodels
+ if (i == 0)
+ {
+ Mod_BuildVBOs();
+ Mod_Q1BSP_LoadMapBrushes();
+ //Mod_Q1BSP_ProcessLightList();
+ }
+ }
Con_DPrintf("Stats for q1bsp model \"%s\": %i faces, %i nodes, %i leafs, %i visleafs, %i visleafportals, mesh: %i vertices, %i triangles, %i surfaces\n", loadmodel->name, loadmodel->num_surfaces, loadmodel->brush.num_nodes, loadmodel->brush.num_leafs, mod->brush.num_pvsclusters, loadmodel->brush.num_portals, loadmodel->surfmesh.num_vertices, loadmodel->surfmesh.num_triangles, loadmodel->num_surfaces);
}
break;
if (j < mod->nummodelsurfaces)
mod->DrawAddWaterPlanes = R_Q1BSP_DrawAddWaterPlanes;
+
+ // generate VBOs and other shared data before cloning submodels
+ if (i == 0)
+ Mod_BuildVBOs();
}
Con_DPrintf("Stats for q3bsp model \"%s\": %i faces, %i nodes, %i leafs, %i clusters, %i clusterportals, mesh: %i vertices, %i triangles, %i surfaces\n", loadmodel->name, loadmodel->num_surfaces, loadmodel->brush.num_nodes, loadmodel->brush.num_leafs, mod->brush.num_pvsclusters, loadmodel->brush.num_portals, loadmodel->surfmesh.num_vertices, loadmodel->surfmesh.num_triangles, loadmodel->num_surfaces);
static void Mod_Print(void);
static void Mod_Precache (void);
static void Mod_Decompile_f(void);
-static void Mod_BuildVBOs(void);
static void Mod_GenerateLightmaps_f(void);
void Mod_Init (void)
{
{
if (!vid.support.arb_vertex_buffer_object)
return;
+ if (mesh->vbo)
+ return;
// element buffer is easy because it's just one array
if (mesh->numtriangles)
Mem_Free(numsurfacesfortexture);
}
-static void Mod_BuildVBOs(void)
+void Mod_BuildVBOs(void)
{
if (gl_paranoid.integer && loadmodel->surfmesh.data_element3s && loadmodel->surfmesh.data_element3i)
{
if (!vid.support.arb_vertex_buffer_object)
return;
+ // only build a vbo if one has not already been created (this is important for brush models which load specially)
+ if (loadmodel->surfmesh.vbo)
+ return;
// element buffer is easy because it's just one array
if (loadmodel->surfmesh.num_triangles)
void Mod_AllocSurfMesh(mempool_t *mempool, int numvertices, int numtriangles, qboolean lightmapoffsets, qboolean vertexcolors, qboolean neighbors);
void Mod_MakeSortedSurfaces(dp_model_t *mod);
+// called specially by brush model loaders before generating submodels
+// automatically called after model loader returns
+void Mod_BuildVBOs(void);
+
shadowmesh_t *Mod_ShadowMesh_Alloc(mempool_t *mempool, int maxverts, int maxtriangles, rtexture_t *map_diffuse, rtexture_t *map_specular, rtexture_t *map_normal, int light, int neighbors, int expandable);
shadowmesh_t *Mod_ShadowMesh_ReAlloc(mempool_t *mempool, shadowmesh_t *oldmesh, int light, int neighbors);
int Mod_ShadowMesh_AddVertex(shadowmesh_t *mesh, float *vertex14f);