From 917ecb3d73929af8f1a2a4cc106de3063ab9075b Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Thu, 31 Aug 2000 15:08:25 +0000 Subject: [PATCH] Very minor speedup to fractal noise generator. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@18 d7cf8633-e32d-0410-b094-e92efae38249 --- fractalnoise.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fractalnoise.c b/fractalnoise.c index b6630279..68f375ed 100644 --- a/fractalnoise.c +++ b/fractalnoise.c @@ -3,7 +3,7 @@ void fractalnoise(unsigned char *noise, int size) { - int x, y, g, g2, amplitude, amplitude2, min, max, size1 = size - 1; + int x, y, g, g2, amplitude, min, max, size1 = size - 1; int *noisebuf; #define n(x,y) noisebuf[((y)&size1)*size+((x)&size1)] noisebuf = calloc(size*size, sizeof(int)); @@ -27,10 +27,9 @@ void fractalnoise(unsigned char *noise, int size) } // brownian motion theory amplitude >>= 1; - amplitude2 = amplitude >> 1; for (y = 0;y < size;y += g) for (x = 0;x < size;x += g) - n(x,y) += (rand()&litude) - amplitude2; + n(x,y) += (rand()&litude); } // find range of noise values min = max = 0; -- 2.39.2