int element[2];
}
edgehashentry_t;
- edgehashentry_t *edgehash[TRIANGLEEDGEHASH], *edgehashentries, edgehashentriesbuffer[TRIANGLEEDGEHASH*3], *hash;
+ static edgehashentry_t *edgehash[TRIANGLEEDGEHASH];
+ edgehashentry_t *edgehashentries, *hash;
+ if (!numtriangles)
+ return;
memset(edgehash, 0, sizeof(edgehash));
- edgehashentries = edgehashentriesbuffer;
// if there are too many triangles for the stack array, allocate larger buffer
- if (numtriangles > TRIANGLEEDGEHASH)
- edgehashentries = (edgehashentry_t *)Mem_Alloc(tempmempool, numtriangles * 3 * sizeof(edgehashentry_t));
+ edgehashentries = (edgehashentry_t *)Mem_Alloc(tempmempool, numtriangles * 3 * sizeof(edgehashentry_t));
// find neighboring triangles
for (i = 0, e = elements, n = neighbors;i < numtriangles;i++, e += 3, n += 3)
{
CL_KeepaliveMessage(false);
}
// free the allocated buffer
- if (edgehashentries != edgehashentriesbuffer)
- Mem_Free(edgehashentries);
+ Mem_Free(edgehashentries);
}
#else
// very slow but simple way
static void Mod_ShadowMesh_CreateVBOs(shadowmesh_t *mesh)
{
- if (!gl_support_arb_vertex_buffer_object)
+ if (!vid.support.arb_vertex_buffer_object)
return;
// element buffer is easy because it's just one array
shader.textureblendalpha = true;
}
}
- layer->texflags = TEXF_ALPHA | TEXF_PRECACHE;
+ layer->texflags = TEXF_ALPHA;
if (!(shader.surfaceparms & Q3SURFACEPARM_NOMIPMAPS))
layer->texflags |= TEXF_MIPMAP;
if (!(shader.textureflags & Q3TEXTUREFLAG_NOPICMIP))
texflagsmask &= ~TEXF_COMPRESS;
texture->specularscalemod = 1; // unless later loaded from the shader
texture->specularpowermod = 1; // unless later loaded from the shader
+ // WHEN ADDING DEFAULTS HERE, REMEMBER TO SYNC TO SHADER LOADING ABOVE
+ // HERE, AND Q1BSP LOADING
+ // JUST GREP FOR "specularscalemod = 1".
if (shader)
{
{
if (fallback)
{
- qboolean has_alpha;
- if ((texture->skinframes[0] = R_SkinFrame_LoadExternal_CheckAlpha(texture->name, defaulttexflags, false, &has_alpha)))
+ if ((texture->skinframes[0] = R_SkinFrame_LoadExternal(texture->name, defaulttexflags, false)))
{
- if(has_alpha && (defaulttexflags & TEXF_ALPHA))
+ if(texture->skinframes[0]->hasalpha)
texture->basematerialflags |= MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW;
}
else
}
}
- if (!gl_support_arb_vertex_buffer_object)
+ if (!vid.support.arb_vertex_buffer_object)
return;
// element buffer is easy because it's just one array
state->width = width;
state->height = height;
state->currentY = 0;
- state->rows = Mem_Alloc(tempmempool, state->height * sizeof(*state->rows));
+ state->rows = Mem_Alloc(loadmodel->mempool, state->height * sizeof(*state->rows));
for (y = 0;y < state->height;y++)
{
state->rows[y].currentX = 0;
model->texturepool = R_AllocTexturePool();
lm_basescalepixels = 1.0f / max(0.0001f, mod_generatelightmaps_unitspersample.value);
lm_borderpixels = mod_generatelightmaps_borderpixels.integer;
- lm_texturesize = bound(lm_borderpixels*2+1, 64, gl_max_texture_size);
+ lm_texturesize = bound(lm_borderpixels*2+1, 64, (int)vid.maxtexturesize_2d);
lm_maxpixels = lm_texturesize-(lm_borderpixels*2+1);
Mod_AllocLightmap_Init(&lmstate, lm_texturesize, lm_texturesize);
lightmapnumber = 0;
break;
// if we haven't maxed out the lightmap size yet, we retry the
// entire surface batch...
- if (lm_texturesize * 2 <= min(mod_generatelightmaps_texturesize.integer, gl_max_texture_size))
+ if (lm_texturesize * 2 <= min(mod_generatelightmaps_texturesize.integer, (int)vid.maxtexturesize_2d))
{
lm_texturesize *= 2;
surfaceindex = -1;
for (lightmapindex = 0;lightmapindex < model->brushq3.num_mergedlightmaps;lightmapindex++)
{
- model->brushq3.data_lightmaps[lightmapindex] = R_LoadTexture2D(model->texturepool, va("lightmap%i", lightmapindex), lm_texturesize, lm_texturesize, lightmappixels + lightmapindex * lm_texturesize * lm_texturesize * 4, TEXTYPE_BGRA, TEXF_FORCELINEAR | TEXF_PRECACHE, NULL);
- model->brushq3.data_deluxemaps[lightmapindex] = R_LoadTexture2D(model->texturepool, va("deluxemap%i", lightmapindex), lm_texturesize, lm_texturesize, deluxemappixels + lightmapindex * lm_texturesize * lm_texturesize * 4, TEXTYPE_BGRA, TEXF_FORCELINEAR | TEXF_PRECACHE, NULL);
+ model->brushq3.data_lightmaps[lightmapindex] = R_LoadTexture2D(model->texturepool, va("lightmap%i", lightmapindex), lm_texturesize, lm_texturesize, lightmappixels + lightmapindex * lm_texturesize * lm_texturesize * 4, TEXTYPE_BGRA, TEXF_FORCELINEAR, NULL);
+ model->brushq3.data_deluxemaps[lightmapindex] = R_LoadTexture2D(model->texturepool, va("deluxemap%i", lightmapindex), lm_texturesize, lm_texturesize, deluxemappixels + lightmapindex * lm_texturesize * lm_texturesize * 4, TEXTYPE_BGRA, TEXF_FORCELINEAR, NULL);
}
if (lightmappixels)