mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
Reorder a lot of code, removing tons of ifs. multitexture paths are a bit more
sane now. Also optimize QSG2 color handling, and fix some QSG2 bugs. Not that anyone cares, nobody uses it anyways. Should be faster, but isn't here. *grmbl*
This commit is contained in:
parent
b502cfc3ce
commit
872498a1f0
4 changed files with 201 additions and 163 deletions
|
@ -37,7 +37,6 @@ void GL_BuildLightmaps (struct model_s **models, int num_models);
|
||||||
|
|
||||||
void R_DrawBrushModel (struct entity_s *e);
|
void R_DrawBrushModel (struct entity_s *e);
|
||||||
void R_DrawWorld (void);
|
void R_DrawWorld (void);
|
||||||
inline void R_RenderBrushPoly (msurface_t *fa, texture_t *tex);
|
|
||||||
|
|
||||||
void EmitWaterPolys (msurface_t *fa);
|
void EmitWaterPolys (msurface_t *fa);
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,6 @@ R_DrawEntitiesOnList (void)
|
||||||
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
|
qfglHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
|
||||||
if (gl_mtex_active) { // FIXME: Ugly, but faster than cleaning up in every
|
if (gl_mtex_active) { // FIXME: Ugly, but faster than cleaning up in every
|
||||||
// R_DrawAliasModel()!
|
// R_DrawAliasModel()!
|
||||||
// qfglColor4ubv (color_white);
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
if (gl_combine_capable && gl_doublebright->int_val) {
|
if (gl_combine_capable && gl_doublebright->int_val) {
|
||||||
|
@ -326,7 +325,6 @@ R_DrawViewModel (void)
|
||||||
qfglColor3ubv (color_white);
|
qfglColor3ubv (color_white);
|
||||||
if (gl_mtex_active) { // FIXME: Ugly, but faster than cleaning up in every
|
if (gl_mtex_active) { // FIXME: Ugly, but faster than cleaning up in every
|
||||||
// R_DrawAliasModel()!
|
// R_DrawAliasModel()!
|
||||||
// qfglColor4ubv (color_white);
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
if (gl_combine_capable && gl_doublebright->int_val) {
|
if (gl_combine_capable && gl_doublebright->int_val) {
|
||||||
|
@ -604,7 +602,7 @@ R_Mirror (void)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
R_RenderBrushPoly (s, tex);
|
// R_RenderBrushPoly (s, tex); // FIXME: Need to move R_Mirror to gl_rsurf.c, and uncommment this line!
|
||||||
}
|
}
|
||||||
r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL;
|
r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL;
|
||||||
qfglColor3ubv (color_white);
|
qfglColor3ubv (color_white);
|
||||||
|
|
|
@ -142,8 +142,8 @@ R_RenderFullbrights (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
static inline void
|
||||||
R_RenderBrushPoly (msurface_t *fa, texture_t *tex)
|
R_RenderBrushPoly_3 (msurface_t *fa, texture_t *tex)
|
||||||
{
|
{
|
||||||
float *v;
|
float *v;
|
||||||
int i;
|
int i;
|
||||||
|
@ -153,27 +153,50 @@ R_RenderBrushPoly (msurface_t *fa, texture_t *tex)
|
||||||
qfglBegin (GL_POLYGON);
|
qfglBegin (GL_POLYGON);
|
||||||
v = fa->polys->verts[0];
|
v = fa->polys->verts[0];
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
||||||
if (tex->gl_fb_texturenum && gl_mtex_fullbright
|
qglMultiTexCoord2fv (gl_mtex_enum + 0, &v[3]);
|
||||||
&& gl_fb_bmodels->int_val) {
|
qglMultiTexCoord2fv (gl_mtex_enum + 1, &v[5]);
|
||||||
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
qglMultiTexCoord2fv (gl_mtex_enum + 2, &v[3]);
|
||||||
qglMultiTexCoord2fv (gl_mtex_enum + 0, &v[3]);
|
qfglVertex3fv (v);
|
||||||
qglMultiTexCoord2fv (gl_mtex_enum + 1, &v[5]);
|
}
|
||||||
qglMultiTexCoord2fv (gl_mtex_enum + 2, &v[3]);
|
|
||||||
qfglVertex3fv (v);
|
qfglEnd ();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
static inline void
|
||||||
qglMultiTexCoord2fv (gl_mtex_enum + 0, &v[3]);
|
R_RenderBrushPoly_2 (msurface_t *fa, texture_t *tex)
|
||||||
qglMultiTexCoord2fv (gl_mtex_enum + 1, &v[5]);
|
{
|
||||||
qfglVertex3fv (v);
|
float *v;
|
||||||
}
|
int i;
|
||||||
}
|
|
||||||
} else {
|
c_brush_polys++;
|
||||||
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
|
||||||
qfglTexCoord2fv (&v[3]);
|
qfglBegin (GL_POLYGON);
|
||||||
qfglVertex3fv (v);
|
v = fa->polys->verts[0];
|
||||||
}
|
|
||||||
|
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
||||||
|
qglMultiTexCoord2fv (gl_mtex_enum + 0, &v[3]);
|
||||||
|
qglMultiTexCoord2fv (gl_mtex_enum + 1, &v[5]);
|
||||||
|
qfglVertex3fv (v);
|
||||||
|
}
|
||||||
|
|
||||||
|
qfglEnd ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
R_RenderBrushPoly_1 (msurface_t *fa, texture_t *tex)
|
||||||
|
{
|
||||||
|
float *v;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
c_brush_polys++;
|
||||||
|
|
||||||
|
qfglBegin (GL_POLYGON);
|
||||||
|
v = fa->polys->verts[0];
|
||||||
|
|
||||||
|
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
|
||||||
|
qfglTexCoord2fv (&v[3]);
|
||||||
|
qfglVertex3fv (v);
|
||||||
}
|
}
|
||||||
|
|
||||||
qfglEnd ();
|
qfglEnd ();
|
||||||
|
@ -257,10 +280,10 @@ R_DrawWaterSurfaces (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static void
|
||||||
DrawTextureChains (void)
|
DrawTextureChains (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
msurface_t *s;
|
msurface_t *s;
|
||||||
texture_t *tex;
|
texture_t *tex;
|
||||||
|
|
||||||
|
@ -272,16 +295,11 @@ DrawTextureChains (void)
|
||||||
// Base Texture
|
// Base Texture
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
} else {
|
|
||||||
qfglDisable (GL_BLEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < r_worldentity.model->numtextures; i++) {
|
for (i = 0; i < r_worldentity.model->numtextures; i++) {
|
||||||
tex = r_worldentity.model->textures[i];
|
tex = r_worldentity.model->textures[i];
|
||||||
if (!tex)
|
if (!tex)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
|
|
||||||
if (tex->gl_fb_texturenum && gl_mtex_fullbright
|
if (tex->gl_fb_texturenum && gl_mtex_fullbright
|
||||||
|
@ -289,40 +307,33 @@ DrawTextureChains (void)
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
qglActiveTexture (gl_mtex_enum + 2);
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_fb_texturenum);
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_fb_texturenum);
|
||||||
}
|
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
for (s = tex->texturechain; s; s = s->texturechain) {
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
||||||
|
s->lightmaptexturenum);
|
||||||
|
|
||||||
for (s = tex->texturechain; s; s = s->texturechain) {
|
R_RenderBrushPoly_3 (s, tex);
|
||||||
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
}
|
||||||
s->lightmaptexturenum);
|
|
||||||
|
|
||||||
R_RenderBrushPoly (s, tex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tex->gl_fb_texturenum && gl_mtex_fullbright
|
|
||||||
&& gl_fb_bmodels->int_val) {
|
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
qglActiveTexture (gl_mtex_enum + 2);
|
||||||
qfglDisable (GL_TEXTURE_2D);
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
|
} else {
|
||||||
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
for (s = tex->texturechain; s; s = s->texturechain) {
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
||||||
|
s->lightmaptexturenum);
|
||||||
|
|
||||||
|
R_RenderBrushPoly_2 (s, tex);
|
||||||
|
}
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
}
|
}
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
tex->texturechain = NULL;
|
||||||
} else {
|
tex->texturechain_tail = &tex->texturechain;
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
|
||||||
|
|
||||||
for (s = tex->texturechain; s; s = s->texturechain)
|
|
||||||
R_RenderBrushPoly (s, tex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tex->texturechain = NULL;
|
|
||||||
tex->texturechain_tail = &tex->texturechain;
|
|
||||||
}
|
|
||||||
tex = r_notexture_mip;
|
|
||||||
tex->texturechain = NULL;
|
|
||||||
tex->texturechain_tail = &tex->texturechain;
|
|
||||||
|
|
||||||
if (!gl_mtex_active) {
|
|
||||||
qfglEnable (GL_BLEND);
|
|
||||||
} else {
|
|
||||||
// Turn off lightmaps for other entities
|
// Turn off lightmaps for other entities
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
qfglDisable (GL_TEXTURE_2D);
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
@ -330,14 +341,33 @@ DrawTextureChains (void)
|
||||||
// Reset mode for default TMU
|
// Reset mode for default TMU
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
} else {
|
||||||
|
qfglDisable (GL_BLEND);
|
||||||
|
for (i = 0; i < r_worldentity.model->numtextures; i++) {
|
||||||
|
tex = r_worldentity.model->textures[i];
|
||||||
|
if (!tex)
|
||||||
|
continue;
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
|
|
||||||
|
for (s = tex->texturechain; s; s = s->texturechain)
|
||||||
|
R_RenderBrushPoly_1 (s, tex);
|
||||||
|
|
||||||
|
tex->texturechain = NULL;
|
||||||
|
tex->texturechain_tail = &tex->texturechain;
|
||||||
|
}
|
||||||
|
qfglEnable (GL_BLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tex = r_notexture_mip;
|
||||||
|
tex->texturechain = NULL;
|
||||||
|
tex->texturechain_tail = &tex->texturechain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_DrawBrushModel (entity_t *e)
|
R_DrawBrushModel (entity_t *e)
|
||||||
{
|
{
|
||||||
float dot, radius;
|
float dot, radius;
|
||||||
float color[4];
|
float color[4], watercolor[4];
|
||||||
int i;
|
int i;
|
||||||
unsigned int k;
|
unsigned int k;
|
||||||
model_t *model;
|
model_t *model;
|
||||||
|
@ -372,7 +402,11 @@ R_DrawBrushModel (entity_t *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy (e->colormod, color);
|
VectorCopy (e->colormod, color);
|
||||||
|
VectorCopy (color, watercolor);
|
||||||
color[3] = e->colormod[3];
|
color[3] = e->colormod[3];
|
||||||
|
qfglColor4fv (color);
|
||||||
|
if (color[3] < 1.0)
|
||||||
|
qfglDepthMask (GL_FALSE);
|
||||||
|
|
||||||
memset (lightmap_polys, 0, sizeof (lightmap_polys));
|
memset (lightmap_polys, 0, sizeof (lightmap_polys));
|
||||||
memset (fullbright_polys, 0, sizeof (fullbright_polys));
|
memset (fullbright_polys, 0, sizeof (fullbright_polys));
|
||||||
|
@ -416,14 +450,10 @@ R_DrawBrushModel (entity_t *e)
|
||||||
R_AddToLightmapChain (psurf);
|
R_AddToLightmapChain (psurf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
if (gl_mtex_active)
|
||||||
R_CalcLightmaps ();
|
R_CalcLightmaps ();
|
||||||
psurf = &model->surfaces[model->firstmodelsurface];
|
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
psurf = &model->surfaces[model->firstmodelsurface];
|
||||||
} else {
|
|
||||||
psurf = &model->surfaces[model->firstmodelsurface];
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw texture
|
// draw texture
|
||||||
for (i = 0; i < model->nummodelsurfaces; i++, psurf++) {
|
for (i = 0; i < model->nummodelsurfaces; i++, psurf++) {
|
||||||
|
@ -439,16 +469,16 @@ R_DrawBrushModel (entity_t *e)
|
||||||
qfglBindTexture (GL_TEXTURE_2D,
|
qfglBindTexture (GL_TEXTURE_2D,
|
||||||
psurf->texinfo->texture->gl_texturenum);
|
psurf->texinfo->texture->gl_texturenum);
|
||||||
if (cl_wateralpha < 1.0) {
|
if (cl_wateralpha < 1.0) {
|
||||||
qfglDepthMask (GL_FALSE);
|
if (color[3] >= 1.0)
|
||||||
color[3] *= cl_wateralpha;
|
qfglDepthMask (GL_FALSE);
|
||||||
qfglColor4fv (color);
|
watercolor[3] = color[3] * cl_wateralpha;
|
||||||
|
qfglColor4fv (watercolor);
|
||||||
EmitWaterPolys (psurf);
|
EmitWaterPolys (psurf);
|
||||||
qfglColor3ubv (color_white);
|
qfglColor4fv (color);
|
||||||
qfglDepthMask (GL_TRUE);
|
if (color[3] >= 1.0)
|
||||||
|
qfglDepthMask (GL_TRUE);
|
||||||
} else {
|
} else {
|
||||||
qfglColor4fv (color);
|
|
||||||
EmitWaterPolys (psurf);
|
EmitWaterPolys (psurf);
|
||||||
qfglColor3ubv (color_white);
|
|
||||||
}
|
}
|
||||||
} else if (psurf->flags & SURF_DRAWSKY) {
|
} else if (psurf->flags & SURF_DRAWSKY) {
|
||||||
// QSG FIXME: add modelalpha support for sky brushes
|
// QSG FIXME: add modelalpha support for sky brushes
|
||||||
|
@ -461,60 +491,59 @@ R_DrawBrushModel (entity_t *e)
|
||||||
else
|
else
|
||||||
tex = R_TextureAnimation (psurf);
|
tex = R_TextureAnimation (psurf);
|
||||||
|
|
||||||
qfglColor4fv (color);
|
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
if (gl_mtex_active) {
|
||||||
if (tex->gl_fb_texturenum && gl_fb_bmodels->int_val
|
if (tex->gl_fb_texturenum && gl_fb_bmodels->int_val
|
||||||
&& gl_mtex_fullbright) {
|
&& gl_mtex_fullbright) {
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
qglActiveTexture (gl_mtex_enum + 2);
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_fb_texturenum);
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_fb_texturenum);
|
||||||
}
|
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
||||||
psurf->lightmaptexturenum);
|
psurf->lightmaptexturenum);
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
} else {
|
R_RenderBrushPoly_3 (psurf, tex);
|
||||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
|
||||||
}
|
|
||||||
|
|
||||||
R_RenderBrushPoly (psurf, tex);
|
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
|
||||||
if (tex->gl_fb_texturenum && gl_fb_bmodels->int_val
|
|
||||||
&& gl_mtex_fullbright) {
|
|
||||||
qglActiveTexture (gl_mtex_enum + 2);
|
qglActiveTexture (gl_mtex_enum + 2);
|
||||||
qfglDisable (GL_TEXTURE_2D);
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
|
} else {
|
||||||
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, lightmap_textures +
|
||||||
|
psurf->lightmaptexturenum);
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
|
R_RenderBrushPoly_2 (psurf, tex);
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 1);
|
||||||
|
qfglDisable (GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
qglActiveTexture (gl_mtex_enum + 0);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||||
|
R_RenderBrushPoly_1 (psurf, tex);
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
if (tex->gl_fb_texturenum && gl_fb_bmodels->int_val) {
|
||||||
qfglDisable (GL_TEXTURE_2D);
|
psurf->polys->fb_chain =
|
||||||
|
fullbright_polys[tex->gl_fb_texturenum];
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
fullbright_polys[tex->gl_fb_texturenum] = psurf->polys;
|
||||||
}
|
}
|
||||||
|
|
||||||
qfglColor3ubv (color_white);
|
|
||||||
|
|
||||||
if (tex->gl_fb_texturenum && gl_fb_bmodels->int_val
|
|
||||||
&& !gl_mtex_fullbright) {
|
|
||||||
psurf->polys->fb_chain =
|
|
||||||
fullbright_polys[tex->gl_fb_texturenum];
|
|
||||||
fullbright_polys[tex->gl_fb_texturenum] = psurf->polys;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_mtex_active) {
|
if (gl_mtex_active) {
|
||||||
// Go away, lightmap
|
|
||||||
qglActiveTexture (gl_mtex_enum + 1);
|
|
||||||
qfglDisable (GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
qglActiveTexture (gl_mtex_enum + 0);
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
} else {
|
} else {
|
||||||
R_CalcAndBlendLightmaps ();
|
R_CalcAndBlendLightmaps ();
|
||||||
|
@ -524,6 +553,10 @@ R_DrawBrushModel (entity_t *e)
|
||||||
R_RenderFullbrights ();
|
R_RenderFullbrights ();
|
||||||
|
|
||||||
qfglPopMatrix ();
|
qfglPopMatrix ();
|
||||||
|
|
||||||
|
if (color[3] < 1.0)
|
||||||
|
qfglDepthMask (GL_TRUE);
|
||||||
|
qfglColor3ubv (color_white);
|
||||||
}
|
}
|
||||||
|
|
||||||
// WORLD MODEL ================================================================
|
// WORLD MODEL ================================================================
|
||||||
|
@ -579,8 +612,10 @@ visit_node (mnode_t *node, int side)
|
||||||
tex = surf->texinfo->texture;
|
tex = surf->texinfo->texture;
|
||||||
else
|
else
|
||||||
tex = R_TextureAnimation (surf);
|
tex = R_TextureAnimation (surf);
|
||||||
if (tex->gl_fb_texturenum) {
|
if (gl_fb_bmodels->int_val && tex->gl_fb_texturenum
|
||||||
surf->polys->fb_chain = fullbright_polys[tex->gl_fb_texturenum];
|
&& !gl_mtex_fullbright) {
|
||||||
|
surf->polys->fb_chain =
|
||||||
|
fullbright_polys[tex->gl_fb_texturenum];
|
||||||
fullbright_polys[tex->gl_fb_texturenum] = surf->polys;
|
fullbright_polys[tex->gl_fb_texturenum] = surf->polys;
|
||||||
}
|
}
|
||||||
CHAIN_SURF_F2B (surf, tex->texturechain);
|
CHAIN_SURF_F2B (surf, tex->texturechain);
|
||||||
|
@ -601,7 +636,7 @@ test_node (mnode_t *node)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME no longer recursive: need a new name
|
// FIXME: R_IterativeWorldNode
|
||||||
static void
|
static void
|
||||||
R_RecursiveWorldNode (mnode_t *node)
|
R_RecursiveWorldNode (mnode_t *node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,14 +115,6 @@ cvar_t *vid_use8bit;
|
||||||
static int gl_mtex_tmus = 0;
|
static int gl_mtex_tmus = 0;
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gl_doublebright_f (cvar_t *var)
|
|
||||||
{
|
|
||||||
if (!gl_combine_capable)
|
|
||||||
Con_Printf ("Warning: doublebright will have no effect without "
|
|
||||||
"GL_COMBINE_ARB unless multitexture is disabled.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gl_max_size_f (cvar_t *var)
|
gl_max_size_f (cvar_t *var)
|
||||||
{
|
{
|
||||||
|
@ -137,6 +129,15 @@ gl_max_size_f (cvar_t *var)
|
||||||
Cvar_SetValue (var, bound (1, var->int_val, texSize));
|
Cvar_SetValue (var, bound (1, var->int_val, texSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gl_doublebright_f (cvar_t *var)
|
||||||
|
{
|
||||||
|
if (!gl_combine_capable && gl_mtex_capable)
|
||||||
|
Con_Printf ("Warning: gl_doublebright has no effect with "
|
||||||
|
"gl_multitexture enabled if you don't have GL_COMBINE_ARB "
|
||||||
|
"support in your driver.\n");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gl_multitexture_f (cvar_t *var)
|
gl_multitexture_f (cvar_t *var)
|
||||||
{
|
{
|
||||||
|
@ -210,6 +211,42 @@ GL_Common_Init_Cvars (void)
|
||||||
"limit, -1 disables use of vertex arrays.");
|
"limit, -1 disables use of vertex arrays.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
CheckGLVersionString (void)
|
||||||
|
{
|
||||||
|
gl_version = qfglGetString (GL_VERSION);
|
||||||
|
if (sscanf (gl_version, "%d.%d", &gl_major, &gl_minor) == 2) {
|
||||||
|
gl_release_number = 0;
|
||||||
|
if (gl_major >= 1) {
|
||||||
|
if (gl_minor >= 1) {
|
||||||
|
gl_va_capable = true;
|
||||||
|
} else
|
||||||
|
gl_va_capable = false;
|
||||||
|
}
|
||||||
|
} else if (sscanf (gl_version, "%d.%d.%d", &gl_major, &gl_minor,
|
||||||
|
&gl_release_number) == 3) {
|
||||||
|
if (gl_major >= 1) {
|
||||||
|
if (gl_minor >= 1) {
|
||||||
|
gl_va_capable = true;
|
||||||
|
} else
|
||||||
|
gl_va_capable = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Sys_Error ("Malformed OpenGL version string!");
|
||||||
|
}
|
||||||
|
Con_Printf ("GL_VERSION: %s\n", gl_version);
|
||||||
|
|
||||||
|
gl_vendor = qfglGetString (GL_VENDOR);
|
||||||
|
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
|
||||||
|
gl_renderer = qfglGetString (GL_RENDERER);
|
||||||
|
Con_Printf ("GL_RENDERER: %s\n", gl_renderer);
|
||||||
|
gl_extensions = qfglGetString (GL_EXTENSIONS);
|
||||||
|
Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions);
|
||||||
|
|
||||||
|
if (strstr (gl_renderer, "Mesa DRI Mach64"))
|
||||||
|
gl_feature_mach64 = true;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CheckCombineExtensions (void)
|
CheckCombineExtensions (void)
|
||||||
{
|
{
|
||||||
|
@ -369,55 +406,24 @@ void
|
||||||
GL_Init_Common (void)
|
GL_Init_Common (void)
|
||||||
{
|
{
|
||||||
GLF_FindFunctions ();
|
GLF_FindFunctions ();
|
||||||
gl_version = qfglGetString (GL_VERSION);
|
CheckGLVersionString ();
|
||||||
if (sscanf (gl_version, "%d.%d", &gl_major, &gl_minor) == 2) {
|
|
||||||
gl_release_number = 0;
|
|
||||||
if (gl_major >= 1) {
|
|
||||||
if (gl_minor >= 1) {
|
|
||||||
gl_va_capable = true;
|
|
||||||
} else
|
|
||||||
gl_va_capable = false;
|
|
||||||
}
|
|
||||||
} else if (sscanf (gl_version, "%d.%d.%d", &gl_major, &gl_minor,
|
|
||||||
&gl_release_number) == 3) {
|
|
||||||
if (gl_major >= 1) {
|
|
||||||
if (gl_minor >= 1) {
|
|
||||||
gl_va_capable = true;
|
|
||||||
} else
|
|
||||||
gl_va_capable = false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Sys_Error ("Malformed OpenGL version string!");
|
|
||||||
}
|
|
||||||
Con_Printf ("GL_VERSION: %s\n", gl_version);
|
|
||||||
|
|
||||||
gl_vendor = qfglGetString (GL_VENDOR);
|
|
||||||
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
|
|
||||||
gl_renderer = qfglGetString (GL_RENDERER);
|
|
||||||
Con_Printf ("GL_RENDERER: %s\n", gl_renderer);
|
|
||||||
gl_extensions = qfglGetString (GL_EXTENSIONS);
|
|
||||||
Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions);
|
|
||||||
|
|
||||||
if (strstr (gl_renderer, "Mesa DRI Mach64"))
|
|
||||||
gl_feature_mach64 = true;
|
|
||||||
|
|
||||||
qfglClearColor (0, 0, 0, 0);
|
qfglClearColor (0, 0, 0, 0);
|
||||||
qfglCullFace (GL_FRONT);
|
|
||||||
qfglEnable (GL_TEXTURE_2D);
|
qfglEnable (GL_TEXTURE_2D);
|
||||||
|
qfglCullFace (GL_FRONT);
|
||||||
qfglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
qfglPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
|
||||||
qfglShadeModel (GL_FLAT);
|
qfglShadeModel (GL_FLAT);
|
||||||
|
|
||||||
|
qfglEnable (GL_BLEND);
|
||||||
|
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
||||||
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||||
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||||
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||||
|
|
||||||
qfglEnable (GL_BLEND);
|
|
||||||
qfglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
qfglTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
|
|
||||||
CheckMultiTextureExtensions ();
|
CheckMultiTextureExtensions ();
|
||||||
CheckCombineExtensions ();
|
CheckCombineExtensions ();
|
||||||
CheckTruFormExtensions ();
|
CheckTruFormExtensions ();
|
||||||
|
|
Loading…
Reference in a new issue