Commit 51567399 authored by hybrid's avatar hybrid

Remove degenerated tris to reduce render job and avoid artifacts. Patch by hendu.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4524 dfc29bdd-3216-0410-991c-e03cc46cb475
parent f4088e7b
......@@ -916,13 +916,30 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
break;
}
// write the buffer's index list
core::array<u16> &Indices = *outIdx;
// Clean up any degenerate tris
core::array<u16> &Indices = *outIdx;
Indices.clear();
Indices.reallocate(indexCount);
for (u32 i = 0; i < indexCount; i+=3)
{
u16 a, b, c;
a = redirects[indices[i]];
b = redirects[indices[i+1]];
c = redirects[indices[i+2]];
Indices.set_used(indexCount);
for (u32 i=0; i<indexCount; ++i)
{
Indices[i] = redirects[ indices[i] ];
bool drop = false;
if (a == b || b == c || a == c)
drop = true;
// Open for other checks
if (!drop)
{
Indices.push_back(a);
Indices.push_back(b);
Indices.push_back(c);
}
}
}
return clone;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment