- 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);
- if (fogenabled)
- {
- for (i = 0;i < EXPLOSIONVERTS;i++)
- {
- 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++)
- {
- 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;
- }
- }