- int i;
- float c[EXPLOSIONVERTS][4], diff[3], centerdir[3], /*fog, */ifog, alpha, dist/*, centerdist, size, scale*/;
- rmeshinfo_t m;
- memset(&m, 0, sizeof(m));
- m.transparent = true;
- m.blendfunc1 = GL_SRC_ALPHA;
- m.blendfunc2 = GL_ONE; //_MINUS_SRC_ALPHA;
- m.numtriangles = EXPLOSIONTRIS;
- m.index = &explosiontris[0][0];
- m.numverts = EXPLOSIONVERTS;
- m.vertex = &e->vert[0][0];
- m.vertexstep = sizeof(float[3]);
- alpha = e->alpha;
- //if (alpha > 1)
- // alpha = 1;
- m.cr = 1;
- m.cg = 1;
- m.cb = 1;
- m.ca = 1; //alpha;
- m.color = &c[0][0];
- m.colorstep = sizeof(float[4]);
- VectorSubtract(r_origin, e->origin, centerdir);
- VectorNormalizeFast(centerdir);
- /*
- centerdist = DotProduct(e->origin, centerdir);
- size = 0;
- for (i = 0;i < EXPLOSIONVERTS;i++)
- {
- dist = DotProduct(e->vert[i], centerdir) - centerdist;
- if (size < dist)
- size = dist;
- }
- scale = 4.0f / size;
- */
- if (fogenabled)
- {
- for (i = 0;i < EXPLOSIONVERTS;i++)
- {
- //dist = (DotProduct(e->vert[i], centerdir) - centerdist) * scale - 2.0f;
- 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 = 0;
- c[i][0] = c[i][1] = c[i][2] = dist;
- c[i][3] = 1;
- }
- }
- else
- {
- for (i = 0;i < EXPLOSIONVERTS;i++)
- {
- //dist = (DotProduct(e->vert[i], centerdir) - centerdist) * scale - 2.0f;
- VectorSubtract(e->vert[i], e->origin, diff);
- VectorNormalizeFast(diff);
- dist = (DotProduct(diff, centerdir) * 6.0f - 4.0f) * alpha;
- if (dist < 0)
- dist = 0;
- c[i][0] = c[i][1] = c[i][2] = dist;
- c[i][3] = 1;
- }
- }
- /*
- if (fogenabled)
- {
- m.color = &c[0][0];
- m.colorstep = sizeof(float[4]);
- for (i = 0;i < EXPLOSIONVERTS;i++)
- {
- // use inverse fog alpha as color
- VectorSubtract(e->vert[i], r_origin, diff);
- ifog = 1 - exp(fogdensity/DotProduct(diff,diff));
- if (ifog < 0)
- ifog = 0;
- c[i][0] = ifog;
- c[i][1] = ifog;
- c[i][2] = ifog;
- c[i][3] = alpha;
- }
- }
- */
- m.tex[0] = R_GetTexture(explosiontexture);
- m.texcoords[0] = &explosiontexcoords[0][0];
- m.texcoordstep[0] = sizeof(float[2]);
-
- R_Mesh_Draw(&m);
-
- /*
- if (fogenabled)
+ 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++)