Skip to content

Commit a620c66

Browse files
authored
Merge branch 'TheSuperHackers:main' into main
2 parents f19d8b6 + ccd8766 commit a620c66

13 files changed

Lines changed: 337 additions & 214 deletions

File tree

Core/GameEngine/Include/GameClient/View.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ enum FilterModes CPP_11(: Int);
5252

5353
// ------------------------------------------------------------------------------------------------
5454
constexpr const Real ViewDefaultPitchRadians = DEG_TO_RADF(37.5f);
55+
constexpr const Real ViewDefaultLowPitchRadians = DEG_TO_RADF(37.0f);
5556
constexpr const Real ViewDefaultYawRadians = DEG_TO_RADF(0.0f);
5657
constexpr const Real ViewDefaultMaxHeightAboveTerrain = 310.0f;
5758

Core/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ class BaseHeightMapRenderObjClass : public RenderObjClass, public DX8_CleanupHoo
119119
///allocate resources needed to render heightmap
120120
virtual int initHeightData(Int width, Int height, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator, Bool updateExtraPassTiles=TRUE);
121121
virtual Int freeMapResources(); ///< free resources used to render heightmap
122-
virtual void updateCenter(CameraClass *camera, RefRenderObjListIterator *pLightsIterator);
122+
virtual void updateCenter(CameraClass *camera, const Vector3 *cameraPivot, RefRenderObjListIterator *pLightsIterator);
123123
virtual void adjustTerrainLOD(Int adj);
124124
virtual void doPartialUpdate(const IRegion2D &partialRange, WorldHeightMap *htMap, RefRenderObjListIterator *pLightsIterator) = 0;
125125
virtual void staticLightingChanged();
126-
virtual void oversizeTerrain(Int tilesToOversize);
126+
virtual void oversizeTerrain(Int tilesToOversize) = 0; ///< Oversize the visible terrain area.
127+
virtual void setTerrainDrawSize(Int width, Int height) = 0; ///< Resize the visible terrain area. Always defaults to oversize dimensions when oversize is set.
127128
virtual void reset();
128129

129130
void redirectToHeightmap( WorldHeightMap *pMap )

Core/GameEngineDevice/Include/W3DDevice/GameClient/FlatHeightMap.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ class FlatHeightMapRenderObjClass : public BaseHeightMapRenderObjClass
6666
///allocate resources needed to render heightmap
6767
virtual int initHeightData(Int width, Int height, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator,Bool updateExtraPassTiles=TRUE) override;
6868
virtual Int freeMapResources() override; ///< free resources used to render heightmap
69-
virtual void updateCenter(CameraClass *camera, RefRenderObjListIterator *pLightsIterator) override;
69+
virtual void updateCenter(CameraClass *camera, const Vector3 *cameraPivot, RefRenderObjListIterator *pLightsIterator) override;
7070
virtual void adjustTerrainLOD(Int adj) override;
7171
virtual void reset() override;
72-
virtual void oversizeTerrain(Int tilesToOversize) override;
72+
virtual void oversizeTerrain(Int tilesToOversize) override; ///< Oversize the visible terrain area.
73+
virtual void setTerrainDrawSize(Int width, Int height) override; ///< Resize the visible terrain area. Always defaults to oversize dimensions when oversize is set.
7374
virtual void staticLightingChanged() override;
7475
virtual void doPartialUpdate(const IRegion2D &partialRange, WorldHeightMap *htMap, RefRenderObjListIterator *pLightsIterator) override;
7576
virtual int updateBlock(Int x0, Int y0, Int x1, Int y1, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator) override {return 0;};

Core/GameEngineDevice/Include/W3DDevice/GameClient/HeightMap.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,15 @@ class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass
7373
///allocate resources needed to render heightmap
7474
virtual int initHeightData(Int width, Int height, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator, Bool updateExtraPassTiles=TRUE) override;
7575
virtual Int freeMapResources() override; ///< free resources used to render heightmap
76-
virtual void updateCenter(CameraClass *camera, RefRenderObjListIterator *pLightsIterator) override;
76+
virtual void updateCenter(CameraClass *camera, const Vector3 *cameraPivot, RefRenderObjListIterator *pLightsIterator) override;
7777

7878
virtual void staticLightingChanged() override;
7979
virtual void adjustTerrainLOD(Int adj) override;
8080
virtual void reset() override;
8181
virtual void doPartialUpdate(const IRegion2D &partialRange, WorldHeightMap *htMap, RefRenderObjListIterator *pLightsIterator) override;
8282

83-
virtual void oversizeTerrain(Int tilesToOversize) override;
83+
virtual void oversizeTerrain(Int tilesToOversize) override; ///< Oversize the visible terrain area.
84+
virtual void setTerrainDrawSize(Int width, Int height) override; ///< Resize the visible terrain area. Always defaults to oversize dimensions when oversize is set.
8485

8586
virtual int updateBlock(Int x0, Int y0, Int x1, Int y1, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator) override;
8687

@@ -93,6 +94,8 @@ class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass
9394
VERTEX_FORMAT *m_vertexBufferBackup; ///< In memory copy of the vertex buffer data for quick update of dynamic lighting.
9495
Int m_originX; ///< Origin point in the grid. Slides around.
9596
Int m_originY; ///< Origin point in the grid. Slides around.
97+
Int m_oversizeDrawWidth; // Oversize draw width required by mission scripts for cinematic sequences.
98+
Int m_oversizeDrawHeight; // Oversize draw height required by mission scripts for cinematic sequences.
9699
DX8IndexBufferClass *m_indexBuffer; ///<indices defining triangles in a VB tile.
97100
Int m_numVBTilesX; ///<dimensions of array containing all the vertex buffers
98101
Int m_numVBTilesY; ///<dimensions of array containing all the vertex buffers

Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ class W3DView : public View, public SubsystemInterface
302302
Real getMaxHeight(Real x, Real y) const;
303303
Real getMaxZoom(Real x, Real y) const;
304304
void updateCameraTransform(); ///< update the transform matrix of m_3DCamera, based on m_pos & m_angle
305-
void updateCameraClipPlanes();
305+
void updateCameraClipPlanes(const Matrix3D &transform);
306306
void setCameraTransform(const Matrix3D &transform);
307307
void buildCameraPosition(Vector3 &sourcePos, Vector3 &targetPos);
308308
void buildCameraTransform(Matrix3D *transform, const Vector3 &sourcePos, const Vector3 &targetPos); ///< calculate (but do not set) the transform matrix of m_3DCamera, based on m_pos & m_angle

Core/GameEngineDevice/Include/W3DDevice/GameClient/WorldHeightMap.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,15 @@ class WorldHeightMap : public RefCountClass,
108108
#define NO_EVAL_TILING_MODES
109109

110110
public:
111+
112+
struct DrawArea
113+
{
114+
Int originX;
115+
Int originY;
116+
Int sizeX;
117+
Int sizeY;
118+
};
119+
111120
#ifdef EVAL_TILING_MODES
112121
enum {TILE_4x4, TILE_6x6, TILE_8x8} m_tileMode;
113122
#endif
@@ -116,6 +125,8 @@ class WorldHeightMap : public RefCountClass,
116125
NORMAL_DRAW_HEIGHT = 1 + 4*VERTEX_BUFFER_TILE_LENGTH,
117126
STRETCH_DRAW_WIDTH = 1 + 2*VERTEX_BUFFER_TILE_LENGTH,
118127
STRETCH_DRAW_HEIGHT = 1 + 2*VERTEX_BUFFER_TILE_LENGTH,
128+
LOW_ANGLE_DRAW_WIDTH = 1 + (NORMAL_DRAW_WIDTH-1) * 2,
129+
LOW_ANGLE_DRAW_HEIGHT = 1 + (NORMAL_DRAW_HEIGHT-1) * 2,
119130
};
120131

121132
protected:
@@ -241,8 +252,8 @@ class WorldHeightMap : public RefCountClass,
241252

242253
Int getDrawWidth() {return m_drawWidthX;}
243254
Int getDrawHeight() {return m_drawHeightY;}
244-
void setDrawWidth(Int width) {m_drawWidthX = width; if (m_drawWidthX>m_width) m_drawWidthX = m_width;}
245-
void setDrawHeight(Int height) {m_drawHeightY = height; if (m_drawHeightY>m_height) m_drawHeightY = m_height;}
255+
void setDrawWidth(Int width) {DEBUG_ASSERTCRASH(width <= m_width, ("Draw width must not exceed map width")); m_drawWidthX = width;}
256+
void setDrawHeight(Int height) {DEBUG_ASSERTCRASH(height <= m_height, ("Draw height must not exceed map height")); m_drawHeightY = height;}
246257
virtual Int getBorderSize() override {return m_borderSize;}
247258
Int getBorderSizeInline() const { return m_borderSize; }
248259
/// Get height with the offset that HeightMapRenderObjClass uses built in.
@@ -260,6 +271,8 @@ class WorldHeightMap : public RefCountClass,
260271

261272
void getUVForBlend(Int edgeClass, Region2D *range);
262273

274+
DrawArea createDrawArea(Int xOrg, Int yOrg);
275+
Bool setDrawArea(const DrawArea& drawArea);
263276
Bool setDrawOrg(Int xOrg, Int yOrg);
264277

265278
static void freeListOfMapObjects();

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,18 +1318,6 @@ Bool BaseHeightMapRenderObjClass::evaluateAsVisibleCliff(Int xIndex, Int yIndex,
13181318
return anyImpassable;
13191319
}
13201320

1321-
//=============================================================================
1322-
// BaseHeightMapRenderObjClass::oversizeTerrain
1323-
//=============================================================================
1324-
/** Sets the terrain oversize amount. */
1325-
//=============================================================================
1326-
void BaseHeightMapRenderObjClass::oversizeTerrain(Int tilesToOversize)
1327-
{
1328-
// Not needed with flat version. [3/20/2003]
1329-
}
1330-
1331-
1332-
13331321
//=============================================================================
13341322
// BaseHeightMapRenderObjClass::Get_Obj_Space_Bounding_Sphere
13351323
//=============================================================================
@@ -2394,7 +2382,7 @@ rendered portion of the terrain. Only a 96x96 section is rendered at any time,
23942382
even though maps can be up to 1024x1024. This function determines which subset
23952383
is rendered. */
23962384
//=============================================================================
2397-
void BaseHeightMapRenderObjClass::updateCenter(CameraClass *camera , RefRenderObjListIterator *pLightsIterator)
2385+
void BaseHeightMapRenderObjClass::updateCenter(CameraClass *camera, const Vector3 *cameraPivot, RefRenderObjListIterator *pLightsIterator)
23982386
{
23992387
if (m_map==nullptr) {
24002388
return;

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ void FlatHeightMapRenderObjClass::oversizeTerrain(Int tilesToOversize)
243243
// Not needed with flat version. [3/20/2003]
244244
}
245245

246-
246+
void FlatHeightMapRenderObjClass::setTerrainDrawSize(Int width, Int height)
247+
{
248+
// Not needed with flat version.
249+
}
247250

248251
//=============================================================================
249252
// HeightMapRenderObjClass::doPartialUpdate
@@ -405,13 +408,13 @@ rendered portion of the terrain. Only a 96x96 section is rendered at any time,
405408
even though maps can be up to 1024x1024. This function determines which subset
406409
is rendered. */
407410
//=============================================================================
408-
void FlatHeightMapRenderObjClass::updateCenter(CameraClass *camera , RefRenderObjListIterator *pLightsIterator)
411+
void FlatHeightMapRenderObjClass::updateCenter(CameraClass *camera, const Vector3 *cameraPivot, RefRenderObjListIterator *pLightsIterator)
409412
{
410413
#ifdef DO_UNIT_TIMINGS
411414
#pragma MESSAGE("*** WARNING *** DOING DO_UNIT_TIMINGS!!!!")
412415
return;
413416
#endif
414-
BaseHeightMapRenderObjClass::updateCenter(camera, pLightsIterator);
417+
BaseHeightMapRenderObjClass::updateCenter(camera, cameraPivot, pLightsIterator);
415418
m_needFullUpdate = false;
416419
Int i, j;
417420
Int culled = 0;

0 commit comments

Comments
 (0)