void R_DrawExplosionCallback(const void *calldata1, int calldata2)
{
- int i, numtriangles, numverts;
- float *c, diff[3], centerdir[3], alpha, dist;
+ int numtriangles, numverts;
+ float alpha;
rmeshstate_t m;
const explosion_t *e;
e = calldata1;
m.blendfunc2 = GL_ONE;
m.tex[0] = R_GetTexture(explosiontexture);
R_Mesh_Matrix(&r_identitymatrix);
- R_Mesh_State(&m);
numtriangles = EXPLOSIONTRIS;
numverts = EXPLOSIONVERTS;
- GL_UseColorArray();
- R_Mesh_GetSpace(numverts);
-
- R_Mesh_CopyVertex3f(e->vert[0], numverts);
- R_Mesh_CopyTexCoord2f(0, explosiontexcoord2f[0], numverts);
alpha = e->alpha * r_colorscale;
- VectorSubtract(r_origin, e->origin, centerdir);
- VectorNormalizeFast(centerdir);
- for (i = 0, c = varray_color4f;i < EXPLOSIONVERTS;i++, c += 4)
+ GL_Color(alpha, alpha, alpha, 1);
+ if (gl_mesh_copyarrays.integer)
{
- VectorSubtract(e->vert[i], e->origin, diff);
- VectorNormalizeFast(diff);
- dist = (DotProduct(diff, centerdir) * 6.0f - 4.0f) * alpha;
- if (dist > 0)
- {
- if (fogenabled)
- {
- // use inverse fog alpha
- VectorSubtract(e->vert[i], r_origin, diff);
- dist *= (1 - exp(fogdensity/DotProduct(diff,diff)));
- }
- }
- else
- dist = 0;
- c[0] = c[1] = c[2] = dist;
- c[3] = 1;
+ R_Mesh_State(&m);
+ R_Mesh_GetSpace(numverts);
+ R_Mesh_CopyVertex3f(e->vert[0], numverts);
+ R_Mesh_CopyTexCoord2f(0, explosiontexcoord2f[0], numverts);
+ }
+ else
+ {
+ m.pointervertexcount = numverts;
+ m.pointer_vertex = e->vert[0];
+ m.pointer_texcoord[0] = explosiontexcoord2f[0];
+ R_Mesh_State(&m);
}
R_Mesh_Draw(numverts, numtriangles, explosiontris[0]);
}