mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
build the texture chains such that they get rendered front to back. seems to
only get about 0.17% speedup in overkill (with just about every thing off), but it might make more of a difference in-game.
This commit is contained in:
parent
9f4a565523
commit
dc779acdb5
3 changed files with 43 additions and 17 deletions
|
@ -86,6 +86,7 @@ typedef struct texture_s
|
||||||
int gl_texturenum;
|
int gl_texturenum;
|
||||||
int gl_fb_texturenum;
|
int gl_fb_texturenum;
|
||||||
struct msurface_s *texturechain; // for gl_texsort drawing
|
struct msurface_s *texturechain; // for gl_texsort drawing
|
||||||
|
struct msurface_s **texturechain_tail;
|
||||||
int anim_total; // total tenths in sequence ( 0 = no)
|
int anim_total; // total tenths in sequence ( 0 = no)
|
||||||
int anim_min, anim_max; // time for this frame min <=time< max
|
int anim_min, anim_max; // time for this frame min <=time< max
|
||||||
struct texture_s *anim_next; // in the animation sequence
|
struct texture_s *anim_next; // in the animation sequence
|
||||||
|
|
|
@ -194,14 +194,15 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
|
||||||
skytexturenum = -1;
|
skytexturenum = -1;
|
||||||
mirrortexturenum = -1;
|
mirrortexturenum = -1;
|
||||||
for (i = 0; i < r_worldentity.model->numtextures; i++) {
|
for (i = 0; i < r_worldentity.model->numtextures; i++) {
|
||||||
if (!r_worldentity.model->textures[i])
|
texture_t *tex = r_worldentity.model->textures[i];
|
||||||
|
if (!tex)
|
||||||
continue;
|
continue;
|
||||||
if (!strncmp (r_worldentity.model->textures[i]->name, "sky", 3))
|
if (!strncmp (tex->name, "sky", 3))
|
||||||
skytexturenum = i;
|
skytexturenum = i;
|
||||||
if (!strncmp (r_worldentity.model->textures[i]->name,
|
if (!strncmp (tex->name, "window02_1", 10))
|
||||||
"window02_1", 10))
|
|
||||||
mirrortexturenum = i;
|
mirrortexturenum = i;
|
||||||
r_worldentity.model->textures[i]->texturechain = NULL;
|
tex->texturechain = NULL;
|
||||||
|
tex->texturechain_tail = &tex->texturechain;
|
||||||
}
|
}
|
||||||
r_skyname = Cvar_FindVar ("r_skyname");
|
r_skyname = Cvar_FindVar ("r_skyname");
|
||||||
if (r_skyname != NULL)
|
if (r_skyname != NULL)
|
||||||
|
|
|
@ -88,7 +88,28 @@ glpoly_t *lightmap_polys[MAX_LIGHTMAPS];
|
||||||
glRect_t lightmap_rectchange[MAX_LIGHTMAPS];
|
glRect_t lightmap_rectchange[MAX_LIGHTMAPS];
|
||||||
|
|
||||||
msurface_t *waterchain = NULL;
|
msurface_t *waterchain = NULL;
|
||||||
|
msurface_t **waterchain_tail = &waterchain;
|
||||||
msurface_t *sky_chain;
|
msurface_t *sky_chain;
|
||||||
|
msurface_t **sky_chain_tail;
|
||||||
|
|
||||||
|
#define CHAIN_SURF_F2B(surf,chain) \
|
||||||
|
do { \
|
||||||
|
*(chain##_tail) = (surf); \
|
||||||
|
(chain##_tail) = &(surf)->texturechain; \
|
||||||
|
*(chain##_tail) = 0; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define CHAIN_SURF_B2F(surf,chain) \
|
||||||
|
do { \
|
||||||
|
(surf)->texturechain = (chain); \
|
||||||
|
(chain) = (surf); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
# define CHAIN_SURF CHAIN_SURF_F2B
|
||||||
|
#else
|
||||||
|
# define CHAIN_SURF CHAIN_SURF_B2F
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// LordHavoc: place for gl_rsurf setup code
|
// LordHavoc: place for gl_rsurf setup code
|
||||||
|
@ -582,6 +603,7 @@ R_DrawWaterSurfaces (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
waterchain = NULL;
|
waterchain = NULL;
|
||||||
|
waterchain_tail = &waterchain;
|
||||||
|
|
||||||
if (r_wateralpha->value < 1.0) {
|
if (r_wateralpha->value < 1.0) {
|
||||||
qfglDepthMask (GL_TRUE);
|
qfglDepthMask (GL_TRUE);
|
||||||
|
@ -598,12 +620,14 @@ DrawTextureChains (void)
|
||||||
qfglDisable (GL_BLEND);
|
qfglDisable (GL_BLEND);
|
||||||
|
|
||||||
for (i = 0; i < r_worldentity.model->numtextures; i++) {
|
for (i = 0; i < r_worldentity.model->numtextures; i++) {
|
||||||
if (!r_worldentity.model->textures[i])
|
texture_t *tex = r_worldentity.model->textures[i];
|
||||||
|
if (!tex)
|
||||||
continue;
|
continue;
|
||||||
for (s = r_worldentity.model->textures[i]->texturechain; s;
|
for (s = tex->texturechain; s; s = s->texturechain)
|
||||||
s = s->texturechain) R_RenderBrushPoly (s);
|
R_RenderBrushPoly (s);
|
||||||
|
|
||||||
r_worldentity.model->textures[i]->texturechain = NULL;
|
tex->texturechain = NULL;
|
||||||
|
tex->texturechain_tail = &tex->texturechain;
|
||||||
}
|
}
|
||||||
|
|
||||||
qfglEnable (GL_BLEND);
|
qfglEnable (GL_BLEND);
|
||||||
|
@ -689,8 +713,7 @@ R_DrawBrushModel (entity_t *e)
|
||||||
if (psurf->flags & SURF_DRAWTURB) {
|
if (psurf->flags & SURF_DRAWTURB) {
|
||||||
GL_WaterSurface (psurf);
|
GL_WaterSurface (psurf);
|
||||||
} else if (psurf->flags & SURF_DRAWSKY) {
|
} else if (psurf->flags & SURF_DRAWSKY) {
|
||||||
psurf->texturechain = sky_chain;
|
CHAIN_SURF (psurf, sky_chain);
|
||||||
sky_chain = psurf;
|
|
||||||
return;
|
return;
|
||||||
} else if (gl_mtex_active) {
|
} else if (gl_mtex_active) {
|
||||||
R_DrawMultitexturePoly (psurf);
|
R_DrawMultitexturePoly (psurf);
|
||||||
|
@ -766,16 +789,16 @@ R_RecursiveWorldNode (mnode_t *node)
|
||||||
continue; // wrong side
|
continue; // wrong side
|
||||||
|
|
||||||
if (surf->flags & SURF_DRAWTURB) {
|
if (surf->flags & SURF_DRAWTURB) {
|
||||||
surf->texturechain = waterchain;
|
if (r_wateralpha->value < 1)
|
||||||
waterchain = surf;
|
CHAIN_SURF_B2F (surf, waterchain);
|
||||||
|
else
|
||||||
|
CHAIN_SURF (surf, waterchain);
|
||||||
} else if (surf->flags & SURF_DRAWSKY) {
|
} else if (surf->flags & SURF_DRAWSKY) {
|
||||||
surf->texturechain = sky_chain;
|
CHAIN_SURF (surf, sky_chain);
|
||||||
sky_chain = surf;
|
|
||||||
} else if (gl_mtex_active) {
|
} else if (gl_mtex_active) {
|
||||||
R_DrawMultitexturePoly (surf);
|
R_DrawMultitexturePoly (surf);
|
||||||
} else {
|
} else {
|
||||||
surf->texturechain = surf->texinfo->texture->texturechain;
|
CHAIN_SURF (surf, surf->texinfo->texture->texturechain);
|
||||||
surf->texinfo->texture->texturechain = surf;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -799,6 +822,7 @@ R_DrawWorld (void)
|
||||||
memset (fullbright_polys, 0, sizeof (fullbright_polys));
|
memset (fullbright_polys, 0, sizeof (fullbright_polys));
|
||||||
|
|
||||||
sky_chain = 0;
|
sky_chain = 0;
|
||||||
|
sky_chain_tail = &sky_chain;
|
||||||
if (!gl_sky_clip->int_val) {
|
if (!gl_sky_clip->int_val) {
|
||||||
R_DrawSky ();
|
R_DrawSky ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue