]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
removed directional shading on explosions because it was a nuisance to maintain ...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 May 2003 18:20:52 +0000 (18:20 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 May 2003 18:20:52 +0000 (18:20 +0000)
explosion rendering now supports gl_mesh_copyarrays 0

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3048 d7cf8633-e32d-0410-b094-e92efae38249

r_explosion.c

index 669a874af592bcb4198324b6fd0200d6e1660b64..80f4909fa1abeb7a49fc177a70806842ceaab9b1 100644 (file)
@@ -175,8 +175,8 @@ void R_NewExplosion(vec3_t org)
 
 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;
@@ -186,36 +186,24 @@ void R_DrawExplosionCallback(const void *calldata1, int calldata2)
        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]);
 }