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 ...@@ -916,13 +916,30 @@ IMesh* CMeshManipulator::createMeshWelded(IMesh *mesh, f32 tolerance) const
break; break;
} }
// write the buffer's index list // Clean up any degenerate tris
core::array<u16> &Indices = *outIdx; 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); bool drop = false;
for (u32 i=0; i<indexCount; ++i)
{ if (a == b || b == c || a == c)
Indices[i] = redirects[ indices[i] ]; drop = true;
// Open for other checks
if (!drop)
{
Indices.push_back(a);
Indices.push_back(b);
Indices.push_back(c);
}
} }
} }
return clone; 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