Remove redundant heighmap code
This commit is contained in:
parent
360d8eade0
commit
4dc72fe00b
@ -236,7 +236,7 @@ void cNoise3DGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_Ch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateHeightmap(a_ChunkDesc);
|
a_ChunkDesc.UpdateHeightmap();
|
||||||
ComposeTerrain (a_ChunkDesc);
|
ComposeTerrain (a_ChunkDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,28 +299,6 @@ void cNoise3DGenerator::GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DAT
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cNoise3DGenerator::UpdateHeightmap(cChunkDesc & a_ChunkDesc)
|
|
||||||
{
|
|
||||||
for (int z = 0; z < cChunkDef::Width; z++)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < cChunkDef::Width; x++)
|
|
||||||
{
|
|
||||||
for (HEIGHTTYPE y = cChunkDef::Height - 1; y > 0; y--)
|
|
||||||
{
|
|
||||||
if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR)
|
|
||||||
{
|
|
||||||
a_ChunkDesc.SetHeight(x, z, y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} // for y
|
|
||||||
} // for x
|
|
||||||
} // for z
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cNoise3DGenerator::ComposeTerrain(cChunkDesc & a_ChunkDesc)
|
void cNoise3DGenerator::ComposeTerrain(cChunkDesc & a_ChunkDesc)
|
||||||
{
|
{
|
||||||
// Make basic terrain composition:
|
// Make basic terrain composition:
|
||||||
|
@ -61,9 +61,6 @@ protected:
|
|||||||
/** Generates the 3D noise array used for terrain generation; a_Noise is of ChunkData-size */
|
/** Generates the 3D noise array used for terrain generation; a_Noise is of ChunkData-size */
|
||||||
void GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DATATYPE * a_Noise);
|
void GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DATATYPE * a_Noise);
|
||||||
|
|
||||||
/** Updates heightmap based on the chunk's contents */
|
|
||||||
void UpdateHeightmap(cChunkDesc & a_ChunkDesc);
|
|
||||||
|
|
||||||
/** Composes terrain - adds dirt, grass and sand */
|
/** Composes terrain - adds dirt, grass and sand */
|
||||||
void ComposeTerrain(cChunkDesc & a_ChunkDesc);
|
void ComposeTerrain(cChunkDesc & a_ChunkDesc);
|
||||||
} ;
|
} ;
|
||||||
|
@ -67,21 +67,7 @@ void cStructGenTrees::GenFinish(cChunkDesc & a_ChunkDesc)
|
|||||||
} // for z
|
} // for z
|
||||||
} // for x
|
} // for x
|
||||||
|
|
||||||
// Update the heightmap:
|
a_ChunkDesc.UpdateHeightmap();
|
||||||
for (int x = 0; x < cChunkDef::Width; x++)
|
|
||||||
{
|
|
||||||
for (int z = 0; z < cChunkDef::Width; z++)
|
|
||||||
{
|
|
||||||
for (HEIGHTTYPE y = cChunkDef::Height - 1; y >= 0; y--)
|
|
||||||
{
|
|
||||||
if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR)
|
|
||||||
{
|
|
||||||
a_ChunkDesc.SetHeight(x, z, y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} // for y
|
|
||||||
} // for z
|
|
||||||
} // for x
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user