2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
// EndGen.h
|
|
|
|
|
|
|
|
// Declares the cEndGen class representing the generator for the End, both as a HeightGen and CompositionGen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ComposableGenerator.h"
|
2014-11-18 06:07:08 -05:00
|
|
|
#include "../Noise/Noise.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cEndGen :
|
2014-11-12 15:24:26 -05:00
|
|
|
public cTerrainShapeGen,
|
2013-07-29 07:13:03 -04:00
|
|
|
public cTerrainCompositionGen
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
cEndGen(int a_Seed);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Seed for the noise */
|
2013-07-29 07:13:03 -04:00
|
|
|
int m_Seed;
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** The Perlin noise used for generating */
|
2013-07-29 07:13:03 -04:00
|
|
|
cPerlinNoise m_Perlin;
|
|
|
|
|
|
|
|
// XYZ size of the "island", in blocks:
|
|
|
|
int m_IslandSizeX;
|
|
|
|
int m_IslandSizeY;
|
|
|
|
int m_IslandSizeZ;
|
|
|
|
|
|
|
|
// XYZ Frequencies of the noise functions:
|
|
|
|
NOISE_DATATYPE m_FrequencyX;
|
|
|
|
NOISE_DATATYPE m_FrequencyY;
|
|
|
|
NOISE_DATATYPE m_FrequencyZ;
|
|
|
|
|
|
|
|
// Minimum and maximum chunk coords for chunks inside the island area. Chunks outside won't get calculated at all
|
|
|
|
int m_MinChunkX, m_MaxChunkX;
|
|
|
|
int m_MinChunkZ, m_MaxChunkZ;
|
|
|
|
|
|
|
|
// Noise array for the last chunk (in the noise range)
|
|
|
|
int m_LastChunkX;
|
|
|
|
int m_LastChunkZ;
|
|
|
|
NOISE_DATATYPE m_NoiseArray[17 * 17 * 257]; // x + 17 * z + 17 * 17 * y
|
2015-07-31 10:49:10 -04:00
|
|
|
|
|
|
|
|
|
|
|
/** Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array) */
|
2013-07-29 07:13:03 -04:00
|
|
|
void PrepareState(int a_ChunkX, int a_ChunkZ);
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Generates the m_NoiseArray array for the current chunk */
|
2013-07-29 07:13:03 -04:00
|
|
|
void GenerateNoiseArray(void);
|
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
/** Returns true if the chunk is outside of the island's dimensions */
|
2013-07-29 07:13:03 -04:00
|
|
|
bool IsChunkOutsideRange(int a_ChunkX, int a_ChunkZ);
|
2015-07-31 10:49:10 -04:00
|
|
|
|
|
|
|
|
2014-11-12 15:24:26 -05:00
|
|
|
// cTerrainShapeGen overrides:
|
|
|
|
virtual void GenShape(int a_ChunkX, int a_ChunkZ, cChunkDesc::Shape & a_Shape) override;
|
2013-07-29 07:13:03 -04:00
|
|
|
|
2015-07-31 10:49:10 -04:00
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
// cTerrainCompositionGen overrides:
|
2014-11-12 15:24:26 -05:00
|
|
|
virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::Shape & a_Shape) override;
|
2014-05-31 17:28:51 -04:00
|
|
|
virtual void InitializeCompoGen(cIniFile & a_IniFile) override;
|
2013-07-29 07:13:03 -04:00
|
|
|
} ;
|