Cuberite
A lightweight, fast and extensible game server for Minecraft
EndGen.h
Go to the documentation of this file.
1 
2 // EndGen.h
3 
4 // Declares the cEndGen class representing the generator for the End, both as a HeightGen and CompositionGen
5 
6 
7 
8 
9 
10 #pragma once
11 
12 #include "ComposableGenerator.h"
13 #include "../Noise/Noise.h"
14 
15 
16 
17 
18 
19 class cEndGen :
20  public cTerrainShapeGen,
22 {
23 public:
24  cEndGen(int a_Seed);
25 
26 protected:
27 
29  int m_Seed;
30 
33 
34  // XYZ size of the "island", in blocks:
38 
39  // XYZ Frequencies of the noise functions:
43 
44  // Minimum and maximum chunk coords for chunks inside the island area. Chunks outside won't get calculated at all
47 
48  // Noise array for the last chunk (in the noise range)
50  NOISE_DATATYPE m_NoiseArray[17 * 17 * 257]; // x + 17 * z + 17 * 17 * y
51 
52 
54  void PrepareState(cChunkCoords a_ChunkCoords);
55 
57  void GenerateNoiseArray(void);
58 
60  bool IsChunkOutsideRange(cChunkCoords a_ChunkCoords);
61 
62 
63  // cTerrainShapeGen overrides:
64  virtual void GenShape(cChunkCoords a_ChunkCoords, cChunkDesc::Shape & a_Shape) override;
65 
66 
67  // cTerrainCompositionGen overrides:
68  virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::Shape & a_Shape) override;
69  virtual void InitializeCompoGen(cIniFile & a_IniFile) override;
70 } ;
NOISE_DATATYPE m_NoiseArray[17 *17 *257]
Definition: EndGen.h:50
bool IsChunkOutsideRange(cChunkCoords a_ChunkCoords)
Returns true if the chunk is outside of the island's dimensions.
Definition: EndGen.cpp:139
Byte Shape[256 *16 *16]
The datatype used to represent the entire chunk worth of shape.
Definition: ChunkDesc.h:36
Definition: EndGen.h:19
void PrepareState(cChunkCoords a_ChunkCoords)
Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array) ...
Definition: EndGen.cpp:79
virtual void InitializeCompoGen(cIniFile &a_IniFile) override
Reads parameters from the ini file, prepares generator for use.
Definition: EndGen.cpp:58
cChunkCoords m_LastChunkCoords
Definition: EndGen.h:49
void GenerateNoiseArray(void)
Generates the m_NoiseArray array for the current chunk.
Definition: EndGen.cpp:97
cEndGen(int a_Seed)
Definition: EndGen.cpp:35
int m_IslandSizeX
Definition: EndGen.h:35
The interface that a terrain composition generator must implement Terrain composition takes chunk coo...
float NOISE_DATATYPE
The datatype used by all the noise generators.
Definition: Noise.h:9
int m_IslandSizeY
Definition: EndGen.h:36
The interface that a terrain shape generator must implement A terrain shape generator takes chunk coo...
virtual void GenShape(cChunkCoords a_ChunkCoords, cChunkDesc::Shape &a_Shape) override
Generates the shape for the given chunk.
Definition: EndGen.cpp:151
cPerlinNoise m_Perlin
The Perlin noise used for generating.
Definition: EndGen.h:32
int m_MinChunkZ
Definition: EndGen.h:46
NOISE_DATATYPE m_FrequencyY
Definition: EndGen.h:41
int m_MaxChunkX
Definition: EndGen.h:45
int m_MaxChunkZ
Definition: EndGen.h:46
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...
Definition: EndGen.cpp:186
NOISE_DATATYPE m_FrequencyX
Definition: EndGen.h:40
int m_MinChunkX
Definition: EndGen.h:45
NOISE_DATATYPE m_FrequencyZ
Definition: EndGen.h:42
int m_IslandSizeZ
Definition: EndGen.h:37
int m_Seed
Seed for the noise.
Definition: EndGen.h:29