Fixed a bug which allowed duplicate vertices to get through.

This commit is contained in:
David Williams 2011-05-13 23:30:37 +01:00
parent 19079e97d8
commit f756f764bc

View File

@ -259,12 +259,7 @@ namespace PolyVox
int32_t iIndex = static_cast<int32_t>(rEntry.iIndex);
uint8_t uMaterial = static_cast<uint8_t>(rEntry.uMaterial);
//If we have an existing vertex and the material matches then we can return it.
if((iIndex != -1) && (uMaterial == uMaterialIn))
{
return iIndex;
}
else
if(iIndex == -1)
{
//No vertices matched and we've now hit an empty space. Fill it by creating a vertex.
uint32_t temp = m_meshCurrent->addVertex(PositionMaterial(Vector3DFloat(fX, fY, fZ), uMaterialIn));
@ -276,6 +271,12 @@ namespace PolyVox
return temp;
}
//If we have an existing vertex and the material matches then we can return it.
if(uMaterial == uMaterialIn)
{
return iIndex;
}
}
//If we exit the loop here then apparently all the slots were full but none of