diff options
author | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2024-11-02 22:27:47 +0100 |
commit | cb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch) | |
tree | f647b20e1823f1846af88e832cf82a4a02e96e69 /src/Noise/RidgedNoise.h | |
parent | Improve clang-format config file, remove automatically enforced code style from contrib guide. (diff) | |
download | cuberite-clang-format-codebase.tar cuberite-clang-format-codebase.tar.gz cuberite-clang-format-codebase.tar.bz2 cuberite-clang-format-codebase.tar.lz cuberite-clang-format-codebase.tar.xz cuberite-clang-format-codebase.tar.zst cuberite-clang-format-codebase.zip |
Diffstat (limited to 'src/Noise/RidgedNoise.h')
-rw-r--r-- | src/Noise/RidgedNoise.h | 62 |
1 files changed, 26 insertions, 36 deletions
diff --git a/src/Noise/RidgedNoise.h b/src/Noise/RidgedNoise.h index f59a0512f..4402faa72 100644 --- a/src/Noise/RidgedNoise.h +++ b/src/Noise/RidgedNoise.h @@ -13,45 +13,40 @@ -template <typename N> -class cRidgedNoise +template <typename N> class cRidgedNoise { -public: + public: /** Creates a new instance with the seed set to 0. */ - cRidgedNoise(void): + cRidgedNoise(void) : m_Noise(0) { } /** Creates a new instance with the specified seed. */ - cRidgedNoise(int a_Seed): + cRidgedNoise(int a_Seed) : m_Noise(a_Seed) { } /** Sets the seed for the underlying noise. */ - void SetSeed(int a_Seed) - { - m_Noise.SetSeed(a_Seed); - } + void SetSeed(int a_Seed) { m_Noise.SetSeed(a_Seed); } /** Fills a 2D array with the values of the noise. */ void Generate2D( - NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y] - int a_SizeX, int a_SizeY, ///< Count of the array, in each direction - NOISE_DATATYPE a_StartX, NOISE_DATATYPE a_EndX, ///< Noise-space coords of the array in the X direction - NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY ///< Noise-space coords of the array in the Y direction + NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y] + int a_SizeX, + int a_SizeY, ///< Count of the array, in each direction + NOISE_DATATYPE a_StartX, + NOISE_DATATYPE a_EndX, ///< Noise-space coords of the array in the X direction + NOISE_DATATYPE a_StartY, + NOISE_DATATYPE a_EndY ///< Noise-space coords of the array in the Y direction ) const { int ArrayCount = a_SizeX * a_SizeY; - m_Noise.Generate2D( - a_Array, a_SizeX, a_SizeY, - a_StartX, a_EndX, - a_StartY, a_EndY - ); + m_Noise.Generate2D(a_Array, a_SizeX, a_SizeY, a_StartX, a_EndX, a_StartY, a_EndY); for (int i = 0; i < ArrayCount; i++) { a_Array[i] = std::abs(a_Array[i]); @@ -61,31 +56,26 @@ public: /** Fills a 3D array with the values of the noise. */ void Generate3D( - NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z] - int a_SizeX, int a_SizeY, int a_SizeZ, ///< Count of the array, in each direction - NOISE_DATATYPE a_StartX, NOISE_DATATYPE a_EndX, ///< Noise-space coords of the array in the X direction - NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY, ///< Noise-space coords of the array in the Y direction - NOISE_DATATYPE a_StartZ, NOISE_DATATYPE a_EndZ ///< Noise-space coords of the array in the Z direction + NOISE_DATATYPE * a_Array, ///< Array to generate into [x + a_SizeX * y + a_SizeX * a_SizeY * z] + int a_SizeX, + int a_SizeY, + int a_SizeZ, ///< Count of the array, in each direction + NOISE_DATATYPE a_StartX, + NOISE_DATATYPE a_EndX, ///< Noise-space coords of the array in the X direction + NOISE_DATATYPE a_StartY, + NOISE_DATATYPE a_EndY, ///< Noise-space coords of the array in the Y direction + NOISE_DATATYPE a_StartZ, + NOISE_DATATYPE a_EndZ ///< Noise-space coords of the array in the Z direction ) const { int ArrayCount = a_SizeX * a_SizeY * a_SizeZ; - m_Noise.Generate2D( - a_Array, a_SizeX, a_SizeY, a_SizeZ, - a_StartX, a_EndX, - a_StartY, a_EndY, - a_StartZ, a_EndZ - ); + m_Noise.Generate2D(a_Array, a_SizeX, a_SizeY, a_SizeZ, a_StartX, a_EndX, a_StartY, a_EndY, a_StartZ, a_EndZ); for (int i = 0; i < ArrayCount; i++) { a_Array[i] = std::abs(a_Array[i]); } } -protected: + protected: N m_Noise; -} ; - - - - - +}; |