fixed -Wshadow warnings.
This commit is contained in:
parent
9fc38410dd
commit
9ca7d499e5
|
@ -903,7 +903,7 @@ void Sky_DrawFace (int axis)
|
||||||
vec3_t verts[4];
|
vec3_t verts[4];
|
||||||
int i, j, start;
|
int i, j, start;
|
||||||
float di,qi,dj,qj;
|
float di,qi,dj,qj;
|
||||||
vec3_t vup, vright, temp, temp2;
|
vec3_t up, right, temp, temp2;
|
||||||
|
|
||||||
Sky_SetBoxVert(-1.0, -1.0, axis, verts[0]);
|
Sky_SetBoxVert(-1.0, -1.0, axis, verts[0]);
|
||||||
Sky_SetBoxVert(-1.0, 1.0, axis, verts[1]);
|
Sky_SetBoxVert(-1.0, 1.0, axis, verts[1]);
|
||||||
|
@ -913,8 +913,8 @@ void Sky_DrawFace (int axis)
|
||||||
start = Hunk_LowMark ();
|
start = Hunk_LowMark ();
|
||||||
p = (glpoly_t *) Hunk_Alloc(sizeof(glpoly_t));
|
p = (glpoly_t *) Hunk_Alloc(sizeof(glpoly_t));
|
||||||
|
|
||||||
VectorSubtract(verts[2],verts[3],vup);
|
VectorSubtract(verts[2],verts[3],up);
|
||||||
VectorSubtract(verts[2],verts[1],vright);
|
VectorSubtract(verts[2],verts[1],right);
|
||||||
|
|
||||||
di = q_max((int)r_sky_quality.value, 1);
|
di = q_max((int)r_sky_quality.value, 1);
|
||||||
qi = 1.0 / di;
|
qi = 1.0 / di;
|
||||||
|
@ -930,15 +930,15 @@ void Sky_DrawFace (int axis)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//if (i&1 ^ j&1) continue; //checkerboard test
|
//if (i&1 ^ j&1) continue; //checkerboard test
|
||||||
VectorScale (vright, qi*i, temp);
|
VectorScale (right, qi*i, temp);
|
||||||
VectorScale (vup, qj*j, temp2);
|
VectorScale (up, qj*j, temp2);
|
||||||
VectorAdd(temp,temp2,temp);
|
VectorAdd(temp,temp2,temp);
|
||||||
VectorAdd(verts[0],temp,p->verts[0]);
|
VectorAdd(verts[0],temp,p->verts[0]);
|
||||||
|
|
||||||
VectorScale (vup, qj, temp);
|
VectorScale (up, qj, temp);
|
||||||
VectorAdd (p->verts[0],temp,p->verts[1]);
|
VectorAdd (p->verts[0],temp,p->verts[1]);
|
||||||
|
|
||||||
VectorScale (vright, qi, temp);
|
VectorScale (right, qi, temp);
|
||||||
VectorAdd (p->verts[1],temp,p->verts[2]);
|
VectorAdd (p->verts[1],temp,p->verts[2]);
|
||||||
|
|
||||||
VectorAdd (p->verts[0],temp,p->verts[3]);
|
VectorAdd (p->verts[0],temp,p->verts[3]);
|
||||||
|
|
|
@ -1282,34 +1282,32 @@ void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants)
|
||||||
//
|
//
|
||||||
mark = Hunk_LowMark ();
|
mark = Hunk_LowMark ();
|
||||||
|
|
||||||
if (glt->source_file[0] && glt->source_offset)
|
if (glt->source_file[0] && glt->source_offset) {
|
||||||
{
|
|
||||||
//lump inside file
|
//lump inside file
|
||||||
long size;
|
|
||||||
FILE *f;
|
FILE *f;
|
||||||
COM_FOpenFile(glt->source_file, &f, NULL);
|
COM_FOpenFile(glt->source_file, &f, NULL);
|
||||||
if (!f)
|
if (!f) goto invalid;
|
||||||
goto invalid;
|
|
||||||
fseek (f, glt->source_offset, SEEK_CUR);
|
fseek (f, glt->source_offset, SEEK_CUR);
|
||||||
size = (long) (glt->source_width * glt->source_height);
|
size = glt->source_width * glt->source_height;
|
||||||
/* should be SRC_INDEXED, but no harm being paranoid: */
|
/* should be SRC_INDEXED, but no harm being paranoid: */
|
||||||
if (glt->source_format == SRC_RGBA)
|
if (glt->source_format == SRC_RGBA) {
|
||||||
size *= 4;
|
size *= 4;
|
||||||
else if (glt->source_format == SRC_LIGHTMAP)
|
}
|
||||||
|
else if (glt->source_format == SRC_LIGHTMAP) {
|
||||||
size *= lightmap_bytes;
|
size *= lightmap_bytes;
|
||||||
|
}
|
||||||
data = (byte *) Hunk_Alloc (size);
|
data = (byte *) Hunk_Alloc (size);
|
||||||
fread (data, 1, size, f);
|
fread (data, 1, size, f);
|
||||||
fclose (f);
|
fclose (f);
|
||||||
}
|
}
|
||||||
else if (glt->source_file[0] && !glt->source_offset)
|
else if (glt->source_file[0] && !glt->source_offset) {
|
||||||
data = Image_LoadImage (glt->source_file, (int *)&glt->source_width, (int *)&glt->source_height); //simple file
|
data = Image_LoadImage (glt->source_file, (int *)&glt->source_width, (int *)&glt->source_height); //simple file
|
||||||
else if (!glt->source_file[0] && glt->source_offset)
|
}
|
||||||
|
else if (!glt->source_file[0] && glt->source_offset) {
|
||||||
data = (byte *) glt->source_offset; //image in memory
|
data = (byte *) glt->source_offset; //image in memory
|
||||||
|
}
|
||||||
if (!data)
|
if (!data) {
|
||||||
{
|
invalid: Con_Printf ("TexMgr_ReloadImage: invalid source for %s\n", glt->name);
|
||||||
invalid:
|
|
||||||
Con_Printf ("TexMgr_ReloadImage: invalid source for %s\n", glt->name);
|
|
||||||
Hunk_FreeToLowMark(mark);
|
Hunk_FreeToLowMark(mark);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -661,10 +661,9 @@ static qboolean VID_SetMode (int width, int height, int refreshrate, int bpp, qb
|
||||||
/* Make window fullscreen if needed, and show the window */
|
/* Make window fullscreen if needed, and show the window */
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
Uint32 flags = vid_desktopfullscreen.value ?
|
const Uint32 flag = vid_desktopfullscreen.value ?
|
||||||
SDL_WINDOW_FULLSCREEN_DESKTOP :
|
SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_FULLSCREEN;
|
||||||
SDL_WINDOW_FULLSCREEN;
|
if (SDL_SetWindowFullscreen (draw_context, flag) != 0)
|
||||||
if (SDL_SetWindowFullscreen (draw_context, flags) != 0)
|
|
||||||
Sys_Error ("Couldn't set fullscreen state mode");
|
Sys_Error ("Couldn't set fullscreen state mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,7 @@ struct lightmap_s
|
||||||
// main memory so texsubimage can update properly
|
// main memory so texsubimage can update properly
|
||||||
byte *data;//[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT];
|
byte *data;//[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT];
|
||||||
};
|
};
|
||||||
extern struct lightmap_s *lightmap;
|
extern struct lightmap_s *lightmaps;
|
||||||
extern int lightmap_count; //allocated lightmaps
|
extern int lightmap_count; //allocated lightmaps
|
||||||
|
|
||||||
extern int gl_warpimagesize; //johnfitz -- for water warp
|
extern int gl_warpimagesize; //johnfitz -- for water warp
|
||||||
|
|
|
@ -31,7 +31,7 @@ int gl_lightmap_format;
|
||||||
int lightmap_bytes;
|
int lightmap_bytes;
|
||||||
|
|
||||||
#define MAX_SANITY_LIGHTMAPS (1u<<20)
|
#define MAX_SANITY_LIGHTMAPS (1u<<20)
|
||||||
struct lightmap_s *lightmap;
|
struct lightmap_s *lightmaps;
|
||||||
int lightmap_count;
|
int lightmap_count;
|
||||||
int last_lightmap_allocated;
|
int last_lightmap_allocated;
|
||||||
int allocated[LMBLOCK_WIDTH];
|
int allocated[LMBLOCK_WIDTH];
|
||||||
|
@ -663,8 +663,8 @@ void R_RenderDynamicLightmaps (msurface_t *fa)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// add to lightmap chain
|
// add to lightmap chain
|
||||||
fa->polys->chain = lightmap[fa->lightmaptexturenum].polys;
|
fa->polys->chain = lightmaps[fa->lightmaptexturenum].polys;
|
||||||
lightmap[fa->lightmaptexturenum].polys = fa->polys;
|
lightmaps[fa->lightmaptexturenum].polys = fa->polys;
|
||||||
|
|
||||||
// check for lightmap modification
|
// check for lightmap modification
|
||||||
for (maps=0; maps < MAXLIGHTMAPS && fa->styles[maps] != 255; maps++)
|
for (maps=0; maps < MAXLIGHTMAPS && fa->styles[maps] != 255; maps++)
|
||||||
|
@ -677,7 +677,7 @@ void R_RenderDynamicLightmaps (msurface_t *fa)
|
||||||
dynamic:
|
dynamic:
|
||||||
if (r_dynamic.value)
|
if (r_dynamic.value)
|
||||||
{
|
{
|
||||||
struct lightmap_s *lm = &lightmap[fa->lightmaptexturenum];
|
struct lightmap_s *lm = &lightmaps[fa->lightmaptexturenum];
|
||||||
lm->modified = true;
|
lm->modified = true;
|
||||||
theRect = &lm->rectchange;
|
theRect = &lm->rectchange;
|
||||||
if (fa->light_t < theRect->t) {
|
if (fa->light_t < theRect->t) {
|
||||||
|
@ -724,11 +724,11 @@ int AllocBlock (int w, int h, int *x, int *y)
|
||||||
if (texnum == lightmap_count)
|
if (texnum == lightmap_count)
|
||||||
{
|
{
|
||||||
lightmap_count++;
|
lightmap_count++;
|
||||||
lightmap = (struct lightmap_s *) realloc(lightmap, sizeof(*lightmap)*lightmap_count);
|
lightmaps = (struct lightmap_s *) realloc(lightmaps, sizeof(*lightmaps)*lightmap_count);
|
||||||
memset(&lightmap[texnum], 0, sizeof(lightmap[texnum]));
|
memset(&lightmaps[texnum], 0, sizeof(lightmaps[texnum]));
|
||||||
/* FIXME: we leave 'gaps' in malloc()ed data, CRC_Block() later accesses
|
/* FIXME: we leave 'gaps' in malloc()ed data, CRC_Block() later accesses
|
||||||
* that uninitialized data and valgrind complains for it. use calloc() ? */
|
* that uninitialized data and valgrind complains for it. use calloc() ? */
|
||||||
lightmap[texnum].data = (byte *) malloc(4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT);
|
lightmaps[texnum].data = (byte *) malloc(4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT);
|
||||||
//as we're only tracking one texture, we don't need multiple copies of allocated any more.
|
//as we're only tracking one texture, we don't need multiple copies of allocated any more.
|
||||||
memset(allocated, 0, sizeof(allocated));
|
memset(allocated, 0, sizeof(allocated));
|
||||||
}
|
}
|
||||||
|
@ -786,7 +786,7 @@ void GL_CreateSurfaceLightmap (msurface_t *surf)
|
||||||
tmax = (surf->extents[1]>>4)+1;
|
tmax = (surf->extents[1]>>4)+1;
|
||||||
|
|
||||||
surf->lightmaptexturenum = AllocBlock (smax, tmax, &surf->light_s, &surf->light_t);
|
surf->lightmaptexturenum = AllocBlock (smax, tmax, &surf->light_s, &surf->light_t);
|
||||||
base = lightmap[surf->lightmaptexturenum].data;
|
base = lightmaps[surf->lightmaptexturenum].data;
|
||||||
base += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * lightmap_bytes;
|
base += (surf->light_t * LMBLOCK_WIDTH + surf->light_s) * lightmap_bytes;
|
||||||
R_BuildLightMap (surf, base, LMBLOCK_WIDTH*lightmap_bytes);
|
R_BuildLightMap (surf, base, LMBLOCK_WIDTH*lightmap_bytes);
|
||||||
}
|
}
|
||||||
|
@ -883,9 +883,9 @@ void GL_BuildLightmaps (void)
|
||||||
|
|
||||||
//Spike -- wipe out all the lightmap data (johnfitz -- the gltexture objects were already freed by Mod_ClearAll)
|
//Spike -- wipe out all the lightmap data (johnfitz -- the gltexture objects were already freed by Mod_ClearAll)
|
||||||
for (i=0; i < lightmap_count; i++)
|
for (i=0; i < lightmap_count; i++)
|
||||||
free(lightmap[i].data);
|
free(lightmaps[i].data);
|
||||||
free(lightmap);
|
free(lightmaps);
|
||||||
lightmap = NULL;
|
lightmaps = NULL;
|
||||||
last_lightmap_allocated = 0;
|
last_lightmap_allocated = 0;
|
||||||
lightmap_count = 0;
|
lightmap_count = 0;
|
||||||
|
|
||||||
|
@ -928,7 +928,7 @@ void GL_BuildLightmaps (void)
|
||||||
//
|
//
|
||||||
for (i=0; i<lightmap_count; i++)
|
for (i=0; i<lightmap_count; i++)
|
||||||
{
|
{
|
||||||
lm = &lightmap[i];
|
lm = &lightmaps[i];
|
||||||
lm->modified = false;
|
lm->modified = false;
|
||||||
lm->rectchange.l = LMBLOCK_WIDTH;
|
lm->rectchange.l = LMBLOCK_WIDTH;
|
||||||
lm->rectchange.t = LMBLOCK_HEIGHT;
|
lm->rectchange.t = LMBLOCK_HEIGHT;
|
||||||
|
@ -1252,7 +1252,7 @@ assumes lightmap texture is already bound
|
||||||
*/
|
*/
|
||||||
static void R_UploadLightmap(int lmap)
|
static void R_UploadLightmap(int lmap)
|
||||||
{
|
{
|
||||||
struct lightmap_s *lm = &lightmap[lmap];
|
struct lightmap_s *lm = &lightmaps[lmap];
|
||||||
|
|
||||||
if (!lm->modified)
|
if (!lm->modified)
|
||||||
return;
|
return;
|
||||||
|
@ -1275,10 +1275,10 @@ void R_UploadLightmaps (void)
|
||||||
|
|
||||||
for (lmap = 0; lmap < lightmap_count; lmap++)
|
for (lmap = 0; lmap < lightmap_count; lmap++)
|
||||||
{
|
{
|
||||||
if (!lightmap[lmap].modified)
|
if (!lightmaps[lmap].modified)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GL_Bind (lightmap[lmap].texture);
|
GL_Bind (lightmaps[lmap].texture);
|
||||||
R_UploadLightmap(lmap);
|
R_UploadLightmap(lmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1308,7 +1308,7 @@ void R_RebuildAllLightmaps (void)
|
||||||
{
|
{
|
||||||
if (fa->flags & SURF_DRAWTILED)
|
if (fa->flags & SURF_DRAWTILED)
|
||||||
continue;
|
continue;
|
||||||
base = lightmap[fa->lightmaptexturenum].data;
|
base = lightmaps[fa->lightmaptexturenum].data;
|
||||||
base += fa->light_t * LMBLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes;
|
base += fa->light_t * LMBLOCK_WIDTH * lightmap_bytes + fa->light_s * lightmap_bytes;
|
||||||
R_BuildLightMap (fa, base, LMBLOCK_WIDTH*lightmap_bytes);
|
R_BuildLightMap (fa, base, LMBLOCK_WIDTH*lightmap_bytes);
|
||||||
}
|
}
|
||||||
|
@ -1317,8 +1317,8 @@ void R_RebuildAllLightmaps (void)
|
||||||
//for each lightmap, upload it
|
//for each lightmap, upload it
|
||||||
for (i=0; i<lightmap_count; i++)
|
for (i=0; i<lightmap_count; i++)
|
||||||
{
|
{
|
||||||
GL_Bind (lightmap[i].texture);
|
GL_Bind (lightmaps[i].texture);
|
||||||
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, LMBLOCK_WIDTH, LMBLOCK_HEIGHT, gl_lightmap_format,
|
glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, LMBLOCK_WIDTH, LMBLOCK_HEIGHT, gl_lightmap_format,
|
||||||
GL_UNSIGNED_BYTE, lightmap[i].data);
|
GL_UNSIGNED_BYTE, lightmaps[i].data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,10 +52,10 @@ void R_ClearTextureChains (qmodel_t *mod, texchain_t chain)
|
||||||
for (i=0 ; i<mod->numtextures ; i++)
|
for (i=0 ; i<mod->numtextures ; i++)
|
||||||
if (mod->textures[i])
|
if (mod->textures[i])
|
||||||
mod->textures[i]->texturechains[chain] = NULL;
|
mod->textures[i]->texturechains[chain] = NULL;
|
||||||
|
|
||||||
// clear lightmap chains
|
// clear lightmap chains
|
||||||
for (i=0 ; i<lightmap_count ; i++)
|
for (i=0 ; i<lightmap_count ; i++)
|
||||||
lightmap[i].polys = NULL;
|
lightmaps[i].polys = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -85,7 +85,7 @@ void R_MarkSurfaces (void)
|
||||||
|
|
||||||
// clear lightmap chains
|
// clear lightmap chains
|
||||||
for (i=0 ; i<lightmap_count ; i++)
|
for (i=0 ; i<lightmap_count ; i++)
|
||||||
lightmap[i].polys = NULL;
|
lightmaps[i].polys = NULL;
|
||||||
|
|
||||||
// check this leaf for water portals
|
// check this leaf for water portals
|
||||||
// TODO: loop through all water surfs and use distance to leaf cullbox
|
// TODO: loop through all water surfs and use distance to leaf cullbox
|
||||||
|
@ -139,7 +139,6 @@ void R_MarkSurfaces (void)
|
||||||
cl.worldmodel->textures[i]->texturechains[chain_world] = NULL;
|
cl.worldmodel->textures[i]->texturechains[chain_world] = NULL;
|
||||||
|
|
||||||
// rebuild chains
|
// rebuild chains
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
//iterate through surfaces one node at a time to rebuild chains
|
//iterate through surfaces one node at a time to rebuild chains
|
||||||
//need to do it this way if we want to work with tyrann's skip removal tool
|
//need to do it this way if we want to work with tyrann's skip removal tool
|
||||||
|
@ -249,7 +248,7 @@ void R_BuildLightmapChains (qmodel_t *model, texchain_t chain)
|
||||||
|
|
||||||
// clear lightmap chains (already done in r_marksurfaces, but clearing them here to be safe becuase of r_stereo)
|
// clear lightmap chains (already done in r_marksurfaces, but clearing them here to be safe becuase of r_stereo)
|
||||||
for (i=0 ; i<lightmap_count ; i++)
|
for (i=0 ; i<lightmap_count ; i++)
|
||||||
lightmap[i].polys = NULL;
|
lightmaps[i].polys = NULL;
|
||||||
|
|
||||||
// now rebuild them
|
// now rebuild them
|
||||||
for (i=0 ; i<model->numtextures ; i++)
|
for (i=0 ; i<model->numtextures ; i++)
|
||||||
|
@ -497,10 +496,10 @@ static void R_BatchSurface (msurface_t *s)
|
||||||
int num_surf_indices;
|
int num_surf_indices;
|
||||||
|
|
||||||
num_surf_indices = R_NumTriangleIndicesForSurf (s);
|
num_surf_indices = R_NumTriangleIndicesForSurf (s);
|
||||||
|
|
||||||
if (num_vbo_indices + num_surf_indices > MAX_BATCH_SIZE)
|
if (num_vbo_indices + num_surf_indices > MAX_BATCH_SIZE)
|
||||||
R_FlushBatch();
|
R_FlushBatch();
|
||||||
|
|
||||||
R_TriangleIndicesForSurf (s, &vbo_indices[num_vbo_indices]);
|
R_TriangleIndicesForSurf (s, &vbo_indices[num_vbo_indices]);
|
||||||
num_vbo_indices += num_surf_indices;
|
num_vbo_indices += num_surf_indices;
|
||||||
}
|
}
|
||||||
|
@ -539,7 +538,7 @@ void R_DrawTextureChains_Multitexture (qmodel_t *model, entity_t *ent, texchain_
|
||||||
GL_EnableMultitexture(); // selects TEXTURE1
|
GL_EnableMultitexture(); // selects TEXTURE1
|
||||||
bound = true;
|
bound = true;
|
||||||
}
|
}
|
||||||
GL_Bind (lightmap[s->lightmaptexturenum].texture);
|
GL_Bind (lightmaps[s->lightmaptexturenum].texture);
|
||||||
glBegin(GL_POLYGON);
|
glBegin(GL_POLYGON);
|
||||||
v = s->polys->verts[0];
|
v = s->polys->verts[0];
|
||||||
for (j=0 ; j<s->polys->numverts ; j++, v+= VERTEXSIZE)
|
for (j=0 ; j<s->polys->numverts ; j++, v+= VERTEXSIZE)
|
||||||
|
@ -777,11 +776,11 @@ void R_DrawLightmapChains (void)
|
||||||
|
|
||||||
for (i=0 ; i<lightmap_count ; i++)
|
for (i=0 ; i<lightmap_count ; i++)
|
||||||
{
|
{
|
||||||
if (!lightmap[i].polys)
|
if (!lightmaps[i].polys)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GL_Bind (lightmap[i].texture);
|
GL_Bind (lightmaps[i].texture);
|
||||||
for (p = lightmap[i].polys; p; p=p->chain)
|
for (p = lightmaps[i].polys; p; p=p->chain)
|
||||||
{
|
{
|
||||||
glBegin (GL_POLYGON);
|
glBegin (GL_POLYGON);
|
||||||
v = p->verts[0];
|
v = p->verts[0];
|
||||||
|
@ -878,10 +877,10 @@ void GLWorld_CreateShaders (void)
|
||||||
" result.a = Alpha;\n" // FIXME: This will make almost transparent things cut holes though heavy fog
|
" result.a = Alpha;\n" // FIXME: This will make almost transparent things cut holes though heavy fog
|
||||||
" gl_FragColor = result;\n"
|
" gl_FragColor = result;\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
if (!gl_glsl_alias_able)
|
if (!gl_glsl_alias_able)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
r_world_program = GL_CreateProgram (vertSource, fragSource, sizeof(bindings)/sizeof(bindings[0]), bindings);
|
r_world_program = GL_CreateProgram (vertSource, fragSource, sizeof(bindings)/sizeof(bindings[0]), bindings);
|
||||||
|
|
||||||
if (r_world_program != 0)
|
if (r_world_program != 0)
|
||||||
|
@ -916,7 +915,7 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||||
int lastlightmap;
|
int lastlightmap;
|
||||||
gltexture_t *fullbright = NULL;
|
gltexture_t *fullbright = NULL;
|
||||||
float entalpha;
|
float entalpha;
|
||||||
|
|
||||||
entalpha = (ent != NULL) ? ENTALPHA_DECODE(ent->alpha) : 1.0f;
|
entalpha = (ent != NULL) ? ENTALPHA_DECODE(ent->alpha) : 1.0f;
|
||||||
|
|
||||||
// enable blending / disable depth writes
|
// enable blending / disable depth writes
|
||||||
|
@ -925,9 +924,9 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||||
glDepthMask (GL_FALSE);
|
glDepthMask (GL_FALSE);
|
||||||
glEnable (GL_BLEND);
|
glEnable (GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_UseProgramFunc (r_world_program);
|
GL_UseProgramFunc (r_world_program);
|
||||||
|
|
||||||
// Bind the buffers
|
// Bind the buffers
|
||||||
GL_BindBuffer (GL_ARRAY_BUFFER, gl_bmodel_vbo);
|
GL_BindBuffer (GL_ARRAY_BUFFER, gl_bmodel_vbo);
|
||||||
GL_BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0); // indices come from client memory!
|
GL_BindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0); // indices come from client memory!
|
||||||
|
@ -935,11 +934,11 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||||
GL_EnableVertexAttribArrayFunc (vertAttrIndex);
|
GL_EnableVertexAttribArrayFunc (vertAttrIndex);
|
||||||
GL_EnableVertexAttribArrayFunc (texCoordsAttrIndex);
|
GL_EnableVertexAttribArrayFunc (texCoordsAttrIndex);
|
||||||
GL_EnableVertexAttribArrayFunc (LMCoordsAttrIndex);
|
GL_EnableVertexAttribArrayFunc (LMCoordsAttrIndex);
|
||||||
|
|
||||||
GL_VertexAttribPointerFunc (vertAttrIndex, 3, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), ((float *)0));
|
GL_VertexAttribPointerFunc (vertAttrIndex, 3, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), ((float *)0));
|
||||||
GL_VertexAttribPointerFunc (texCoordsAttrIndex, 2, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), ((float *)0) + 3);
|
GL_VertexAttribPointerFunc (texCoordsAttrIndex, 2, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), ((float *)0) + 3);
|
||||||
GL_VertexAttribPointerFunc (LMCoordsAttrIndex, 2, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), ((float *)0) + 5);
|
GL_VertexAttribPointerFunc (LMCoordsAttrIndex, 2, GL_FLOAT, GL_FALSE, VERTEXSIZE * sizeof(float), ((float *)0) + 5);
|
||||||
|
|
||||||
// set uniforms
|
// set uniforms
|
||||||
GL_Uniform1iFunc (texLoc, 0);
|
GL_Uniform1iFunc (texLoc, 0);
|
||||||
GL_Uniform1iFunc (LMTexLoc, 1);
|
GL_Uniform1iFunc (LMTexLoc, 1);
|
||||||
|
@ -948,7 +947,7 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||||
GL_Uniform1iFunc (useOverbrightLoc, (int)gl_overbright.value);
|
GL_Uniform1iFunc (useOverbrightLoc, (int)gl_overbright.value);
|
||||||
GL_Uniform1iFunc (useAlphaTestLoc, 0);
|
GL_Uniform1iFunc (useAlphaTestLoc, 0);
|
||||||
GL_Uniform1fFunc (alphaLoc, entalpha);
|
GL_Uniform1fFunc (alphaLoc, entalpha);
|
||||||
|
|
||||||
for (i=0 ; i<model->numtextures ; i++)
|
for (i=0 ; i<model->numtextures ; i++)
|
||||||
{
|
{
|
||||||
t = model->textures[i];
|
t = model->textures[i];
|
||||||
|
@ -990,7 +989,7 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||||
R_FlushBatch ();
|
R_FlushBatch ();
|
||||||
|
|
||||||
GL_SelectTexture (GL_TEXTURE1);
|
GL_SelectTexture (GL_TEXTURE1);
|
||||||
GL_Bind (lightmap[s->lightmaptexturenum].texture);
|
GL_Bind (lightmaps[s->lightmaptexturenum].texture);
|
||||||
lastlightmap = s->lightmaptexturenum;
|
lastlightmap = s->lightmaptexturenum;
|
||||||
R_BatchSurface (s);
|
R_BatchSurface (s);
|
||||||
|
|
||||||
|
@ -1002,15 +1001,15 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
|
||||||
if (bound && t->texturechains[chain]->flags & SURF_DRAWFENCE)
|
if (bound && t->texturechains[chain]->flags & SURF_DRAWFENCE)
|
||||||
GL_Uniform1iFunc (useAlphaTestLoc, 0); // Flip alpha test back off
|
GL_Uniform1iFunc (useAlphaTestLoc, 0); // Flip alpha test back off
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
GL_DisableVertexAttribArrayFunc (vertAttrIndex);
|
GL_DisableVertexAttribArrayFunc (vertAttrIndex);
|
||||||
GL_DisableVertexAttribArrayFunc (texCoordsAttrIndex);
|
GL_DisableVertexAttribArrayFunc (texCoordsAttrIndex);
|
||||||
GL_DisableVertexAttribArrayFunc (LMCoordsAttrIndex);
|
GL_DisableVertexAttribArrayFunc (LMCoordsAttrIndex);
|
||||||
|
|
||||||
GL_UseProgramFunc (0);
|
GL_UseProgramFunc (0);
|
||||||
GL_SelectTexture (GL_TEXTURE0);
|
GL_SelectTexture (GL_TEXTURE0);
|
||||||
|
|
||||||
if (entalpha < 1)
|
if (entalpha < 1)
|
||||||
{
|
{
|
||||||
glDepthMask (GL_TRUE);
|
glDepthMask (GL_TRUE);
|
||||||
|
|
Loading…
Reference in New Issue