parent
386068a5ad
commit
f91aa6f1d3
@ -540,10 +540,11 @@ void cDistortedHeightmap::InitializeCompoGen(cIniFile & a_IniFile)
|
|||||||
|
|
||||||
int cDistortedHeightmap::GetHeightmapAt(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z)
|
int cDistortedHeightmap::GetHeightmapAt(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z)
|
||||||
{
|
{
|
||||||
int ChunkX = (int)floor(a_X / (NOISE_DATATYPE)16);
|
int RelX = (int)std::floor(a_X);
|
||||||
int ChunkZ = (int)floor(a_Z / (NOISE_DATATYPE)16);
|
int RelY = 0;
|
||||||
int RelX = (int)(a_X - (NOISE_DATATYPE)ChunkX * cChunkDef::Width);
|
int RelZ = (int)std::floor(a_Z);
|
||||||
int RelZ = (int)(a_Z - (NOISE_DATATYPE)ChunkZ * cChunkDef::Width);
|
int ChunkX, ChunkZ;
|
||||||
|
cChunkDef::AbsoluteToRelative(RelX, RelY, RelZ, ChunkX, ChunkZ);
|
||||||
|
|
||||||
// If we're withing the same chunk, return the pre-cached heightmap:
|
// If we're withing the same chunk, return the pre-cached heightmap:
|
||||||
if ((ChunkX == m_CurChunkX) && (ChunkZ == m_CurChunkZ))
|
if ((ChunkX == m_CurChunkX) && (ChunkZ == m_CurChunkZ))
|
||||||
|
Loading…
Reference in New Issue
Block a user