minor cleanup/simplification (though a bit of a de-optimization) of explosion shading...
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 5 Apr 2002 09:32:12 +0000 (09:32 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 5 Apr 2002 09:32:12 +0000 (09:32 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1712 d7cf8633-e32d-0410-b094-e92efae38249

r_explosion.c

index 8bac758..56ad69a 100644 (file)
@@ -261,18 +261,19 @@ void R_DrawExplosion(explosion_t *e)
                        //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;
+                       dist = (DotProduct(diff, centerdir) * 6.0f - 4.0f) * alpha;
                        if (dist > 0)
                        {
-                               // use inverse fog alpha as color
+                               // use inverse fog alpha
                                VectorSubtract(e->vert[i], r_origin, diff);
                                ifog = 1 - exp(fogdensity/DotProduct(diff,diff));
-                               if (ifog < 0)
-                                       ifog = 0;
-                               c[i][0] = c[i][1] = c[i][2] = dist * alpha * ifog;
+                               dist = dist * ifog;
+                               if (dist < 0)
+                                       dist = 0;
                        }
                        else
-                               c[i][0] = c[i][1] = c[i][2] = 0;
+                               dist = 0;
+                       c[i][0] = c[i][1] = c[i][2] = dist;
                        c[i][3] = 1;
                }
        }
@@ -283,11 +284,10 @@ void R_DrawExplosion(explosion_t *e)
                        //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;
-                       if (dist > 0)
-                               c[i][0] = c[i][1] = c[i][2] = dist * alpha;
-                       else
-                               c[i][0] = c[i][1] = c[i][2] = 0;
+                       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;
                }
        }