cvar_t r_glsl_vertextextureblend_usebothalphas = {CF_CLIENT | CF_ARCHIVE, "r_glsl_vertextextureblend_usebothalphas", "0", "use both alpha layers on vertex blended surfaces, each alpha layer sets amount of 'blend leak' on another layer, requires mod_q3shader_force_terrain_alphaflag on."};
+// FIXME: This cvar would grow to a ridiculous size after several launches and clean exits when used during surface sorting.
cvar_t r_framedatasize = {CF_CLIENT | CF_ARCHIVE, "r_framedatasize", "0.5", "size of renderer data cache used during one frame (for skeletal animation caching, light processing, etc)"};
cvar_t r_buffermegs[R_BUFFERDATA_COUNT] =
{
if(cls.state == ca_dedicated)
return;
- info = (Mod_MakeSortedSurfaces_qsortsurface_t*)R_FrameData_Alloc(mod->num_surfaces * sizeof(*info));
+ info = (Mod_MakeSortedSurfaces_qsortsurface_t*)Mem_Alloc(loadmodel->mempool, mod->num_surfaces * sizeof(*info));
if (!mod->modelsurfaces_sorted)
mod->modelsurfaces_sorted = (int *) Mem_Alloc(loadmodel->mempool, mod->num_surfaces * sizeof(*mod->modelsurfaces_sorted));
// the goal is to sort by submodel (can't change which submodel a surface belongs to), and then by effects and textures
qsort(info + mod->brush.submodels[k]->submodelsurfaces_start, (size_t)mod->brush.submodels[k]->submodelsurfaces_end - mod->brush.submodels[k]->submodelsurfaces_start, sizeof(*info), Mod_MakeSortedSurfaces_qsortfunc);
for (j = 0; j < mod->num_surfaces; j++)
mod->modelsurfaces_sorted[j] = info[j].surfaceindex;
+ Mem_Free(info);
}
void Mod_BuildVBOs(void)
{
int i, j;
texture_t *tex;
- unsigned char* included = (unsigned char *)R_FrameData_Alloc(mod->num_surfaces * sizeof(unsigned char));
// build the sorted surfaces list properly to reduce material setup
// this is easy because we're just sorting on texture and don't care about the order of textures
mod->submodelsurfaces_start = 0;
mod->submodelsurfaces_end = 0;
for (i = 0; i < mod->num_surfaces; i++)
- included[i] = 0;
+ mod->data_surfaces[i].included = false;
for (i = 0; i < mod->num_surfaces; i++)
{
- if (included[i])
+ if (mod->data_surfaces[i].included)
continue;
tex = mod->data_surfaces[i].texture;
// j = i is intentional
for (j = i; j < mod->num_surfaces; j++)
{
- if (!included[j] && mod->data_surfaces[j].texture == tex)
+ if (!mod->data_surfaces[j].included && mod->data_surfaces[j].texture == tex)
{
- included[j] = 1;
+ mod->data_surfaces[j].included = 1;
mod->modelsurfaces_sorted[mod->submodelsurfaces_end++] = j;
}
}
int num_firstcollisiontriangle; // q3bsp only
int num_collisiontriangles; // number of triangles (if surface has collisions enabled)
int num_collisionvertices; // number of vertices referenced by collision triangles (if surface has collisions enabled)
+
+ // used by Mod_Mesh_Finalize when building sortedmodelsurfaces
+ qbool included;
}
msurface_t;