Put the origin of the world in the corner of tile 0,0.

Negative x/z will be put into negative tiles, so you can easily determine
the tile location by dividing the x or z by 16*tileSize. This means the same area of the world
will always end up in the same tile, independent of how much of the world is generated.
This commit is contained in:
Martijn Versteegh 2018-11-27 10:51:17 +01:00
parent 961f65974f
commit aa0506224e
1 changed files with 5 additions and 1 deletions

View File

@ -264,6 +264,10 @@ void TileGenerator::generate(const std::string &input, const std::string &output
if (m_tileW < INT_MAX || m_tileH < INT_MAX)
{
m_xMin = round_multiple_nosign(m_xMin, m_tileW);
m_zMin = round_multiple_nosign(m_zMin, m_tileH);
int minTileX = m_xMin / m_tileW;
int minTileY = m_zMin / m_tileH;
sortPositionsIntoTiles();
@ -295,7 +299,7 @@ void TileGenerator::generate(const std::string &input, const std::string &output
renderPlayers(input_path);
}
ostringstream fn;
fn << x << '_' << y << '_' << output;
fn << (x + minTileX) << '_' << (y + minTileY) << '_' << output;
writeImage(fn.str());
}
}