First attempt for a new foliage finisher
This commit is contained in:
parent
e2a1118f88
commit
7bf9da7441
@ -338,6 +338,10 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
||||
float Threshold = (float)a_IniFile.GetValueSetF("Generator", "DualRidgeCavesThreshold", 0.3);
|
||||
m_FinishGens.push_back(new cStructGenDualRidgeCaves(Seed, Threshold));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "Foliage") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenFoliage(Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "Ice") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenIce);
|
||||
|
@ -159,6 +159,38 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cFinishGenFoliage:
|
||||
|
||||
void cFinishGenFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
for (int x = 1; x < cChunkDef::Width; x++)
|
||||
{
|
||||
int xx = x + a_ChunkDesc.GetChunkX();
|
||||
for (int z = 1; z < cChunkDef::Width; z++)
|
||||
{
|
||||
int zz = z + a_ChunkDesc.GetChunkZ();
|
||||
//if (true)
|
||||
if (m_Noise.CubicNoise2D((float) xx + m_Noise.CubicNoise1D(xx), zz + m_Noise.CubicNoise1D(zz)) < GetBiomeDensity(a_ChunkDesc.GetBiome(x, z)))
|
||||
{
|
||||
for (int y = a_ChunkDesc.GetHeight(x, z) + 1; y >= 1; y--)
|
||||
{
|
||||
if (
|
||||
(a_ChunkDesc.GetBlockType(x, y, z) == E_BLOCK_AIR) &&
|
||||
(a_ChunkDesc.GetBlockType(x, y - 1, z) == E_BLOCK_GRASS)
|
||||
)
|
||||
{
|
||||
a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, m_Noise.CubicNoise2D(xx * 100, zz * 100) > -0.2 ? 1 : 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cFinishGenSprinkleFoliage:
|
||||
|
||||
|
@ -69,6 +69,44 @@ protected:
|
||||
|
||||
|
||||
|
||||
class cFinishGenFoliage :
|
||||
public cFinishGen
|
||||
{
|
||||
public:
|
||||
cFinishGenFoliage(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {}
|
||||
|
||||
protected:
|
||||
cNoise m_Noise;
|
||||
int m_Seed;
|
||||
|
||||
// cFinishGen override:
|
||||
virtual void GenFinish(cChunkDesc & a_ChunkDesc) override;
|
||||
|
||||
float GetBiomeDensity(EMCSBiome a_Biome)
|
||||
{
|
||||
switch (a_Biome)
|
||||
{
|
||||
case biSavanna:
|
||||
case biSavannaM:
|
||||
case biSavannaPlateau:
|
||||
case biSavannaPlateauM:
|
||||
case biPlains:
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return -0.4;
|
||||
}
|
||||
}
|
||||
return -0.3;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cFinishGenSprinkleFoliage :
|
||||
public cFinishGen
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user