Skip to content

Commit de0fc8f

Browse files
authored
perf(heightmap): Optimize data locality for m_vertexBufferTiles and m_vertexBufferBackup in HeightMapRenderObjClass (#2104)
1 parent 833fb7c commit de0fc8f

File tree

9 files changed

+80
-74
lines changed

9 files changed

+80
-74
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@
4747
Custom W3D render object that's used to process the terrain. It handles
4848
virtually everything to do with the terrain, including: drawing, lighting,
4949
scorchmarks and intersection tests.
50-
*/
51-
52-
5350
51+
TheSuperHackers @performance xezon 13/01/2026
52+
Class now stores the vertex buffers as one big buffer each for optimal data locality.
53+
*/
5454
class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass
5555
{
5656

@@ -88,9 +88,9 @@ class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass
8888
Int *m_extraBlendTilePositions; ///<array holding x,y tile positions of all extra blend tiles. (used for 3 textures per tile).
8989
Int m_numExtraBlendTiles; ///<number of blend tiles in m_extraBlendTilePositions.
9090
Int m_numVisibleExtraBlendTiles; ///<number rendered last frame.
91-
Int m_extraBlendTilePositionsSize; //<total size of array including unused memory.
92-
DX8VertexBufferClass **m_vertexBufferTiles; ///<collection of smaller vertex buffers that make up 1 heightmap
93-
char **m_vertexBufferBackup; ///< In memory copy of the vertex buffer data for quick update of dynamic lighting.
91+
Int m_extraBlendTilePositionsSize; //<total size of array including unused memory.
92+
DX8VertexBufferClass *m_vertexBufferTiles; ///<collection of smaller vertex buffers that make up 1 heightmap
93+
VERTEX_FORMAT *m_vertexBufferBackup; ///< In memory copy of the vertex buffer data for quick update of dynamic lighting.
9494
Int m_originX; ///< Origin point in the grid. Slides around.
9595
Int m_originY; ///< Origin point in the grid. Slides around.
9696
DX8IndexBufferClass *m_indexBuffer; ///<indices defining triangles in a VB tile.
@@ -100,15 +100,16 @@ class HeightMapRenderObjClass : public BaseHeightMapRenderObjClass
100100
Int m_numBlockColumnsInLastVB;///<a VB tile may be partially filled, this indicates how many 2x2 vertex blocks are filled.
101101
Int m_numBlockRowsInLastVB;///<a VB tile may be partially filled, this indicates how many 2x2 vertex blocks are filled.
102102

103-
103+
DX8VertexBufferClass *getVertexBufferTile(Int x, Int y);
104+
VERTEX_FORMAT *getVertexBufferBackup(Int x, Int y);
104105
UnsignedInt doTheDynamicLight(VERTEX_FORMAT *vb, VERTEX_FORMAT *vbMirror, Vector3*light, Vector3*normal, W3DDynamicLight *pLights[], Int numLights);
105106
Int getXWithOrigin(Int x);
106107
Int getYWithOrigin(Int x);
107108
///update vertex diffuse color for dynamic lights inside given rectangle
108-
Int updateVBForLight(DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights);
109-
Int updateVBForLightOptimized(DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights);
109+
Int updateVBForLight(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights);
110+
Int updateVBForLightOptimized(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights);
110111
///update vertex buffer vertices inside given rectangle
111-
Int updateVB(DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator);
112+
Int updateVB(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator);
112113
///upate vertex buffers associated with the given rectangle
113114
void initDestAlphaLUT(void); ///<initialize water depth LUT stored in m_destAlphaTexture
114115
void renderTerrainPass(CameraClass *pCamera); ///< renders additional terrain pass.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ typedef std::vector<ICoord2D> VecICoord2D;
4242
/** MapObject class
4343
Not ref counted. Do not store pointers to this class. */
4444

45-
#define VERTEX_BUFFER_TILE_LENGTH 32 //tiles of side length 32 (grid of 33x33 vertices).
45+
#define VERTEX_BUFFER_TILE_LENGTH 32 //tiles of side length 32 (grid of 33x33 vertices).
46+
#define VERTS_IN_BLOCK_ROW (VERTEX_BUFFER_TILE_LENGTH + 1)
47+
#define HEIGHTMAP_VERTEX_NUM (VERTEX_BUFFER_TILE_LENGTH * 2 * VERTEX_BUFFER_TILE_LENGTH * 2)
48+
#define HEIGHTMAP_POLYGON_NUM (VERTEX_BUFFER_TILE_LENGTH * VERTEX_BUFFER_TILE_LENGTH * 2)
4649

4750
#define K_MIN_HEIGHT 0
4851
#define K_MAX_HEIGHT 255

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

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,18 @@ inline Int IABS(Int x) { if (x>=0) return x; return -x;};
125125
void HeightMapRenderObjClass::freeIndexVertexBuffers(void)
126126
{
127127
REF_PTR_RELEASE(m_indexBuffer);
128-
if (m_vertexBufferTiles) {
129-
for (int i=0; i<m_numVertexBufferTiles; i++)
130-
REF_PTR_RELEASE(m_vertexBufferTiles[i]);
131-
delete[] m_vertexBufferTiles;
132-
m_vertexBufferTiles = nullptr;
133-
}
134-
if (m_vertexBufferBackup) {
135-
for (int i=0; i<m_numVertexBufferTiles; i++)
136-
delete[] m_vertexBufferBackup[i];
137-
delete[] m_vertexBufferBackup;
138-
m_vertexBufferBackup = nullptr;
128+
129+
for (Int i=0; i<m_numVertexBufferTiles; ++i)
130+
{
131+
(m_vertexBufferTiles + i)->~DX8VertexBufferClass();
139132
}
140-
m_numVertexBufferTiles = 0;
133+
::operator delete(m_vertexBufferTiles);
134+
m_vertexBufferTiles = nullptr;
141135

136+
delete[] m_vertexBufferBackup;
137+
m_vertexBufferBackup = nullptr;
138+
139+
m_numVertexBufferTiles = 0;
142140
}
143141

144142
//=============================================================================
@@ -154,6 +152,18 @@ Int HeightMapRenderObjClass::freeMapResources(void)
154152
return 0;
155153
}
156154

155+
//=============================================================================
156+
157+
DX8VertexBufferClass *HeightMapRenderObjClass::getVertexBufferTile(Int x, Int y)
158+
{
159+
return m_vertexBufferTiles + y*m_numVBTilesX+x;
160+
}
161+
162+
//=============================================================================
163+
VERTEX_FORMAT *HeightMapRenderObjClass::getVertexBufferBackup(Int x, Int y)
164+
{
165+
return m_vertexBufferBackup + y*m_numVBTilesX*HEIGHTMAP_VERTEX_NUM + x*HEIGHTMAP_VERTEX_NUM;
166+
}
157167

158168
//=============================================================================
159169
// HeightMapRenderObjClass::doTheDynamicLight
@@ -292,7 +302,7 @@ data is expected to be an array same dimensions as current heightmap
292302
mapped into this VB.
293303
*/
294304
//=============================================================================
295-
Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator)
305+
Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, WorldHeightMap *pMap, RefRenderObjListIterator *pLightsIterator)
296306
{
297307
Int i,j;
298308
Vector3 lightRay[MAX_GLOBAL_LIGHTS];
@@ -312,7 +322,7 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int
312322

313323
DX8VertexBufferClass::WriteLockClass lockVtxBuffer(pVB);
314324
VERTEX_FORMAT *vbHardware = (VERTEX_FORMAT*)lockVtxBuffer.Get_Vertex_Array();
315-
VERTEX_FORMAT *vBase = (VERTEX_FORMAT*)data;
325+
VERTEX_FORMAT *vBase = data;
316326
// Note that we are building the vertex buffer data in the memory buffer, data.
317327
// At the bottom, we will copy the final vertex data for one cell into the
318328
// hardware vertex buffer.
@@ -537,7 +547,7 @@ Int HeightMapRenderObjClass::updateVB(DX8VertexBufferClass *pVB, char *data, Int
537547
/** Update the dynamic lighting values only in a rectangular block of the given Vertex Buffer.
538548
The vertex locations and texture coords are unchanged.
539549
*/
540-
Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights)
550+
Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights)
541551
{
542552

543553
#if (OPTIMIZED_HEIGHTMAP_LIGHTING) // (gth) if optimizations are enabled, jump over to the "optimized" version of this function.
@@ -613,7 +623,7 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d
613623
// The important point is that we can read out of our copy to get the original
614624
// diffuse color, and xyz location. It is VERY SLOW to read out of the
615625
// hardware vertex buffer, possibly worse... jba.
616-
VERTEX_FORMAT *vbMirror = ((VERTEX_FORMAT*)data) + offset;
626+
VERTEX_FORMAT *vbMirror = data + offset;
617627
un0 = mapX-1;
618628
if (un0 < -m_map->getDrawOrgX())
619629
un0=-m_map->getDrawOrgX();
@@ -682,7 +692,7 @@ Int HeightMapRenderObjClass::updateVBForLight(DX8VertexBufferClass *pVB, char *d
682692
}
683693

684694

685-
Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB, char *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights)
695+
Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB, VERTEX_FORMAT *data, Int x0, Int y0, Int x1, Int y1, Int originX, Int originY, W3DDynamicLight *pLights[], Int numLights)
686696
{
687697
Int i,j,k;
688698
Int vn0,un0,vp1,up1;
@@ -768,8 +778,8 @@ Int HeightMapRenderObjClass::updateVBForLightOptimized(DX8VertexBufferClass *pVB
768778
// The important point is that we can read out of our copy to get the original
769779
// diffuse color, and xyz location. It is VERY SLOW to read out of the
770780
// hardware vertex buffer, possibly worse... jba.
771-
VERTEX_FORMAT *vbMirror = ((VERTEX_FORMAT*)data) + offset;
772-
VERTEX_FORMAT *vbaseMirror = ((VERTEX_FORMAT*)data);
781+
VERTEX_FORMAT *vbMirror = data + offset;
782+
VERTEX_FORMAT *vbaseMirror = data;
773783
un0 = mapX-1;
774784
if (un0 < -m_map->getDrawOrgX())
775785
un0=-m_map->getDrawOrgX();
@@ -973,7 +983,6 @@ Int HeightMapRenderObjClass::updateBlock(Int x0, Int y0, Int x1, Int y1, WorldH
973983
}
974984

975985
Int i,j;
976-
DX8VertexBufferClass **pVB;
977986
Int originX,originY;
978987
//step through each vertex buffer that needs updating
979988
for (j=0; j<m_numVBTilesY; j++)
@@ -998,9 +1007,9 @@ Int HeightMapRenderObjClass::updateBlock(Int x0, Int y0, Int x1, Int y1, WorldH
9981007
if (xMin >= xMax) {
9991008
continue;
10001009
}
1001-
pVB=m_vertexBufferTiles+j*m_numVBTilesX+i; //point to correct row/column of vertex buffers
1002-
char **pData = m_vertexBufferBackup+j*m_numVBTilesX+i;
1003-
updateVB(*pVB, *pData, xMin, yMin, xMax, yMax, originX, originY, pMap, pLightsIterator);
1010+
DX8VertexBufferClass *pVB = getVertexBufferTile(i, j);
1011+
VERTEX_FORMAT *pData = getVertexBufferBackup(i, j);
1012+
updateVB(pVB, pData, xMin, yMin, xMax, yMax, originX, originY, pMap, pLightsIterator);
10041013
}
10051014
}
10061015

@@ -1293,8 +1302,7 @@ Int HeightMapRenderObjClass::initHeightData(Int x, Int y, WorldHeightMap *pMap,
12931302
}
12941303

12951304
//Get number of vertex buffers needed to hold current map
1296-
//First round dimensions to next multiple of VERTEX_BUFFER_TILE_LENGTH since that's our
1297-
//blocksize
1305+
//First round dimensions to next multiple of VERTEX_BUFFER_TILE_LENGTH since that's our block size
12981306
m_numVBTilesX=1;
12991307
for (i=VERTEX_BUFFER_TILE_LENGTH+1; i<x;)
13001308
{ i+=VERTEX_BUFFER_TILE_LENGTH;
@@ -1312,18 +1320,16 @@ Int HeightMapRenderObjClass::initHeightData(Int x, Int y, WorldHeightMap *pMap,
13121320
m_numVertexBufferTiles=m_numVBTilesX*m_numVBTilesY;
13131321
m_x=x;
13141322
m_y=y;
1315-
m_vertexBufferTiles = NEW DX8VertexBufferClass*[m_numVertexBufferTiles];
1316-
m_vertexBufferBackup = NEW char *[m_numVertexBufferTiles];
13171323

1318-
Int numVertex = VERTEX_BUFFER_TILE_LENGTH*2*VERTEX_BUFFER_TILE_LENGTH*2;
1324+
m_vertexBufferTiles = (DX8VertexBufferClass*)::operator new(m_numVertexBufferTiles * sizeof(DX8VertexBufferClass));
1325+
m_vertexBufferBackup = NEW VERTEX_FORMAT [m_numVertexBufferTiles * HEIGHTMAP_VERTEX_NUM];
13191326

13201327
for (i=0; i<m_numVertexBufferTiles; i++) {
13211328
#ifdef USE_NORMALS
1322-
m_vertexBufferTiles[i]=NEW_REF(DX8VertexBufferClass,(DX8_FVF_XYZNUV2,numVertex,DX8VertexBufferClass::USAGE_DEFAULT));
1329+
new (&m_vertexBufferTiles[i]) DX8VertexBufferClass(DX8_FVF_XYZNUV2,HEIGHTMAP_VERTEX_NUM,DX8VertexBufferClass::USAGE_DEFAULT);
13231330
#else
1324-
m_vertexBufferTiles[i]=NEW_REF(DX8VertexBufferClass,(DX8_VERTEX_FORMAT,numVertex,DX8VertexBufferClass::USAGE_DEFAULT));
1331+
new (&m_vertexBufferTiles[i]) DX8VertexBufferClass(DX8_VERTEX_FORMAT,HEIGHTMAP_VERTEX_NUM,DX8VertexBufferClass::USAGE_DEFAULT);
13251332
#endif
1326-
m_vertexBufferBackup[i] = NEW char[numVertex*sizeof(VERTEX_FORMAT)];
13271333
}
13281334

13291335
//go with a preset material for now.
@@ -1347,7 +1353,6 @@ void HeightMapRenderObjClass::On_Frame_Update(void)
13471353
{
13481354
BaseHeightMapRenderObjClass::On_Frame_Update();
13491355
Int i,j,k;
1350-
DX8VertexBufferClass **pVB;
13511356
Int originX,originY;
13521357
if (Scene==nullptr) return;
13531358
RTS3DScene *pMyScene = (RTS3DScene *)Scene;
@@ -1516,9 +1521,9 @@ void HeightMapRenderObjClass::On_Frame_Update(void)
15161521
if (!intersect) {
15171522
continue;
15181523
}
1519-
pVB=m_vertexBufferTiles+j*m_numVBTilesX+i; //point to correct row/column of vertex buffers
1520-
char **pData = m_vertexBufferBackup+j*m_numVBTilesX+i;
1521-
updateVBForLight(*pVB, *pData, xMin, yMin, xMax, yMax, originX,originY, enabledLights, numDynaLights);
1524+
DX8VertexBufferClass *pVB = getVertexBufferTile(i, j);
1525+
VERTEX_FORMAT *pData = getVertexBufferBackup(i, j);
1526+
updateVBForLight(pVB, pData, xMin, yMin, xMax, yMax, originX,originY, enabledLights, numDynaLights);
15221527
}
15231528
}
15241529
}
@@ -1874,7 +1879,7 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo)
18741879
if (ndx>=m_numVertexBufferTiles) {
18751880
ndx = 0;
18761881
}
1877-
DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBufferTiles[ndx]);
1882+
DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBufferTiles + ndx);
18781883
VERTEX_FORMAT *vb = (VERTEX_FORMAT*)lockVtxBuffer.Get_Vertex_Array();
18791884
vb = 0;
18801885
}
@@ -2008,11 +2013,7 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo)
20082013
for (j=0; j<m_numVBTilesY; j++)
20092014
for (i=0; i<m_numVBTilesX; i++)
20102015
{
2011-
static int count = 0;
2012-
count++;
2013-
Int numPolys = VERTEX_BUFFER_TILE_LENGTH*VERTEX_BUFFER_TILE_LENGTH*2;
2014-
Int numVertex = (VERTEX_BUFFER_TILE_LENGTH*2)*(VERTEX_BUFFER_TILE_LENGTH*2);
2015-
DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTiles[j*m_numVBTilesX+i]);
2016+
DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTiles + j*m_numVBTilesX+i);
20162017
#ifdef PRE_TRANSFORM_VERTEX
20172018
if (m_xformedVertexBuffer && pass==0) {
20182019
// Note - m_xformedVertexBuffer should only be used for non T&L hardware. jba.
@@ -2031,7 +2032,7 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo)
20312032
}
20322033
#endif
20332034
if (Is_Hidden() == 0) {
2034-
DX8Wrapper::Draw_Triangles( 0,numPolys, 0, numVertex);
2035+
DX8Wrapper::Draw_Triangles(0, HEIGHTMAP_POLYGON_NUM, 0, HEIGHTMAP_VERTEX_NUM);
20352036
}
20362037

20372038
}
@@ -2142,11 +2143,7 @@ void HeightMapRenderObjClass::renderTerrainPass(CameraClass *pCamera)
21422143
for (Int j=0; j<m_numVBTilesY; j++)
21432144
for (Int i=0; i<m_numVBTilesX; i++)
21442145
{
2145-
static int count = 0;
2146-
count++;
2147-
Int numPolys = VERTEX_BUFFER_TILE_LENGTH*VERTEX_BUFFER_TILE_LENGTH*2;
2148-
Int numVertex = (VERTEX_BUFFER_TILE_LENGTH*2)*(VERTEX_BUFFER_TILE_LENGTH*2);
2149-
DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTiles[j*m_numVBTilesX+i]);
2146+
DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTiles + j*m_numVBTilesX+i);
21502147
#ifdef PRE_TRANSFORM_VERTEX
21512148
if (m_xformedVertexBuffer && pass==0) {
21522149
// Note - m_xformedVertexBuffer should only be used for non T&L hardware. jba.
@@ -2165,7 +2162,7 @@ void HeightMapRenderObjClass::renderTerrainPass(CameraClass *pCamera)
21652162
}
21662163
#endif
21672164
if (Is_Hidden() == 0) {
2168-
DX8Wrapper::Draw_Triangles( 0,numPolys, 0, numVertex);
2165+
DX8Wrapper::Draw_Triangles(0, HEIGHTMAP_POLYGON_NUM, 0, HEIGHTMAP_VERTEX_NUM);
21692166
}
21702167
}
21712168
}

Dependencies/Utility/Utility/CppMacros.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,21 @@
3131
#define CPP_11(code)
3232
#define static_assert(expr, msg)
3333
#define constexpr
34+
#define noexcept
3435
#define nullptr 0
3536
#endif
3637

3738
#if __cplusplus >= 201703L
38-
#define NOEXCEPT noexcept
3939
#define REGISTER
4040
#define FALLTHROUGH [[fallthrough]]
4141
#else
42-
#define NOEXCEPT
4342
#define REGISTER register
4443
#define FALLTHROUGH
4544
#endif
4645

4746
// noexcept for methods of IUNKNOWN interface
4847
#if defined(_MSC_VER)
49-
#define IUNKNOWN_NOEXCEPT NOEXCEPT
48+
#define IUNKNOWN_NOEXCEPT noexcept
5049
#else
5150
#define IUNKNOWN_NOEXCEPT
5251
#endif

Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,13 @@ inline VertexFormatXYZNDUV2 * DynamicVBAccessClass::WriteLockClass::Get_Formatte
196196
/**
197197
** DX8VertexBufferClass
198198
** This class wraps a DX8 vertex buffer. Use the lock objects to modify or append to the vertex buffer.
199+
**
200+
** TheSuperHackers @performance Allow placement new and bypass the W3DMemPool to create big buffers.
199201
*/
200202
class DX8VertexBufferClass : public VertexBufferClass
201203
{
202204
W3DMPO_GLUE(DX8VertexBufferClass)
203-
protected:
204-
~DX8VertexBufferClass();
205+
205206
public:
206207
enum UsageType {
207208
USAGE_DEFAULT=0,
@@ -210,11 +211,15 @@ class DX8VertexBufferClass : public VertexBufferClass
210211
USAGE_NPATCHES=4
211212
};
212213

214+
void* operator new(size_t s, void* placement) noexcept { return placement; }
215+
void operator delete(void* p, void* placement) noexcept {}
216+
213217
DX8VertexBufferClass(unsigned FVF, unsigned short VertexCount, UsageType usage=USAGE_DEFAULT);
214218
DX8VertexBufferClass(const Vector3* vertices, const Vector3* normals, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT);
215219
DX8VertexBufferClass(const Vector3* vertices, const Vector3* normals, const Vector4* diffuse, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT);
216220
DX8VertexBufferClass(const Vector3* vertices, const Vector4* diffuse, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT);
217221
DX8VertexBufferClass(const Vector3* vertices, const Vector2* tex_coords, unsigned short VertexCount,UsageType usage=USAGE_DEFAULT);
222+
~DX8VertexBufferClass();
218223

219224
IDirect3DVertexBuffer8* Get_DX8_Vertex_Buffer() { return VertexBuffer; }
220225

Generals/Code/Tools/WorldBuilder/src/WBHeightMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void WBHeightMap::flattenHeights(void) {
9191
static int count = 0;
9292
count++;
9393
Int numVertex = (VERTEX_BUFFER_TILE_LENGTH*2)*(VERTEX_BUFFER_TILE_LENGTH*2);
94-
DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBufferTiles[j*m_numVBTilesX+i]);
94+
DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBufferTiles + j*m_numVBTilesX+i);
9595
VERTEX_FORMAT *vbHardware = (VERTEX_FORMAT*)lockVtxBuffer.Get_Vertex_Array();
9696
Int vtx;
9797
for (vtx=0; vtx<numVertex; vtx++) {

GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DStatusCircle.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
////////////////////////////////////////////////////////////////////////////////
2424

2525
#include "W3DDevice/GameClient/W3DStatusCircle.h"
26+
#include "W3DDevice/GameClient/WorldHeightMap.h"
2627

2728
#include <stdlib.h>
2829
#include <assetmgr.h>
@@ -62,8 +63,6 @@
6263
ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_ENABLE, \
6364
ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) )
6465

65-
#define VERTEX_BUFFER_TILE_LENGTH 32 //tiles of side length 32 (grid of 33x33 vertices).
66-
#define VERTS_IN_BLOCK_ROW (VERTEX_BUFFER_TILE_LENGTH+1)
6766

6867

6968
static ShaderClass detailOpaqueShader(SC_ALPHA);

0 commit comments

Comments
 (0)