8 #include "../IniFile.h" 9 #include "../LinearUpscale.h" 47 m_LastChunkCoords(0x7fffffff, 0x7fffffff)
109 m_Perlin.
Generate3D(NoiseData,
DIM_X,
DIM_Z,
DIM_Y, StartX, EndX, StartZ, EndZ, StartY, EndY, Workspace);
113 for (
int y = 0; y <
DIM_Y; y++)
117 for (
int z = 0; z <
DIM_Z; z++)
121 for (
int x = 0; x <
DIM_X; x++)
126 NoiseData[idx++] += ValX + ValZ + ValY;
156 for (
size_t i = 0; i <
ARRAYCOUNT(a_Shape); i++)
170 for (
int y = 0; y < MaxY; y++)
172 a_Shape[(x + 16 * z) * 256 + y] = (
m_NoiseArray[y * 17 * 17 + z * 17 + z] > 0) ? 1 : 0;
176 a_Shape[(x + 16 * z) * 256 + y] = 0;
195 if (a_Shape[(x + 16 * z) * 256 + y] != 0)
NOISE_DATATYPE m_NoiseArray[17 *17 *257]
bool IsChunkOutsideRange(cChunkCoords a_ChunkCoords)
Returns true if the chunk is outside of the island's dimensions.
Byte Shape[256 *16 *16]
The datatype used to represent the entire chunk worth of shape.
void SetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType)
double GetValueSetF(const AString &keyname, const AString &valuename, const double defValue=0.0)
void PrepareState(cChunkCoords a_ChunkCoords)
Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array) ...
virtual void InitializeCompoGen(cIniFile &a_IniFile) override
Reads parameters from the ini file, prepares generator for use.
cChunkCoords m_LastChunkCoords
void GenerateNoiseArray(void)
Generates the m_NoiseArray array for the current chunk.
float NOISE_DATATYPE
The datatype used by all the noise generators.
virtual void GenShape(cChunkCoords a_ChunkCoords, cChunkDesc::Shape &a_Shape) override
Generates the shape for the given chunk.
cPerlinNoise m_Perlin
The Perlin noise used for generating.
NOISE_DATATYPE m_FrequencyY
void AddOctave(NOISE_DATATYPE a_Frequency, NOISE_DATATYPE a_Amplitude)
Adds a new octave to the list of octaves that compose this noise.
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...
int GetValueSetI(const AString &keyname, const AString &valuename, const int defValue=0) override
NOISE_DATATYPE m_FrequencyX
NOISE_DATATYPE m_FrequencyZ
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 FillBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
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).
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)