Cuberite
A lightweight, fast and extensible game server for Minecraft
StructGen.h
Go to the documentation of this file.
1 
2 // StructGen.h
3 
4 /* Interfaces to the various structure generators:
5  - cStructGenTrees
6  - cStructGenMarbleCaves
7  - cStructGenOres
8 */
9 
10 
11 
12 
13 
14 #pragma once
15 
16 #include "ComposableGenerator.h"
17 #include "../Noise/Noise.h"
18 
19 
20 
22  public cFinishGen
23 {
24 public:
25  cStructGenTrees(int a_Seed, cBiomeGen & a_BiomeGen, cTerrainShapeGen & a_ShapeGen, cTerrainCompositionGen & a_CompositionGen) :
26  m_Seed(a_Seed),
27  m_Noise(a_Seed),
28  m_BiomeGen(a_BiomeGen),
29  m_ShapeGen(a_ShapeGen),
30  m_CompositionGen(a_CompositionGen)
31  {}
32 
33 protected:
34 
35  int m_Seed;
40 
45  void GenerateSingleTree(
46  int a_ChunkX, int a_ChunkZ, int a_Seq,
47  Vector3i a_Pos,
48  cChunkDesc & a_ChunkDesc,
49  sSetBlockVector & a_OutsideLogs,
50  sSetBlockVector & a_OutsideOther
51  ) ;
52 
54  void ApplyTreeImage(
55  int a_ChunkX, int a_ChunkZ,
56  cChunkDesc & a_ChunkDesc,
57  const sSetBlockVector & a_Image,
58  sSetBlockVector & a_Overflow
59  );
60 
64  double GetNumTrees(
65  int a_ChunkX, int a_ChunkZ,
66  const cChunkDef::BiomeMap & a_Biomes
67  );
68 
69  // cFinishGen override:
70  virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
71 } ;
72 
73 
74 
75 
76 
78  public cFinishGen
79 {
80 public:
81  cStructGenLakes(int a_Seed, BLOCKTYPE a_Fluid, cTerrainShapeGen & a_ShapeGen, int a_Probability) :
82  m_Noise(a_Seed),
83  m_Seed(a_Seed),
84  m_Fluid(a_Fluid),
85  m_ShapeGen(a_ShapeGen),
86  m_Probability(a_Probability)
87  {
88  }
89 
90 protected:
92  int m_Seed;
95 
98 
99 
100  // cFinishGen override:
101  virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
102 
104  void CreateLakeImage(int a_ChunkX, int a_ChunkZ, int a_MaxLakeHeight, cBlockArea & a_Lake);
105 } ;
106 
107 
108 
109 
110 
112  public cFinishGen
113 {
114 public:
115  cStructGenDirectOverhangs(int a_Seed);
116 
117 protected:
120 
121  // cFinishGen override:
122  virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
123 
124  bool HasWantedBiome(cChunkDesc & a_ChunkDesc) const;
125 } ;
126 
127 
128 
129 
130 
132  public cFinishGen
133 {
134 public:
136 
137 protected:
142 
143  // cFinishGen override:
144  virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
145 } ;
std::vector< sSetBlock > sSetBlockVector
Definition: ChunkDef.h:441
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
EMCSBiome BiomeMap[Width *Width]
The type used for any biomemap operations and storage inside Cuberite, using Cuberite biomes (need no...
Definition: ChunkDef.h:137
The interface that a biome generator must implement A biome generator takes chunk coords on input and...
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...
The interface that a finisher must implement Finisher implements changes to the chunk after the rough...
cStructGenTrees(int a_Seed, cBiomeGen &a_BiomeGen, cTerrainShapeGen &a_ShapeGen, cTerrainCompositionGen &a_CompositionGen)
Definition: StructGen.h:25
double GetNumTrees(int a_ChunkX, int a_ChunkZ, const cChunkDef::BiomeMap &a_Biomes)
Get the the number of trees to generate in a_Chunk If the value is between 0 and 1,...
Definition: StructGen.cpp:215
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
Definition: StructGen.cpp:18
void ApplyTreeImage(int a_ChunkX, int a_ChunkZ, cChunkDesc &a_ChunkDesc, const sSetBlockVector &a_Image, sSetBlockVector &a_Overflow)
Applies an image into chunk blockdata; all blocks outside the chunk will be appended to a_Overflow.
Definition: StructGen.cpp:161
cTerrainCompositionGen & m_CompositionGen
Definition: StructGen.h:39
cTerrainShapeGen & m_ShapeGen
Definition: StructGen.h:38
cBiomeGen & m_BiomeGen
Definition: StructGen.h:37
void GenerateSingleTree(int a_ChunkX, int a_ChunkZ, int a_Seq, Vector3i a_Pos, cChunkDesc &a_ChunkDesc, sSetBlockVector &a_OutsideLogs, sSetBlockVector &a_OutsideOther)
Generates and applies an image of a single tree.
Definition: StructGen.cpp:96
cNoise m_Noise
Definition: StructGen.h:36
int m_Probability
Chance, [0 .
Definition: StructGen.h:97
cTerrainShapeGen & m_ShapeGen
Definition: StructGen.h:94
cStructGenLakes(int a_Seed, BLOCKTYPE a_Fluid, cTerrainShapeGen &a_ShapeGen, int a_Probability)
Definition: StructGen.h:81
cNoise m_Noise
Definition: StructGen.h:91
void CreateLakeImage(int a_ChunkX, int a_ChunkZ, int a_MaxLakeHeight, cBlockArea &a_Lake)
Creates a lake image for the specified chunk into a_Lake.
Definition: StructGen.cpp:341
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
Definition: StructGen.cpp:314
BLOCKTYPE m_Fluid
Definition: StructGen.h:93
bool HasWantedBiome(cChunkDesc &a_ChunkDesc) const
Definition: StructGen.cpp:511
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
Definition: StructGen.cpp:433
cStructGenDirectOverhangs(int a_Seed)
Definition: StructGen.cpp:423
virtual void GenFinish(cChunkDesc &a_ChunkDesc) override
Definition: StructGen.cpp:551
Definition: Noise.h:20