8 #include "../IniFile.h"
9 #include "../LinearUpscale.h"
38 m_MainIslandSize(200),
39 m_IslandThickness(32),
41 m_MainIslandFrequencyX(100),
42 m_MainIslandFrequencyY(80),
43 m_MainIslandFrequencyZ(100),
44 m_MainIslandMinThreshold(0.2f),
45 m_SmallIslandFrequencyX(50),
46 m_SmallIslandFrequencyY(80),
47 m_SmallIslandFrequencyZ(50),
48 m_SmallIslandMinThreshold(-0.5f),
49 m_LastChunkCoords(0x7fffffff, 0x7fffffff)
116 m_Perlin.
Generate3D(NoiseData,
DIM_X,
DIM_Z,
DIM_Y, StartX, EndX, StartZ, EndZ, StartY, EndY, Workspace);
119 for (
int y = 0; y <
DIM_Y; y++)
123 for (
int z = 0; z <
DIM_Z; z++)
125 for (
int x = 0; x <
DIM_X; x++)
158 double threshold = std::min(pow - mult, minThreshold);
void LinearUpscale3DArray(TYPE *a_Src, int a_SrcSizeX, int a_SrcSizeY, int a_SrcSizeZ, TYPE *a_Dst, int a_UpscaleX, int a_UpscaleY, int a_UpscaleZ)
Linearly interpolates values in the array between the equidistant anchor points (upscales).
float NOISE_DATATYPE
The datatype used by all the noise generators.
Wraps the chunk coords into a single structure.
static Vector3i RelativeToAbsolute(Vector3i a_RelBlockPosition, cChunkCoords a_ChunkCoords)
Converts relative block coordinates into absolute coordinates with a known chunk location.
void SetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType)
Byte Shape[256 *16 *16]
The datatype used to represent the entire chunk worth of shape.
static void SetShapeIsSolidAt(Shape &a_Shape, int a_X, int a_Y, int a_Z, bool a_IsSolid)
static bool GetShapeIsSolidAt(const Shape &a_Shape, int a_X, int a_Y, int a_Z)
void FillBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
virtual void InitializeShapeGen(cIniFile &a_IniFile) override
Reads parameters from the ini file, prepares generator for use.
NOISE_DATATYPE m_SmallIslandFrequencyX
virtual void ComposeTerrain(cChunkDesc &a_ChunkDesc, const cChunkDesc::Shape &a_Shape) override
Generates the chunk's composition into a_ChunkDesc, using the terrain shape provided in a_Shape.
NOISE_DATATYPE m_MainIslandFrequencyX
virtual void GenShape(cChunkCoords a_ChunkCoords, cChunkDesc::Shape &a_Shape) override
Generates the shape for the given chunk.
NOISE_DATATYPE m_NoiseArray[17 *17 *257]
void GenerateNoiseArray(void)
Generates the m_NoiseArray array for the current chunk.
NOISE_DATATYPE m_SmallIslandMinThreshold
cPerlinNoise m_Perlin
The Perlin noise used for generating.
cChunkCoords m_LastChunkCoords
NOISE_DATATYPE m_SmallIslandFrequencyY
NOISE_DATATYPE m_MainIslandFrequencyY
NOISE_DATATYPE m_MainIslandFrequencyZ
void PrepareState(cChunkCoords a_ChunkCoords)
Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array)
NOISE_DATATYPE m_MainIslandMinThreshold
NOISE_DATATYPE m_SmallIslandFrequencyZ
int GetValueSetI(const AString &keyname, const AString &valuename, const int defValue=0) override
double GetValueSetF(const AString &keyname, const AString &valuename, const double defValue=0.0)
void Generate3D(NOISE_DATATYPE *a_Array, int a_SizeX, int a_SizeY, int a_SizeZ, NOISE_DATATYPE a_StartX, NOISE_DATATYPE a_EndX, NOISE_DATATYPE a_StartY, NOISE_DATATYPE a_EndY, NOISE_DATATYPE a_StartZ, NOISE_DATATYPE a_EndZ, NOISE_DATATYPE *a_Workspace=nullptr) const
Fills a 3D array with the values of the noise.
void AddOctave(NOISE_DATATYPE a_Frequency, NOISE_DATATYPE a_Amplitude)
Adds a new octave to the list of octaves that compose this noise.