C4 Engine
C4 Engine API Documentation

Mesh::UnifyMesh

Defined in:  C4Mesh.h
Unifies duplicate vertices in a mesh.
Prototype

void UnifyMesh(const Mesh *inputMesh);

Parameters
inputMesh The input mesh.
Description
The UnifyMesh function searches for pairs of vertices in the same surface that have identical positions, normal vectors, colors, and texture coordinates. Duplicates are removed, and index data in the primitive array is remapped. If the normal array or color array does not exist, then the unification proceeds without considering normals and/or colors.

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. When the UnifyMesh function returns, the mesh no longer has a tangent array, so the Mesh::BuildTangentArray function must be called to generate a new tangent array for the unified mesh.
See Also

Mesh::WeldMesh

Mesh::MendMesh

Mesh::BuildTangentArray