src/noise.cc
branchpyrit
changeset 22 76b7bd51d64a
parent 0 3547b885df7e
child 34 28f6e8b9d5d1
--- a/src/noise.cc	Fri Nov 30 00:44:51 2007 +0100
+++ b/src/noise.cc	Mon Dec 03 01:49:23 2007 +0100
@@ -8,20 +8,20 @@
 
 #include "noise.h"
 
-double fade(double t)
+Float fade(Float t)
 {
       return t * t * t * (t * (t * 6 - 15) + 10);
 }
 
-double lerp(double t, double a, double b)
+Float lerp(Float t, Float a, Float b)
 {
       return a + t * (b - a);
 }
 
-double grad(unsigned char hash, double x, double y, double z)
+Float grad(unsigned char hash, Float x, Float y, Float z)
 {
       unsigned char h = hash & 15;            // CONVERT LO 4 BITS OF HASH CODE
-      double u = h<8 ? x : y,                 // INTO 12 GRADIENT DIRECTIONS.
+      Float u = h<8 ? x : y,                 // INTO 12 GRADIENT DIRECTIONS.
              v = h<4 ? y : h==12||h==14 ? x : z;
       return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v : -v);
 }
@@ -56,7 +56,7 @@
    };
 
 
-double perlin(double x, double y, double z)
+Float perlin(Float x, Float y, Float z)
 {
       int X = (int)floor(x) & 255,                  // FIND UNIT CUBE THAT
           Y = (int)floor(y) & 255,                  // CONTAINS POINT.
@@ -64,7 +64,7 @@
       x -= floor(x);                                // FIND RELATIVE X,Y,Z
       y -= floor(y);                                // OF POINT IN CUBE.
       z -= floor(z);
-      double u = fade(x),                                // COMPUTE FADE CURVES
+      Float u = fade(x),                                // COMPUTE FADE CURVES
              v = fade(y),                                // FOR EACH OF X,Y,Z.
              w = fade(z);
       int A = p[X  ]+Y, AA = p[A]+Z, AB = p[A+1]+Z,      // HASH COORDINATES OF