2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
// StructGen.h
|
|
|
|
|
|
|
|
/* Interfaces to the various structure generators:
|
|
|
|
- cStructGenTrees
|
|
|
|
- cStructGenMarbleCaves
|
|
|
|
- cStructGenOres
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2013-01-25 05:12:29 -05:00
|
|
|
#include "ComposableGenerator.h"
|
2012-09-23 18:09:57 -04:00
|
|
|
#include "../Noise.h"
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cStructGenTrees :
|
2014-03-01 14:56:09 -05:00
|
|
|
public cFinishGen
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
cStructGenTrees(int a_Seed, cBiomeGen * a_BiomeGen, cTerrainHeightGen * a_HeightGen, cTerrainCompositionGen * a_CompositionGen) :
|
|
|
|
m_Seed(a_Seed),
|
|
|
|
m_Noise(a_Seed),
|
|
|
|
m_BiomeGen(a_BiomeGen),
|
|
|
|
m_HeightGen(a_HeightGen),
|
|
|
|
m_CompositionGen(a_CompositionGen)
|
|
|
|
{}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
int m_Seed;
|
|
|
|
cNoise m_Noise;
|
|
|
|
cBiomeGen * m_BiomeGen;
|
|
|
|
cTerrainHeightGen * m_HeightGen;
|
|
|
|
cTerrainCompositionGen * m_CompositionGen;
|
|
|
|
|
2012-07-15 09:33:43 -04:00
|
|
|
/** Generates and applies an image of a single tree.
|
|
|
|
Parts of the tree inside the chunk are applied to a_BlockX.
|
|
|
|
Parts of the tree outside the chunk are stored in a_OutsideX
|
|
|
|
*/
|
2012-06-14 09:06:06 -04:00
|
|
|
void GenerateSingleTree(
|
|
|
|
int a_ChunkX, int a_ChunkZ, int a_Seq,
|
2013-03-19 04:32:02 -04:00
|
|
|
cChunkDesc & a_ChunkDesc,
|
2012-07-15 09:33:43 -04:00
|
|
|
sSetBlockVector & a_OutsideLogs,
|
|
|
|
sSetBlockVector & a_OutsideOther
|
2012-06-14 09:06:06 -04:00
|
|
|
) ;
|
|
|
|
|
2012-07-15 09:33:43 -04:00
|
|
|
/// Applies an image into chunk blockdata; all blocks outside the chunk will be appended to a_Overflow
|
2012-07-17 07:11:01 -04:00
|
|
|
void ApplyTreeImage(
|
2012-07-15 09:33:43 -04:00
|
|
|
int a_ChunkX, int a_ChunkZ,
|
2013-03-19 04:32:02 -04:00
|
|
|
cChunkDesc & a_ChunkDesc,
|
2012-07-15 09:33:43 -04:00
|
|
|
const sSetBlockVector & a_Image,
|
|
|
|
sSetBlockVector & a_Overflow
|
|
|
|
);
|
|
|
|
|
2012-06-14 09:06:06 -04:00
|
|
|
int GetNumTrees(
|
|
|
|
int a_ChunkX, int a_ChunkZ,
|
|
|
|
const cChunkDef::BiomeMap & a_Biomes
|
|
|
|
);
|
|
|
|
|
2014-03-01 14:56:09 -05:00
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
2012-06-14 09:06:06 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cStructGenOreNests :
|
2014-03-01 14:56:09 -05:00
|
|
|
public cFinishGen
|
2012-06-14 09:06:06 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
cStructGenOreNests(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
cNoise m_Noise;
|
|
|
|
int m_Seed;
|
|
|
|
|
2014-03-01 14:56:09 -05:00
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
2012-06-14 09:06:06 -04:00
|
|
|
|
|
|
|
void GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_OreType, int a_MaxHeight, int a_NumNests, int a_NestSize, cChunkDef::BlockTypes & a_BlockTypes, int a_Seq);
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-17 07:11:01 -04:00
|
|
|
|
2013-03-17 13:55:03 -04:00
|
|
|
class cStructGenLakes :
|
2014-03-01 14:56:09 -05:00
|
|
|
public cFinishGen
|
2013-03-17 13:55:03 -04:00
|
|
|
{
|
|
|
|
public:
|
2013-03-19 06:14:57 -04:00
|
|
|
cStructGenLakes(int a_Seed, BLOCKTYPE a_Fluid, cTerrainHeightGen & a_HeiGen, int a_Probability) :
|
2013-03-19 04:32:02 -04:00
|
|
|
m_Noise(a_Seed),
|
|
|
|
m_Seed(a_Seed),
|
|
|
|
m_Fluid(a_Fluid),
|
2013-03-19 06:14:57 -04:00
|
|
|
m_HeiGen(a_HeiGen),
|
|
|
|
m_Probability(a_Probability)
|
2013-03-19 04:32:02 -04:00
|
|
|
{
|
|
|
|
}
|
2013-03-17 13:55:03 -04:00
|
|
|
|
|
|
|
protected:
|
2013-03-19 04:32:02 -04:00
|
|
|
cNoise m_Noise;
|
|
|
|
int m_Seed;
|
|
|
|
BLOCKTYPE m_Fluid;
|
|
|
|
cTerrainHeightGen & m_HeiGen;
|
2013-03-19 06:14:57 -04:00
|
|
|
int m_Probability; ///< Chance, 0 .. 100, of a chunk having the lake
|
2013-03-17 13:55:03 -04:00
|
|
|
|
2014-03-01 14:56:09 -05:00
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
2013-03-19 04:32:02 -04:00
|
|
|
|
|
|
|
/// Creates a lake image for the specified chunk into a_Lake
|
|
|
|
void CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a_Lake);
|
2013-03-17 13:55:03 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-24 16:30:30 -04:00
|
|
|
|
|
|
|
class cStructGenDirectOverhangs :
|
2014-03-01 14:56:09 -05:00
|
|
|
public cFinishGen
|
2013-04-24 16:30:30 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
cStructGenDirectOverhangs(int a_Seed);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
cNoise m_Noise1;
|
|
|
|
cNoise m_Noise2;
|
|
|
|
|
2014-03-01 14:56:09 -05:00
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
2013-04-24 16:30:30 -04:00
|
|
|
|
|
|
|
bool HasWantedBiome(cChunkDesc & a_ChunkDesc) const;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-25 15:29:56 -04:00
|
|
|
|
|
|
|
class cStructGenDistortedMembraneOverhangs :
|
2014-03-01 14:56:09 -05:00
|
|
|
public cFinishGen
|
2013-04-25 15:29:56 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
cStructGenDistortedMembraneOverhangs(int a_Seed);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
cNoise m_NoiseX;
|
|
|
|
cNoise m_NoiseY;
|
|
|
|
cNoise m_NoiseZ;
|
|
|
|
cNoise m_NoiseH;
|
|
|
|
|
2014-03-01 14:56:09 -05:00
|
|
|
// cFinishGen override:
|
|
|
|
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
2013-04-25 15:29:56 -04:00
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|