- Matrix4x4_CreateIdentity(&m.matrix);
- if (R_Mesh_Draw_GetBuffer(&m, false))
- {
- memcpy(m.index, explosiontris, m.numtriangles * sizeof(int[3]));
- for (i = 0, v = m.vertex;i < m.numverts;i++, v += 4)
- {
- v[0] = e->vert[i][0];
- v[1] = e->vert[i][1];
- v[2] = e->vert[i][2];
- }
- memcpy(m.texcoords[0], explosiontexcoords, m.numverts * sizeof(float[2]));
- alpha = e->alpha;
- VectorSubtract(r_origin, e->origin, centerdir);
- VectorNormalizeFast(centerdir);
- if (fogenabled)
- {
- for (i = 0, c = m.color;i < EXPLOSIONVERTS;i++, c += 4)
- {
- VectorSubtract(e->vert[i], e->origin, diff);
- VectorNormalizeFast(diff);
- dist = (DotProduct(diff, centerdir) * 6.0f - 4.0f) * alpha;
- if (dist > 0)
- {
- // use inverse fog alpha
- VectorSubtract(e->vert[i], r_origin, diff);
- ifog = 1 - exp(fogdensity/DotProduct(diff,diff));
- dist = dist * ifog;
- if (dist < 0)
- dist = 0;
- else
- dist *= m.colorscale;
- }
- else
- dist = 0;
- c[0] = c[1] = c[2] = dist;
- c[3] = 1;
- }
- }
- else
- {
- for (i = 0, c = m.color;i < EXPLOSIONVERTS;i++, c += 4)
- {
- VectorSubtract(e->vert[i], e->origin, diff);
- VectorNormalizeFast(diff);
- dist = (DotProduct(diff, centerdir) * 6.0f - 4.0f) * alpha;
- if (dist < 0)
- dist = 0;
- else
- dist *= m.colorscale;
- c[0] = c[1] = c[2] = dist;
- c[3] = 1;
- }
- }
- R_Mesh_Render();
- }
+ m.pointer_texcoord[0] = explosiontexcoord2f[0];
+ m.pointer_vertex = e->vert[0];
+ R_Mesh_State(&m);
+
+ GL_Color(alpha, alpha, alpha, 1);
+
+ GL_LockArrays(0, numverts);
+ R_Mesh_Draw(numverts, numtriangles, explosiontris[0]);
+ GL_LockArrays(0, 0);