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