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:
44 
45  // XYZ Frequencies of the noise functions on the smaller islands:
50 
51 
52  // Noise array for the last chunk (in the noise range)
54  NOISE_DATATYPE m_NoiseArray[17 * 17 * 257]; // x + 17 * z + 17 * 17 * y
55 
56 
58  void PrepareState(cChunkCoords a_ChunkCoords);
59 
61  void GenerateNoiseArray(void);
62 
63  // cTerrainShapeGen overrides:
64  virtual void GenShape(cChunkCoords a_ChunkCoords, cChunkDesc::Shape & a_Shape) override;
65  virtual void InitializeShapeGen(cIniFile & a_IniFile) override;
66 
67 
68  // cTerrainCompositionGen overrides:
69  virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::Shape & a_Shape) override;
70 } ;
float NOISE_DATATYPE
The datatype used by all the noise generators.
Definition: Noise.h:9
Wraps the chunk coords into a single structure.
Definition: ChunkDef.h:57
Byte Shape[256 *16 *16]
The datatype used to represent the entire chunk worth of shape.
Definition: ChunkDesc.h:36
The interface that a terrain shape generator must implement A terrain shape generator takes chunk coo...
The interface that a terrain composition generator must implement Terrain composition takes chunk coo...
Definition: EndGen.h:22
virtual void InitializeShapeGen(cIniFile &a_IniFile) override
Reads parameters from the ini file, prepares generator for use.
Definition: EndGen.cpp:60
NOISE_DATATYPE m_SmallIslandFrequencyX
Definition: EndGen.h:46
int m_IslandYOffset
Definition: EndGen.h:37
int m_IslandThickness
Definition: EndGen.h:36
cEndGen(int a_Seed)
Definition: EndGen.cpp:35
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:180
int m_MainIslandSize
Definition: EndGen.h:35
NOISE_DATATYPE m_MainIslandFrequencyX
Definition: EndGen.h:40
virtual void GenShape(cChunkCoords a_ChunkCoords, cChunkDesc::Shape &a_Shape) override
Generates the shape for the given chunk.
Definition: EndGen.cpp:140
NOISE_DATATYPE m_NoiseArray[17 *17 *257]
Definition: EndGen.h:54
void GenerateNoiseArray(void)
Generates the m_NoiseArray array for the current chunk.
Definition: EndGen.cpp:98
NOISE_DATATYPE m_SmallIslandMinThreshold
Definition: EndGen.h:49
cPerlinNoise m_Perlin
The Perlin noise used for generating.
Definition: EndGen.h:32
cChunkCoords m_LastChunkCoords
Definition: EndGen.h:53
NOISE_DATATYPE m_SmallIslandFrequencyY
Definition: EndGen.h:47
NOISE_DATATYPE m_MainIslandFrequencyY
Definition: EndGen.h:41
NOISE_DATATYPE m_MainIslandFrequencyZ
Definition: EndGen.h:42
void PrepareState(cChunkCoords a_ChunkCoords)
Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array)
Definition: EndGen.cpp:82
int m_Seed
Seed for the noise.
Definition: EndGen.h:29
NOISE_DATATYPE m_MainIslandMinThreshold
Definition: EndGen.h:43
NOISE_DATATYPE m_SmallIslandFrequencyZ
Definition: EndGen.h:48