- int i, numtriangles, numverts;
- float *c, *v, diff[3], centerdir[3], ifog, alpha, dist;
- rmeshstate_t m;
- const explosion_t *e;
- e = calldata1;
-
- memset(&m, 0, sizeof(m));
- m.blendfunc1 = GL_SRC_ALPHA;
- 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);
-
- for (i = 0, v = varray_vertex;i < numverts;i++, v += 4)
- {
- v[0] = e->vert[i][0];
- v[1] = e->vert[i][1];
- v[2] = e->vert[i][2];
- }
- memcpy(varray_texcoord[0], explosiontexcoords, numverts * sizeof(float[4]));
- alpha = e->alpha;
- VectorSubtract(r_origin, e->origin, centerdir);
- VectorNormalizeFast(centerdir);
- if (fogenabled)
- {
- for (i = 0, c = varray_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 *= r_colorscale;
- }
- else
- dist = 0;
- c[0] = c[1] = c[2] = dist;
- c[3] = 1;
- }
- }
- else
+ int surfacelistindex = 0;
+ const int numtriangles = EXPLOSIONTRIS, numverts = EXPLOSIONVERTS;
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
+ GL_DepthMask(false);
+ GL_DepthRange(0, 1);
+ GL_PolygonOffset(r_refdef.polygonfactor, r_refdef.polygonoffset);
+ GL_DepthTest(true);
+ GL_CullFace(r_refdef.view.cullface_back);
+ R_EntityMatrix(&identitymatrix);
+
+// R_Mesh_ResetTextureState();
+ R_SetupShader_Generic(explosiontexture, false, false, false);
+ for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)