mirror of
https://github.com/minetest/minetestmapper.git
synced 2025-02-15 19:50:31 +01:00
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:
parent
961f65974f
commit
aa0506224e
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user