diff options
author | NiLSPACE <NiLSPACE@users.noreply.github.com> | 2019-12-22 23:38:11 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2019-12-22 23:38:11 +0100 |
commit | dc787e1d968058a810ad379013f84c82ea78b2fa (patch) | |
tree | 4b97b7f602f298df05cd634ac663292cc6c8b90b /src/Noise | |
parent | AppVeyor release builds (diff) | |
download | cuberite-dc787e1d968058a810ad379013f84c82ea78b2fa.tar cuberite-dc787e1d968058a810ad379013f84c82ea78b2fa.tar.gz cuberite-dc787e1d968058a810ad379013f84c82ea78b2fa.tar.bz2 cuberite-dc787e1d968058a810ad379013f84c82ea78b2fa.tar.lz cuberite-dc787e1d968058a810ad379013f84c82ea78b2fa.tar.xz cuberite-dc787e1d968058a810ad379013f84c82ea78b2fa.tar.zst cuberite-dc787e1d968058a810ad379013f84c82ea78b2fa.zip |
Diffstat (limited to 'src/Noise')
-rw-r--r-- | src/Noise/Noise.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Noise/Noise.h b/src/Noise/Noise.h index 6b7811c41..87e67b630 100644 --- a/src/Noise/Noise.h +++ b/src/Noise/Noise.h @@ -8,6 +8,7 @@ /** The datatype used by all the noise generators. */ typedef float NOISE_DATATYPE; +#include "../Vector3.h" #include "OctavedNoise.h" #include "RidgedNoise.h" @@ -25,6 +26,7 @@ public: inline NOISE_DATATYPE IntNoise1D(int a_X) const; inline NOISE_DATATYPE IntNoise2D(int a_X, int a_Y) const; inline NOISE_DATATYPE IntNoise3D(int a_X, int a_Y, int a_Z) const; + inline NOISE_DATATYPE IntNoise3D(Vector3i a_Pos) const; // Return a float number in the specified range: inline NOISE_DATATYPE IntNoise2DInRange(int a_X, int a_Y, float a_Min, float a_Max) const @@ -36,6 +38,7 @@ public: inline int IntNoise1DInt(int a_X) const; inline int IntNoise2DInt(int a_X, int a_Y) const; inline int IntNoise3DInt(int a_X, int a_Y, int a_Z) const; + inline int IntNoise3DInt(Vector3i a_Pos) const; NOISE_DATATYPE LinearNoise1D(NOISE_DATATYPE a_X) const; NOISE_DATATYPE CosineNoise1D(NOISE_DATATYPE a_X) const; @@ -218,6 +221,15 @@ NOISE_DATATYPE cNoise::IntNoise3D(int a_X, int a_Y, int a_Z) const +NOISE_DATATYPE cNoise::IntNoise3D(Vector3i a_Pos) const +{ + return IntNoise3D(a_Pos.x, a_Pos.y, a_Pos.z); +} + + + + + int cNoise::IntNoise1DInt(int a_X) const { int x = ((a_X * m_Seed) << 13) ^ a_X; @@ -250,6 +262,15 @@ int cNoise::IntNoise3DInt(int a_X, int a_Y, int a_Z) const +int cNoise::IntNoise3DInt(Vector3i a_Pos) const +{ + return IntNoise3DInt(a_Pos.x, a_Pos.y, a_Pos.z); +} + + + + + NOISE_DATATYPE cNoise::CubicInterpolate(NOISE_DATATYPE a_A, NOISE_DATATYPE a_B, NOISE_DATATYPE a_C, NOISE_DATATYPE a_D, NOISE_DATATYPE a_Pct) { NOISE_DATATYPE P = (a_D - a_C) - (a_A - a_B); |