C4 Engine
C4 Engine API Documentation

Mesh::MendMesh

Defined in:  C4Mesh.h
Mends the vertices in each surface of a mesh.
Prototype

void MendMesh(float vertexEpsilon, float normalEpsilon, float texcoordEpsilon);

Parameters
vertexEpsilon The vertex position difference threshold.
normalEpsilon The normal vector difference threshold.
texcoordEpsilon The texture coordinate difference threshold.
Description
The MendMesh function searches for pairs of vertices in the same surface that are within the distance vertexEpsilon of each other, have normal vectors whose dot product is less than 1.0 - normalEpsilon, and whose texture coordinates are each within texcoordEpsilon of each other. When such a pair is found, one of the vertices is changed so that it has exactly the same position, normal, and texture coordinates as the other vertex. If there is no normal array, then only position and texture coordinates are considered.

If the input mesh has a 4D tangent array, then two vertices are considered to be distinct if the w coordinates of the tangents are not the same or the 3D dot product between the tangents is not positive.

The mending operation is ordinarily followed by a call to the Mesh::UnifyMesh function to remove duplicate vertices.
See Also

Mesh::WeldMesh

Mesh::UnifyMesh