summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Kasprzyk <onestone@opencompositing.org>2007-11-22 04:50:32 +0100
committerDennis Kasprzyk <onestone@opencompositing.org>2007-11-22 04:50:32 +0100
commit60b5a553ecfd69b71607560a882ba666fc430a21 (patch)
treeb11821aff2aa58fa1bce5b552c0772a1630fa324
parent354a427a74cdce68df91b0ec5c0eefa9e6b60e6e (diff)
downloadatlantis-60b5a553ecfd69b71607560a882ba666fc430a21.tar.gz
atlantis-60b5a553ecfd69b71607560a882ba666fc430a21.tar.bz2
Save some calculations.
-rw-r--r--water.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/water.c b/water.c
index d947d46..269c0a2 100644
--- a/water.c
+++ b/water.c
@@ -307,18 +307,18 @@ setAmplitude (Vertex *v,
float wf,
float swf)
{
- float dx, dz, d;
+ float dx, dz, d, c1, c2;
Vertex a, b;
v->v[1] = bh + (wa * sinf (wt + wf * v->v[0] * v->v[2])) +
(swa * sinf (swt + swf * v->v[0] * v->v[2]));
v->v[1] = MIN (0.5, MAX (-0.5, v->v[1]));
- dx = (wa * cosf (wt + wf * v->v[0] * v->v[2]) * wf * v->v[2]) +
- (swa * cosf (swt + swf * v->v[0] * v->v[2]) * swf * v->v[2]);
+ c1 = wa * cosf (wt + wf * v->v[0] * v->v[2]) * wf;
+ c2 = swa * cosf (swt + swf * v->v[0] * v->v[2]) * swf;
- dz = (wa * cosf (wt + wf * v->v[0] * v->v[2]) * wf * v->v[0]) +
- (swa * cosf (swt + swf * v->v[0] * v->v[2]) * swf * v->v[0]);
+ dx = (c1 * v->v[2]) + (c2 * v->v[2]);
+ dz = (c1 * v->v[0]) + (c2 * v->v[0]);
a.v[0] = 10;
a.v[2] = 0;