Fix 'NumVertexIndices' instead of 'NumVertices'

and tidy
This commit is contained in:
Anthony 2021-05-16 21:59:10 +12:00
parent 0453e451f1
commit 867a0b1045
1 changed files with 2 additions and 7 deletions

View File

@ -7375,16 +7375,11 @@ void CxbxDrawPrimitiveUP(CxbxDrawContext &DrawContext)
// Convert quad vertex-count to triangle vertex count :
UINT PrimitiveCount = DrawContext.dwHostPrimitiveCount * TRIANGLES_PER_QUAD;
// Instead of calling WalkIndexBuffer on pQuadToTriangleIndexBuffer,
// we can derive the LowIndex and HighIndexes ourselves here
INDEX16 LowIndex = 0;
INDEX16 HighIndex = (INDEX16)(DrawContext.dwVertexCount - 1);
// Draw indexed triangles instead of quads
HRESULT hRet = g_pD3DDevice->DrawIndexedPrimitiveUP(
/*PrimitiveType=*/D3DPT_TRIANGLELIST,
/*MinVertexIndex=*/LowIndex,
/*NumVertexIndices=*/(HighIndex - LowIndex) + 1,
/*MinVertexIndex=*/0, // Always 0 for converted quadlist data
/*NumVertices=*/DrawContext.dwVertexCount,
PrimitiveCount,
pIndexData,
/*IndexDataFormat=*/D3DFMT_INDEX16,