00001 #define B 0x100
00002 #define BM 0xff
00003 #define N 0x1000
00004 #define NP 12
00005 #define NM 0xfff
00006
00007 #define s_curve(t) ( t * t * (3. - 2. * t) )
00008 #define lerp(t, a, b) ( a + t * (b - a) )
00009 #define setup(i,b0,b1,r0,r1)\
00010 t = vec[i] + N;\
00011 b0 = ((int)t) & BM;\
00012 b1 = (b0+1) & BM;\
00013 r0 = t - (int)t;\
00014 r1 = r0 - 1.;
00015 #define at2(rx,ry) ( rx * q[0] + ry * q[1] )
00016 #define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
00017
00018 void init(void);
00019 double noise1(double);
00020 double noise2(double *);
00021 double noise3(double *);
00022 void normalize3(double *);
00023 void normalize2(double *);
00024
00025 double PerlinNoise1D(double,double,double,int);
00026 double PerlinNoise2D(double,double,double,double,int);
00027 double PerlinNoise3D(double,double,double,double,double,int);
00028