Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Generals/Code/Tools/WorldBuilder/src/NewHeightMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions Generals/Code/Tools/WorldBuilder/src/wbview3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/Tools/WorldBuilder/src/NewHeightMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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()
Expand Down
Loading