Skip to content

Commit 534167e

Browse files
committed
bugfix(heightmap): Do full terrain update after new origin position was set (TheSuperHackers#2677)
1 parent 9567b22 commit 534167e

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

Core/GameEngineDevice/Source/W3DDevice/GameClient/HeightMap.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,8 +1128,7 @@ void HeightMapRenderObjClass::adjustTerrainLOD(Int adj)
11281128
m_map->getDrawHeight(), m_map, nullptr);
11291129
staticLightingChanged();
11301130
if (TheTacticalView) {
1131-
TheTacticalView->setAngle(TheTacticalView->getAngle() + 1);
1132-
TheTacticalView->setAngle(TheTacticalView->getAngle() - 1);
1131+
TheTacticalView->forceRedraw();
11331132
}
11341133
#endif
11351134
}
@@ -1645,22 +1644,13 @@ void HeightMapRenderObjClass::updateCenter(CameraClass *camera , RefRenderObjLis
16451644

16461645
BaseHeightMapRenderObjClass::updateCenter(camera, pLightsIterator);
16471646

1648-
m_updating = true;
1649-
if (m_needFullUpdate)
1650-
{
1651-
m_needFullUpdate = false;
1652-
updateBlock(0, 0, m_x-1, m_y-1, m_map, pLightsIterator);
1653-
m_updating = false;
1654-
return;
1655-
}
1656-
16571647
if (m_x >= m_map->getXExtent() && m_y >= m_map->getYExtent())
16581648
{
1659-
m_updating = false;
16601649
return; // no need to center.
16611650
}
16621651

1663-
constexpr const Int cellOffset = 1;
1652+
Int newOrgX;
1653+
Int newOrgY;
16641654

16651655
// determine the ray corresponding to the camera and distance to projection plane
16661656
Matrix3D camera_matrix = camera->Get_Transform();
@@ -1749,14 +1739,24 @@ void HeightMapRenderObjClass::updateCenter(CameraClass *camera , RefRenderObjLis
17491739
}
17501740
calcVis(frustum, m_map, minX-WIDE_STEP/2, minY-WIDE_STEP/2, maxX+WIDE_STEP/2, maxY+WIDE_STEP/2, limit);
17511741

1752-
if (m_map) {
1753-
Int newOrgX;
1754-
Int newOrgY;
1755-
newOrgX = (visMaxX+visMinX)/2 - m_x/2.0;
1756-
newOrgY = (visMaxY+visMinY)/2 - m_y/2.0;
1742+
newOrgX = (visMaxX+visMinX)/2 - m_x/2.0;
1743+
newOrgY = (visMaxY+visMinY)/2 - m_y/2.0;
17571744

1745+
m_updating = true;
1746+
if (m_needFullUpdate)
1747+
{
1748+
m_needFullUpdate = false;
1749+
m_map->setDrawOrg(newOrgX, newOrgY);
1750+
updateBlock(0, 0, m_x-1, m_y-1, m_map, pLightsIterator);
1751+
m_updating = false;
1752+
return;
1753+
}
1754+
else
1755+
{
1756+
constexpr const Int cellOffset = 1;
17581757
Int deltaX = newOrgX - m_map->getDrawOrgX();
17591758
Int deltaY = newOrgY - m_map->getDrawOrgY();
1759+
17601760
if (IABS(deltaX) > m_x/2 || IABS(deltaY)>m_x/2) {
17611761
m_map->setDrawOrg(newOrgX, newOrgY);
17621762
m_originY = 0;

0 commit comments

Comments
 (0)