Initial version of "DistortedMembraneOverhangs"
git-svn-id: http://mc-server.googlecode.com/svn/trunk@1412 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
7387f05650
commit
c40eb92de3
@ -360,6 +360,10 @@ void cComposableGenerator::InitStructureGens(cIniFile & a_IniFile)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenDirectOverhangs(Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "DistortedMembraneOverhangs") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenDistortedMembraneOverhangs(Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "LavaLakes") == 0)
|
||||
{
|
||||
int Probability = a_IniFile.GetValueSetI("Generator", "LavaLakesProbability", 10);
|
||||
|
@ -513,7 +513,7 @@ void cStructGenLakes::CreateLakeImage(int a_ChunkX, int a_ChunkZ, cBlockArea & a
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cStructGenBiomeOverhangs:
|
||||
// cStructGenDirectOverhangs:
|
||||
|
||||
cStructGenDirectOverhangs::cStructGenDirectOverhangs(int a_Seed) :
|
||||
m_Noise1(a_Seed),
|
||||
@ -625,3 +625,50 @@ bool cStructGenDirectOverhangs::HasWantedBiome(cChunkDesc & a_ChunkDesc) const
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cStructGenDistortedMembraneOverhangs:
|
||||
|
||||
cStructGenDistortedMembraneOverhangs::cStructGenDistortedMembraneOverhangs(int a_Seed) :
|
||||
m_NoiseX(a_Seed + 1000),
|
||||
m_NoiseY(a_Seed + 2000),
|
||||
m_NoiseZ(a_Seed + 3000),
|
||||
m_NoiseH(a_Seed + 4000)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cStructGenDistortedMembraneOverhangs::GenStructures(cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
const NOISE_DATATYPE Frequency = (NOISE_DATATYPE)16;
|
||||
const NOISE_DATATYPE Amount = (NOISE_DATATYPE)1;
|
||||
for (int y = 50; y < 128; y++)
|
||||
{
|
||||
NOISE_DATATYPE NoiseY = (NOISE_DATATYPE)y / 32;
|
||||
// TODO: proper water level - where to get?
|
||||
BLOCKTYPE ReplacementBlock = (y > 62) ? E_BLOCK_AIR : E_BLOCK_STATIONARY_WATER;
|
||||
for (int z = 0; z < cChunkDef::Width; z++)
|
||||
{
|
||||
NOISE_DATATYPE NoiseZ = ((NOISE_DATATYPE)(a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z)) / Frequency;
|
||||
for (int x = 0; x < cChunkDef::Width; x++)
|
||||
{
|
||||
NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(a_ChunkDesc.GetChunkX() * cChunkDef::Width + x)) / Frequency;
|
||||
NOISE_DATATYPE DistortX = m_NoiseX.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * Amount;
|
||||
NOISE_DATATYPE DistortY = m_NoiseY.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * Amount;
|
||||
NOISE_DATATYPE DistortZ = m_NoiseZ.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * Amount;
|
||||
int MembraneHeight = 96 - (int)((DistortY + m_NoiseH.CubicNoise2D(NoiseX + DistortX, NoiseZ + DistortZ)) * 30);
|
||||
if (MembraneHeight < y)
|
||||
{
|
||||
a_ChunkDesc.SetBlockType(x, y, z, ReplacementBlock);
|
||||
}
|
||||
} // for y
|
||||
} // for x
|
||||
} // for z
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -143,3 +143,23 @@ protected:
|
||||
|
||||
|
||||
|
||||
|
||||
class cStructGenDistortedMembraneOverhangs :
|
||||
public cStructureGen
|
||||
{
|
||||
public:
|
||||
cStructGenDistortedMembraneOverhangs(int a_Seed);
|
||||
|
||||
protected:
|
||||
cNoise m_NoiseX;
|
||||
cNoise m_NoiseY;
|
||||
cNoise m_NoiseZ;
|
||||
cNoise m_NoiseH;
|
||||
|
||||
// cStructureGen override:
|
||||
virtual void GenStructures(cChunkDesc & a_ChunkDesc) override;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user