From a6412f7bd4f09ce299638afbfd0a6b085e681902 Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 10 Apr 2013 12:36:59 +0200 Subject: [PATCH] render a triangle for a 3 vertice quad fix issue 6214 --- .../Core/VideoCommon/Src/IndexGenerator.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Source/Core/VideoCommon/Src/IndexGenerator.cpp b/Source/Core/VideoCommon/Src/IndexGenerator.cpp index 53a3e4a351..5f95f30884 100644 --- a/Source/Core/VideoCommon/Src/IndexGenerator.cpp +++ b/Source/Core/VideoCommon/Src/IndexGenerator.cpp @@ -98,6 +98,9 @@ template void IndexGenerator::AddList(u32 const numVerts) { WriteTriangle(index + i * 3, index + i * 3 + 1, index + i * 3 + 2); } + u32 remainingVerts = numVerts - numTris*3; + if(remainingVerts) + ERROR_LOG(VIDEO, "AddList: unknown count of vertices found"); } template void IndexGenerator::AddStrip(u32 const numVerts) @@ -186,6 +189,10 @@ template void IndexGenerator::AddFan(u32 numVerts) * 012,023, 456,467 ... * or 120,302, 564,746 * or as strip: 1203, 5647 + * + * Warning: + * A simple triangle have to be rendered for three vertices. + * SMS do this for sun rays */ template void IndexGenerator::AddQuads(u32 numVerts) { @@ -204,6 +211,14 @@ template void IndexGenerator::AddQuads(u32 numVerts) WriteTriangle(index + i * 4, index + i * 4 + 2, index + i * 4 + 3); } } + // three vertices remaining, so render a triangle + u32 remainingVerts = numVerts - numQuads*4; + if(remainingVerts == 3) + { + WriteTriangle(index+numVerts-3, index+numVerts-2, index+numVerts-1); + } + else if(remainingVerts) + ERROR_LOG(VIDEO, "AddQuads: unknown count of vertices found"); } // Lines @@ -216,6 +231,10 @@ void IndexGenerator::AddLineList(u32 numVerts) *Lptr++ = index + i * 2 + 1; ++numL; } + u32 remainingVerts = numVerts - numLines*2; + if(remainingVerts) + ERROR_LOG(VIDEO, "AddLineList: unknown count of vertices found"); + } // shouldn't be used as strips as LineLists are much more common