Skip to content

Commit 638211a

Browse files
committed
feat(terrain): final clean implementation of RenderAllTerrain
1 parent 22d757f commit 638211a

5 files changed

Lines changed: 25 additions & 13 deletions

File tree

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

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -604,19 +604,29 @@ Bool W3DTerrainVisual::load( AsciiString filename )
604604

605605
RefRenderObjListIterator *it = W3DDisplay::m_3DScene ? W3DDisplay::m_3DScene->createLightsIterator() : nullptr;
606606
// apply the heightmap to the terrain render object
607-
608607
#ifdef DO_SEISMIC_SIMULATIONS
609-
m_terrainRenderObject->initHeightData( m_clientHeightMap->getDrawWidth(),
610-
m_clientHeightMap->getDrawHeight(),
611-
m_clientHeightMap,
612-
it);
608+
WorldHeightMap* heightMap = m_clientHeightMap;
613609
#else
614-
m_terrainRenderObject->initHeightData( m_logicHeightMap->getDrawWidth(),
615-
m_logicHeightMap->getDrawHeight(),
616-
m_logicHeightMap,
617-
it);
610+
WorldHeightMap* heightMap = m_logicHeightMap;
618611
#endif
619612

613+
const Bool isRenderAllTerrain = TheGlobalData->m_renderAllTerrain;
614+
615+
Int xExt, yExt;
616+
617+
if (isRenderAllTerrain) {
618+
xExt = heightMap->getXExtent();
619+
yExt = heightMap->getYExtent();
620+
621+
// TheSuperHackers @feature explicitly draw boundaries to match full extent
622+
heightMap->setDrawWidth(xExt);
623+
heightMap->setDrawHeight(yExt);
624+
} else {
625+
xExt = heightMap->getDrawWidth();
626+
yExt = heightMap->getDrawHeight();
627+
}
628+
629+
m_terrainRenderObject->initHeightData(xExt, yExt, heightMap, it);
620630

621631
if (it) {
622632
W3DDisplay::m_3DScene->destroyLightsIterator(it);

Generals/Code/GameEngine/Include/Common/GlobalData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class GlobalData : public SubsystemInterface
119119
// TheSuperHackers @feature helmutbuhler 11/04/2025
120120
// Run game without graphics, input or audio.
121121
Bool m_headless;
122-
122+
Bool m_renderAllTerrain;
123123
Bool m_windowed;
124124
Int m_xResolution;
125125
Int m_yResolution;

Generals/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ GlobalData* GlobalData::m_theOriginal = nullptr;
427427
{ "ShellMapName", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_shellMapName ) },
428428
{ "ShellMapOn", INI::parseBool, nullptr, offsetof( GlobalData, m_shellMapOn ) },
429429
{ "PlayIntro", INI::parseBool, nullptr, offsetof( GlobalData, m_playIntro ) },
430-
430+
{ "RenderAllTerrain", INI::parseBool, nullptr, offsetof( GlobalData, m_renderAllTerrain ) },
431431
{ "FirewallBehavior", INI::parseInt, nullptr, offsetof( GlobalData, m_firewallBehavior ) },
432432
{ "FirewallPortOverride", INI::parseInt, nullptr, offsetof( GlobalData, m_firewallPortOverride ) },
433433
{ "FirewallPortAllocationDelta",INI::parseInt, nullptr, offsetof( GlobalData, m_firewallPortAllocationDelta) },
@@ -627,6 +627,7 @@ GlobalData::GlobalData()
627627
m_framesPerSecondLimit = 0;
628628
m_chipSetType = 0;
629629
m_headless = FALSE;
630+
m_renderAllTerrain = FALSE;
630631
m_windowed = 0;
631632
m_xResolution = DEFAULT_DISPLAY_WIDTH;
632633
m_yResolution = DEFAULT_DISPLAY_HEIGHT;

GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class GlobalData : public SubsystemInterface
120120
// TheSuperHackers @feature helmutbuhler 11/04/2025
121121
// Run game without graphics, input or audio.
122122
Bool m_headless;
123-
123+
Bool m_renderAllTerrain;
124124
Bool m_windowed;
125125
Int m_xResolution;
126126
Int m_yResolution;

GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ GlobalData* GlobalData::m_theOriginal = nullptr;
427427
{ "ShellMapName", INI::parseAsciiString,nullptr, offsetof( GlobalData, m_shellMapName ) },
428428
{ "ShellMapOn", INI::parseBool, nullptr, offsetof( GlobalData, m_shellMapOn ) },
429429
{ "PlayIntro", INI::parseBool, nullptr, offsetof( GlobalData, m_playIntro ) },
430-
430+
{ "RenderAllTerrain", INI::parseBool, nullptr, offsetof( GlobalData, m_renderAllTerrain ) },
431431
{ "FirewallBehavior", INI::parseInt, nullptr, offsetof( GlobalData, m_firewallBehavior ) },
432432
{ "FirewallPortOverride", INI::parseInt, nullptr, offsetof( GlobalData, m_firewallPortOverride ) },
433433
{ "FirewallPortAllocationDelta",INI::parseInt, nullptr, offsetof( GlobalData, m_firewallPortAllocationDelta) },
@@ -631,6 +631,7 @@ GlobalData::GlobalData()
631631
m_framesPerSecondLimit = 0;
632632
m_chipSetType = 0;
633633
m_headless = FALSE;
634+
m_renderAllTerrain = FALSE;
634635
m_windowed = 0;
635636
m_xResolution = DEFAULT_DISPLAY_WIDTH;
636637
m_yResolution = DEFAULT_DISPLAY_HEIGHT;

0 commit comments

Comments
 (0)