minimap creator: fix seams on water by drawing the tile above the current one. TODO: verify the pitch hack value used by Blizzard to be able to tile custom minimaps with original ones

This commit is contained in:
Skarn
2020-10-27 12:45:13 +03:00
parent 50d2dfcc1c
commit 38e87c30ae
2 changed files with 28 additions and 11 deletions

View File

@@ -1677,6 +1677,7 @@ void MapView::paintGL()
if (saving_minimap)
{
saveMinimap(minimapTool->getMinimapRenderSettings());
_main_window->setEnabled(false);
}
const qreal now(_startup_time.elapsed() / 1000.0);
@@ -1686,6 +1687,7 @@ void MapView::paintGL()
if (!saving_minimap)
{
tick (now - _last_update);
_main_window->setEnabled(true);
}
_last_update = now;
@@ -1694,6 +1696,11 @@ void MapView::paintGL()
draw_map();
if (saving_minimap)
{
gl.clear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
if (_world->uid_duplicates_found() && !_uid_duplicate_warning_shown)
{
_uid_duplicate_warning_shown = true;

View File

@@ -1831,6 +1831,13 @@ void World::drawMinimap ( MapTile *tile
);
}
// Also load a tile above the current one to correct the lookat approximation
tile_index m_tile = tile_index (camera_pos);
m_tile.z -= 1;
bool unload = !mapIndex.has_unsaved_changes(m_tile);
MapTile* mTile = mapIndex.loadTile(m_tile);
int daytime = static_cast<int>(time) % 2880;
outdoorLightStats = ol->getLightStats(daytime);
@@ -1882,12 +1889,6 @@ void World::drawMinimap ( MapTile *tile
display_mode::in_2D
);
tile_index m_tile = tile_index (camera_pos);
m_tile.z -= 1;
bool unload = !mapIndex.has_unsaved_changes(m_tile);
MapTile* mTile = mapIndex.loadTile(m_tile);
if (mTile)
{
mTile->wait_until_loaded();
@@ -1898,11 +1899,6 @@ void World::drawMinimap ( MapTile *tile
);
}
if (unload)
{
mapIndex.unloadTile(m_tile);
}
gl.bindVertexArray(0);
gl.bindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
@@ -2088,9 +2084,23 @@ void World::drawMinimap ( MapTile *tile
-1, display_mode::in_2D
);
if (mTile)
{
mTile->wait_until_loaded();
mTile->drawWater(frustum, culldistance, camera_pos, true, _liquid_render.get(), water_shader, animtime,
-1, display_mode::in_2D
);
}
gl.bindVertexArray(0);
gl.bindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
if (unload)
{
mapIndex.unloadTile(m_tile);
}
}
bool World::saveMinimap(tile_index const& tile_idx, MinimapRenderSettings* settings)