mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-27 06:34:11 +00:00
some small performance optimizations with textures and animations
This commit is contained in:
parent
49deaf2661
commit
347cdc5e33
3 changed files with 41 additions and 15 deletions
|
@ -468,8 +468,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
|
|||
if (cull && R_CullBox (mins, maxs))
|
||||
return;
|
||||
|
||||
VectorCopy (e->origin, r_entorigin);
|
||||
VectorSubtract (r_origin, r_entorigin, modelorg);
|
||||
VectorSubtract (r_origin, e->origin, modelorg);
|
||||
|
||||
if (clmodel->fullbright) {
|
||||
shadelight = 1.0; // make certain models full brightness always
|
||||
|
|
|
@ -468,7 +468,18 @@ R_Mirror (void)
|
|||
qfglColor4ubv (color_white);
|
||||
s = r_worldentity.model->textures[mirrortexturenum]->texturechain;
|
||||
for (; s; s = s->texturechain) {
|
||||
texture_t *tex = R_TextureAnimation (s);
|
||||
texture_t *tex;
|
||||
if (!s->texinfo->texture->anim_total)
|
||||
tex = s->texinfo->texture;
|
||||
else
|
||||
tex = R_TextureAnimation (s);
|
||||
|
||||
// FIXME: if this is needed, then include header for fullbright_polys
|
||||
// if ( tex->gl_fb_texturenum > 0) {
|
||||
// s->polys->fb_chain = fullbright_polys[tex->gl_fb_texturenum];
|
||||
// fullbright_polys[tex->gl_fb_texturenum] = s->polys;
|
||||
// }
|
||||
|
||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||
R_RenderBrushPoly (s);
|
||||
}
|
||||
|
|
|
@ -324,9 +324,6 @@ R_TextureAnimation (msurface_t *surf)
|
|||
base = base->alternate_anims;
|
||||
}
|
||||
|
||||
if (!base->anim_total)
|
||||
goto found;
|
||||
|
||||
relative = (int) (r_realtime * 10) % base->anim_total;
|
||||
|
||||
count = 0;
|
||||
|
@ -337,11 +334,6 @@ R_TextureAnimation (msurface_t *surf)
|
|||
if (++count > 100)
|
||||
Sys_Error ("R_TextureAnimation: infinite cycle");
|
||||
}
|
||||
found:
|
||||
if (base->gl_fb_texturenum > 0) {
|
||||
surf->polys->fb_chain = fullbright_polys[base->gl_fb_texturenum];
|
||||
fullbright_polys[base->gl_fb_texturenum] = surf->polys;
|
||||
}
|
||||
|
||||
return base;
|
||||
}
|
||||
|
@ -380,8 +372,16 @@ R_DrawMultitexturePoly (msurface_t *s)
|
|||
{
|
||||
float *v;
|
||||
int maps, i;
|
||||
texture_t *texture = R_TextureAnimation (s);
|
||||
|
||||
texture_t *texture;
|
||||
|
||||
if (!s->texinfo->texture->anim_total)
|
||||
texture = s->texinfo->texture;
|
||||
else
|
||||
texture = R_TextureAnimation (s);
|
||||
if ( texture->gl_fb_texturenum > 0) {
|
||||
s->polys->fb_chain = fullbright_polys[texture->gl_fb_texturenum];
|
||||
fullbright_polys[texture->gl_fb_texturenum] = s->polys;
|
||||
}
|
||||
c_brush_polys++;
|
||||
|
||||
i = s->lightmaptexturenum;
|
||||
|
@ -707,7 +707,15 @@ R_DrawBrushModel (entity_t *e)
|
|||
} else if (gl_mtex_active) {
|
||||
R_DrawMultitexturePoly (psurf);
|
||||
} else {
|
||||
texture_t *tex = R_TextureAnimation (psurf);
|
||||
texture_t *tex;
|
||||
if (!psurf->texinfo->texture->anim_total)
|
||||
tex = psurf->texinfo->texture;
|
||||
else
|
||||
tex = R_TextureAnimation (psurf);
|
||||
if ( tex->gl_fb_texturenum > 0) {
|
||||
psurf->polys->fb_chain = fullbright_polys[tex->gl_fb_texturenum];
|
||||
fullbright_polys[tex->gl_fb_texturenum] = psurf->polys;
|
||||
}
|
||||
qfglBindTexture (GL_TEXTURE_2D, tex->gl_texturenum);
|
||||
R_RenderBrushPoly (psurf);
|
||||
}
|
||||
|
@ -789,7 +797,15 @@ R_RecursiveWorldNode (mnode_t *node)
|
|||
} else if (gl_mtex_active) {
|
||||
R_DrawMultitexturePoly (surf);
|
||||
} else {
|
||||
texture_t *tex = R_TextureAnimation (surf);
|
||||
texture_t *tex;
|
||||
if (!surf->texinfo->texture->anim_total)
|
||||
tex = surf->texinfo->texture;
|
||||
else
|
||||
tex = R_TextureAnimation (surf);
|
||||
if (tex->gl_fb_texturenum > 0) {
|
||||
surf->polys->fb_chain = fullbright_polys[tex->gl_fb_texturenum];
|
||||
fullbright_polys[tex->gl_fb_texturenum] = surf->polys;
|
||||
}
|
||||
CHAIN_SURF (surf, tex->texturechain);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue