fix underflow in IndexGenerator::AddFan

fix issue 6282

The Last Story seems to render a fan with two vertices. It is non-sense as it
shouldn't do anything, but the code underflows at (u32)numVerts-3
This commit is contained in:
degasus 2013-05-09 10:17:12 +02:00
parent a031351eb2
commit c7486609fa
1 changed files with 2 additions and 2 deletions

View File

@ -142,7 +142,7 @@ template <bool pr> void IndexGenerator::AddFan(u32 numVerts)
if(pr)
{
for(; i<=numVerts-3; i+=3)
for(; i+3<=numVerts; i+=3)
{
*Tptr++ = index + i - 1;
*Tptr++ = index + i + 0;
@ -153,7 +153,7 @@ template <bool pr> void IndexGenerator::AddFan(u32 numVerts)
numT += 3;
}
for(; i<=numVerts-2; i+=2)
for(; i+2<=numVerts; i+=2)
{
*Tptr++ = index + i - 1;
*Tptr++ = index + i + 0;