Added a new cave generator: DualRidgeCaves ( somewhat like http://www.gamedev.net/blog/33/entry-2227887-more-on-minecraft-type-world-gen/ )
git-svn-id: http://mc-server.googlecode.com/svn/trunk@694 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -295,72 +295,6 @@ int cStructGenTrees::GetNumTrees(
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cStructGenMarbleCaves:
|
||||
|
||||
static float GetMarbleNoise( float x, float y, float z, cNoise & a_Noise )
|
||||
{
|
||||
static const float PI_2 = 1.57079633f;
|
||||
float oct1 = (a_Noise.CubicNoise3D(x * 0.1f, y * 0.1f, z * 0.1f )) * 4;
|
||||
|
||||
oct1 = oct1 * oct1 * oct1;
|
||||
if (oct1 < 0.f) oct1 = PI_2;
|
||||
if (oct1 > PI_2) oct1 = PI_2;
|
||||
|
||||
return oct1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cStructGenMarbleCaves::GenStructures(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
||||
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
||||
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
||||
cEntityList & a_Entities, // Entities may be added or deleted
|
||||
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
||||
)
|
||||
{
|
||||
cNoise Noise(m_Seed);
|
||||
for (int z = 0; z < cChunkDef::Width; z++)
|
||||
{
|
||||
const float zz = (float)(a_ChunkZ * cChunkDef::Width + z);
|
||||
for (int x = 0; x < cChunkDef::Width; x++)
|
||||
{
|
||||
const float xx = (float)(a_ChunkX * cChunkDef::Width + x);
|
||||
|
||||
int Top = cChunkDef::GetHeight(a_HeightMap, x, z);
|
||||
for (int y = 1; y < Top; ++y )
|
||||
{
|
||||
if (cChunkDef::GetBlock(a_BlockTypes, x, y, z) != E_BLOCK_STONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
const float yy = (float)y;
|
||||
const float WaveNoise = 1;
|
||||
if (cosf(GetMarbleNoise(xx, yy * 0.5f, zz, Noise)) * fabs(cosf(yy * 0.2f + WaveNoise * 2) * 0.75f + WaveNoise) > 0.0005f)
|
||||
{
|
||||
if (y > 4)
|
||||
{
|
||||
cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR);
|
||||
}
|
||||
else
|
||||
{
|
||||
cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_STATIONARY_LAVA);
|
||||
}
|
||||
}
|
||||
} // for y
|
||||
} // for x
|
||||
} // for z
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cStructGenOreNests:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user