]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Very minor speedup to fractal noise generator.
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 31 Aug 2000 15:08:25 +0000 (15:08 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 31 Aug 2000 15:08:25 +0000 (15:08 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@18 d7cf8633-e32d-0410-b094-e92efae38249

fractalnoise.c

index b663027943a24de5409e1c35cec484c00af22230..68f375ed2b4e414ca13b4993bca3ac345fe1f551 100644 (file)
@@ -3,7 +3,7 @@
 
 void fractalnoise(unsigned char *noise, int size)
 {
 
 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));
        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;
                        }
                // brownian motion theory
                amplitude >>= 1;
-               amplitude2 = amplitude >> 1;
                for (y = 0;y < size;y += g)
                        for (x = 0;x < size;x += g)
                for (y = 0;y < size;y += g)
                        for (x = 0;x < size;x += g)
-                               n(x,y) += (rand()&amplitude) - amplitude2;
+                               n(x,y) += (rand()&amplitude);
        }
        // find range of noise values
        min = max = 0;
        }
        // find range of noise values
        min = max = 0;