diff --git a/Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp b/Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp index 944b758fa11..cf8d81d16f4 100644 --- a/Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp @@ -25,7 +25,7 @@ #include "WHeightMapEdit.h" #include "Common/MapReaderWriterInfo.h" -static constexpr const Int LARGE_MAP_SIDE = 1024; ///< Memory warning above this squared +static constexpr const Int LARGE_MAP_SIDE = 2048; ///< Memory warning above this squared ///////////////////////////////////////////////////////////////////////////// // CNewHeightMap dialog diff --git a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp index 6c7dfdbd4fc..27c1a33cbbf 100644 --- a/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -118,6 +118,13 @@ static Real theLightYOffset = 0.07f; static Int theFlashCount = 0; #endif +static const Int MAX_DRAWABLE_MAP_AREA = 1024*1024; ///< Larger maps draw the partial terrain window + +static Bool canDrawEntireMap(const WorldHeightMap *htMap) +{ + return htMap != nullptr && htMap->getXExtent() * htMap->getYExtent() <= MAX_DRAWABLE_MAP_AREA; +} + // ---------------------------------------------------------------------------- // Global Variables: // ---------------------------------------------------------------------------- @@ -1508,7 +1515,7 @@ void WbView3d::updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const if (partial) { m_heightMapRenderObj->doPartialUpdate(partialRange, htMap, &lightListIt); } else { - if (m_showEntireMap) { + if (m_showEntireMap && canDrawEntireMap(htMap)) { htMap->setDrawOrg(0, 0); htMap->setDrawWidth(htMap->getXExtent()); htMap->setDrawHeight(htMap->getYExtent()); @@ -2690,7 +2697,9 @@ void WbView3d::OnViewShowentire3dmap() void WbView3d::OnUpdateViewShowentire3dmap(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(m_showEntireMap?1:0); + const Bool canDraw = canDrawEntireMap(WbDoc() ? WbDoc()->GetHeightMap() : nullptr); + pCmdUI->Enable(canDraw); + pCmdUI->SetCheck(m_showEntireMap && canDraw ? 1 : 0); } void WbView3d::OnViewShowtopdownview() diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp index b7c01ef83cf..63d5d6d09ba 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp @@ -25,7 +25,7 @@ #include "WHeightMapEdit.h" #include "Common/MapReaderWriterInfo.h" -static constexpr const Int LARGE_MAP_SIDE = 1024; ///< Memory warning above this squared +static constexpr const Int LARGE_MAP_SIDE = 2048; ///< Memory warning above this squared ///////////////////////////////////////////////////////////////////////////// // CNewHeightMap dialog diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index bafede12b4f..401005ef767 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -119,6 +119,13 @@ static Real theLightYOffset = 0.07f; static Int theFlashCount = 0; #endif +static const Int MAX_DRAWABLE_MAP_AREA = 1024*1024; ///< Larger maps draw the partial terrain window + +static Bool canDrawEntireMap(const WorldHeightMap *htMap) +{ + return htMap != nullptr && htMap->getXExtent() * htMap->getYExtent() <= MAX_DRAWABLE_MAP_AREA; +} + // ---------------------------------------------------------------------------- // Global Variables: // ---------------------------------------------------------------------------- @@ -1590,7 +1597,7 @@ void WbView3d::updateHeightMapInView(WorldHeightMap *htMap, Bool partial, const if (partial) { m_heightMapRenderObj->doPartialUpdate(partialRange, htMap, &lightListIt); } else { - if (m_showEntireMap) { + if (m_showEntireMap && canDrawEntireMap(htMap)) { htMap->setDrawOrg(0, 0); htMap->setDrawWidth(htMap->getXExtent()); htMap->setDrawHeight(htMap->getYExtent()); @@ -2888,7 +2895,9 @@ void WbView3d::OnViewShowentire3dmap() void WbView3d::OnUpdateViewShowentire3dmap(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(m_showEntireMap?1:0); + const Bool canDraw = canDrawEntireMap(WbDoc() ? WbDoc()->GetHeightMap() : nullptr); + pCmdUI->Enable(canDraw); + pCmdUI->SetCheck(m_showEntireMap && canDraw ? 1 : 0); } void WbView3d::OnViewShowtopdownview()