mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 12:52:46 +00:00
code cleanups and possibly minor optimisations
This commit is contained in:
parent
714f429276
commit
05f489735e
2 changed files with 14 additions and 28 deletions
|
@ -250,6 +250,7 @@ vec3_t shadevector;
|
|||
static void
|
||||
GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
|
||||
{
|
||||
float color[4];
|
||||
float l;
|
||||
int count;
|
||||
int *order;
|
||||
|
@ -258,6 +259,8 @@ GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
|
|||
verts = vo->verts;
|
||||
order = vo->order;
|
||||
|
||||
color[3] = modelalpha;
|
||||
|
||||
if (modelalpha != 1.0)
|
||||
qfglDepthMask (GL_FALSE);
|
||||
|
||||
|
@ -277,16 +280,15 @@ GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
|
|||
|
||||
do {
|
||||
// texture coordinates come from the draw list
|
||||
qfglTexCoord2f (((float *) order)[0], ((float *) order)[1]);
|
||||
qfglTexCoord2fv ((float *) order);
|
||||
order += 2;
|
||||
|
||||
if (!fb) {
|
||||
// normals and vertexes come from the frame list
|
||||
l = shadelight * verts->lightdot;
|
||||
VectorScale (shadecolor, l, color);
|
||||
|
||||
// LordHavoc: cleanup after Endy
|
||||
qfglColor4f (shadecolor[0] * l, shadecolor[1] * l,
|
||||
shadecolor[2] * l, modelalpha);
|
||||
qfglColor4fv (color);
|
||||
}
|
||||
|
||||
qfglVertex3fv (verts->vert);
|
||||
|
|
|
@ -760,41 +760,26 @@ R_RecursiveWorldNode (mnode_t *node)
|
|||
|
||||
// find which side of the node we are on
|
||||
plane = node->plane;
|
||||
|
||||
switch (plane->type) {
|
||||
case PLANE_X:
|
||||
dot = modelorg[0] - plane->dist;
|
||||
break;
|
||||
case PLANE_Y:
|
||||
dot = modelorg[1] - plane->dist;
|
||||
break;
|
||||
case PLANE_Z:
|
||||
dot = modelorg[2] - plane->dist;
|
||||
break;
|
||||
default:
|
||||
dot = DotProduct (modelorg, plane->normal) - plane->dist;
|
||||
break;
|
||||
}
|
||||
|
||||
if (plane->type < 3)
|
||||
dot = modelorg[plane->type] - plane->dist;
|
||||
else
|
||||
dot = DotProduct (modelorg, plane->normal) - plane->dist;
|
||||
side = dot < 0;
|
||||
|
||||
// recurse down the children, front side first
|
||||
R_RecursiveWorldNode (node->children[side]);
|
||||
|
||||
// sneaky hack for side = side ? SURF_PLANEBACK : 0;
|
||||
side = (~side + 1) & SURF_PLANEBACK;
|
||||
// draw stuff
|
||||
if ((c = node->numsurfaces)) {
|
||||
surf = r_worldentity.model->surfaces + node->firstsurface;
|
||||
|
||||
if (dot < -BACKFACE_EPSILON)
|
||||
side = SURF_PLANEBACK;
|
||||
else if (dot > BACKFACE_EPSILON)
|
||||
side = 0;
|
||||
|
||||
for (; c; c--, surf++) {
|
||||
if (surf->visframe != r_visframecount)
|
||||
continue;
|
||||
|
||||
if ((dot < 0) ^ !!(surf->flags & SURF_PLANEBACK))
|
||||
// side is either 0 or SURF_PLANEBACK
|
||||
if (side ^ (surf->flags & SURF_PLANEBACK))
|
||||
continue; // wrong side
|
||||
|
||||
if (surf->flags & SURF_DRAWTURB) {
|
||||
|
@ -803,7 +788,6 @@ R_RecursiveWorldNode (mnode_t *node)
|
|||
} else if (surf->flags & SURF_DRAWSKY) {
|
||||
surf->texturechain = sky_chain;
|
||||
sky_chain = surf;
|
||||
continue;
|
||||
} else if (gl_mtex_active) {
|
||||
R_DrawMultitexturePoly (surf);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue