summaryrefslogtreecommitdiffstats
path: root/source/cNoise.h
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-03 20:41:19 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-03 20:41:19 +0200
commit386d58b5862d8b76925c6523721594887606e82a (patch)
treeef073e7a843f4b75a4008d4b7383f7cdf08ceee5 /source/cNoise.h
parentVisual Studio 2010 solution and project files (diff)
downloadcuberite-386d58b5862d8b76925c6523721594887606e82a.tar
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.gz
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.bz2
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.lz
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.xz
cuberite-386d58b5862d8b76925c6523721594887606e82a.tar.zst
cuberite-386d58b5862d8b76925c6523721594887606e82a.zip
Diffstat (limited to 'source/cNoise.h')
-rw-r--r--source/cNoise.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/source/cNoise.h b/source/cNoise.h
new file mode 100644
index 000000000..538970da3
--- /dev/null
+++ b/source/cNoise.h
@@ -0,0 +1,33 @@
+#pragma once
+
+class cNoise
+{
+public:
+ cNoise( unsigned int a_Seed );
+ ~cNoise();
+
+ float IntNoise( int a_X ) const;
+ float IntNoise2D( int a_X, int a_Y ) const;
+ float IntNoise3D( int a_X, int a_Y, int a_Z ) const;
+
+ float LinearNoise1D( float a_X ) const;
+ float CosineNoise1D( float a_X ) const;
+ float CubicNoise1D( float a_X ) const;
+ float SmoothNoise1D( int a_X ) const;
+
+ float LinearNoise2D( float a_X, float a_Y ) const;
+ float CosineNoise2D( float a_X, float a_Y ) const;
+ float CubicNoise2D( float a_X, float a_Y ) const;
+
+ float CosineNoise3D( float a_X, float a_Y, float a_Z ) const;
+ float CubicNoise3D( float a_X, float a_Y, float a_Z ) const;
+
+ void SetSeed( unsigned int a_Seed ) { m_Seed = a_Seed; }
+private:
+ float CubicInterpolate( float a_A, float a_B, float a_C, float a_D, float a_Pct ) const;
+ float CosineInterpolate( float a_A, float a_B, float a_Pct ) const;
+ float LinearInterpolate( float a_A, float a_B, float a_Pct ) const;
+
+ unsigned int m_Seed;
+};
+