- R_AliasLerpVerts(paliashdr->numverts, lerp, (trivert2 *)((byte *)paliashdr + paliashdr->posedata) + currententity->draw_lastpose * paliashdr->numverts, paliashdr->scale, paliashdr->scale_origin, (trivert2 *)((byte *)paliashdr + paliashdr->posedata) + currententity->draw_pose * paliashdr->numverts, paliashdr->scale, paliashdr->scale_origin);
-
- R_LightModel(paliashdr->numverts, currententity->origin);
-
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- glShadeModel(GL_SMOOTH);
- if (currententity->effects & EF_ADDITIVE)
- {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE); // additive rendering
- glEnable(GL_BLEND);
- glDepthMask(0);
- }
- else if (modelalpha != 1.0)
- {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glDepthMask(0);
- }
- else
- {
- glDisable(GL_BLEND);
- glDepthMask(1);
- }
-
- if (gl_vertexarrays.value)
- {
- // LordHavoc: I would use InterleavedArrays here,
- // but the texture coordinates are a seperate array,
- // and it would be wasteful to copy them into the main array...
- // glColor4f(shadecolor[0], shadecolor[1], shadecolor[2], modelalpha);
- qglVertexPointer(3, GL_FLOAT, 0, aliasvert);
- qglColorPointer(4, GL_UNSIGNED_BYTE, 0, aliasvertcolor);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
-
- // draw the front faces
- qglTexCoordPointer(2, GL_FLOAT, 0, (void *)((int) paliashdr->texcoords + (int) paliashdr));
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- qglDrawElements(GL_TRIANGLES, paliashdr->frontfaces * 3, GL_UNSIGNED_SHORT, (void *)((int) paliashdr->vertindices + (int) paliashdr));
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-
- // draw the back faces
- qglTexCoordPointer(2, GL_FLOAT, 0, (void *)((int) paliashdr->texcoords + sizeof(float[2]) * paliashdr->numverts + (int) paliashdr));
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- qglDrawElements(GL_TRIANGLES, paliashdr->backfaces * 3, GL_UNSIGNED_SHORT, (void *)((int) paliashdr->vertindices + sizeof(unsigned short[3]) * paliashdr->frontfaces + (int) paliashdr));
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-
- glDisableClientState(GL_COLOR_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
- }
- else
- {
- unsigned short *in, index;
- float *tex;
- in = (void *)((int) paliashdr->vertindices + (int) paliashdr);
- glBegin(GL_TRIANGLES);
- // draw the front faces
- tex = (void *)((int) paliashdr->texcoords + (int) paliashdr);
- //if (isG200)
- //{
- for (i = 0;i < paliashdr->frontfaces * 3;i++)
- {
- index = *in++;
- glTexCoord2f(tex[index*2], tex[index*2+1]);
- glColor4f(aliasvertcolor[index*4] * (1.0f / 255.0f), aliasvertcolor[index*4+1] * (1.0f / 255.0f), aliasvertcolor[index*4+2] * (1.0f / 255.0f), aliasvertcolor[index*4+3] * (1.0f / 255.0f));
- glVertex3fv(&aliasvert[index*3]);
- }
- /*
- }
- else
- {
- for (i = 0;i < paliashdr->frontfaces * 3;i++)
- {
- index = *in++;
- glTexCoord2f(tex[index*2], tex[index*2+1]);
- glColor4ub(aliasvertcolor[index*4], aliasvertcolor[index*4+1], aliasvertcolor[index*4+2], aliasvertcolor[index*4+3]);
- glVertex3fv(&aliasvert[index*3]);
- }
- }
- */
- // draw the back faces
- tex += 2 * paliashdr->numverts;
- //if (isG200)
- //{
- for (i = 0;i < paliashdr->backfaces * 3;i++)
- {
- index = *in++;
- glTexCoord2f(tex[index*2], tex[index*2+1]);
- glColor4f(aliasvertcolor[index*4] * (1.0f / 255.0f), aliasvertcolor[index*4+1] * (1.0f / 255.0f), aliasvertcolor[index*4+2] * (1.0f / 255.0f), aliasvertcolor[index*4+3] * (1.0f / 255.0f));
- glVertex3fv(&aliasvert[index*3]);
- }
- /*
- }
- else
- {
- for (i = 0;i < paliashdr->backfaces * 3;i++)
- {
- index = *in++;
- glTexCoord2f(tex[index*2], tex[index*2+1]);
- glColor4ub(aliasvertcolor[index*4], aliasvertcolor[index*4+1], aliasvertcolor[index*4+2], aliasvertcolor[index*4+3]);
- glVertex3fv(&aliasvert[index*3]);
- }
- }
- */
- glEnd();
- }
-
- if (fogenabled)
- {
- vec3_t diff;
- glDisable (GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable (GL_BLEND);
- glDepthMask(0); // disable zbuffer updates
-
- VectorSubtract(currententity->origin, r_refdef.vieworg, diff);
- glColor4f(fogcolor[0], fogcolor[1], fogcolor[2], exp(fogdensity/DotProduct(diff,diff)));
-
- if (gl_vertexarrays.value)
- {
- qglVertexPointer(3, GL_FLOAT, 0, aliasvert);
- glEnableClientState(GL_VERTEX_ARRAY);
- qglDrawElements(GL_TRIANGLES, paliashdr->numtris * 3, GL_UNSIGNED_SHORT, (void *)((int) paliashdr->vertindices + (int) paliashdr));
- glDisableClientState(GL_VERTEX_ARRAY);
- }
- else
- {
- unsigned short *in;
- in = (void *)((int) paliashdr->vertindices + (int) paliashdr);
- glBegin(GL_TRIANGLES);
- for (i = 0;i < paliashdr->numtris * 3;i++)
- glVertex3fv(&aliasvert[*in++ * 3]);
- glEnd();
- }
-
- glEnable (GL_TEXTURE_2D);
- glColor3f (1,1,1);
- }
-
- if (!fogenabled && r_shadows.value && !(currententity->effects & EF_ADDITIVE) && currententity != &cl.viewent)
- {
- // flatten it to make a shadow
- float *av = aliasvert + 2, l = lightspot[2] + 0.125;
- av = aliasvert + 2;
- for (i = 0;i < paliashdr->numverts;i++, av+=3)
- if (*av > l)
- *av = l;
- glDisable (GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable (GL_BLEND);
- glDepthMask(0); // disable zbuffer updates
- glColor4f (0,0,0,0.5 * modelalpha);
-
- if (gl_vertexarrays.value)
- {
- qglVertexPointer(3, GL_FLOAT, 0, aliasvert);
- glEnableClientState(GL_VERTEX_ARRAY);
- qglDrawElements(GL_TRIANGLES, paliashdr->numtris * 3, GL_UNSIGNED_SHORT, (void *)((int) paliashdr->vertindices + (int) paliashdr));
- glDisableClientState(GL_VERTEX_ARRAY);
- }
- else
- {
- unsigned short *in;
- in = (void *)((int) paliashdr->vertindices + (int) paliashdr);
- glBegin(GL_TRIANGLES);
- for (i = 0;i < paliashdr->numtris * 3;i++)
- glVertex3fv(&aliasvert[*in++ * 3]);
- glEnd();
- }
-
- glEnable (GL_TEXTURE_2D);
- glColor3f (1,1,1);
- }
-
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable (GL_BLEND);
- glDepthMask(1);