Speed up the NetherClumpFoliage finisher.
Using IntNoiseXX instead of CubicNoiseXX.
This commit is contained in:
parent
d3012d6904
commit
0f298c8b84
@ -48,8 +48,8 @@ void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
double ChunkX = a_ChunkDesc.GetChunkX() + 0.1; // We can't devide through 0 so lets add 0.1 to all the chunk coordinates.
|
||||
double ChunkZ = a_ChunkDesc.GetChunkZ() + 0.1;
|
||||
|
||||
NOISE_DATATYPE Val1 = m_Noise.CubicNoise2D((float) (ChunkX * ChunkZ * 0.01f), (float) (ChunkZ / ChunkX * 0.01f));
|
||||
NOISE_DATATYPE Val2 = m_Noise.CubicNoise2D((float) (ChunkX / ChunkZ / 0.01f), (float) (ChunkZ * ChunkX / 0.01f));
|
||||
NOISE_DATATYPE Val1 = m_Noise.IntNoise2D((int) (ChunkX * ChunkZ * 0.01f), (int) (ChunkZ / ChunkX * 0.01f));
|
||||
NOISE_DATATYPE Val2 = m_Noise.IntNoise2D((int) (ChunkX / ChunkZ / 0.01f), (int) (ChunkZ * ChunkX / 0.01f));
|
||||
|
||||
if (Val1 < 0)
|
||||
{
|
||||
@ -88,12 +88,14 @@ void cFinishGenNetherClumpFoliage::GenFinish(cChunkDesc & a_ChunkDesc)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!cBlockInfo::IsSolid(a_ChunkDesc.GetBlockType(PosX, y - 1, PosZ))) // Only place on solid blocks
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
NOISE_DATATYPE BlockType = m_Noise.CubicNoise1D((float) (ChunkX * ChunkZ) / (y * 0.1f));
|
||||
// Choose what block to use.
|
||||
NOISE_DATATYPE BlockType = m_Noise.IntNoise3D((int) ChunkX, y, (int) ChunkZ);
|
||||
if (BlockType < -0.7)
|
||||
{
|
||||
TryPlaceClump(a_ChunkDesc, PosX, y, PosZ, E_BLOCK_BROWN_MUSHROOM);
|
||||
@ -119,10 +121,10 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
|
||||
|
||||
for (int x = a_RelX - 4; x < a_RelX + 4; x++)
|
||||
{
|
||||
float xx = (float) a_ChunkDesc.GetChunkX() * cChunkDef::Width + x;
|
||||
int xx = a_ChunkDesc.GetChunkX() * cChunkDef::Width + x;
|
||||
for (int z = a_RelZ - 4; z < a_RelZ + 4; z++)
|
||||
{
|
||||
float zz = (float) a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z;
|
||||
int zz = a_ChunkDesc.GetChunkZ() * cChunkDef::Width + z;
|
||||
for (int y = a_RelY - 2; y < a_RelY + 2; y++)
|
||||
{
|
||||
if ((y < 1) || (y > cChunkDef::Height))
|
||||
@ -149,9 +151,8 @@ void cFinishGenNetherClumpFoliage::TryPlaceClump(cChunkDesc & a_ChunkDesc, int a
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
NOISE_DATATYPE Val = m_Noise.CubicNoise2D(xx, zz);
|
||||
if (Val < -0.70)
|
||||
NOISE_DATATYPE Val = m_Noise.IntNoise2D(xx, zz);
|
||||
if (Val < -0.5)
|
||||
{
|
||||
a_ChunkDesc.SetBlockType(x, y, z, a_Block);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user