Welds a Primitive, merging bitwise identical vertices. When merged and indexed, data is shared more efficiently between vertices. File size can be reduced, and the GPU uses the vertex cache more efficiently.
Example:
import { weldPrimitive, getMeshVertexCount, VertexCountMethod } from '@gltf-transform/functions'; const mesh = document.getRoot().listMeshes() .find((mesh) => mesh.getName() === 'Gizmo'); const srcVertexCount = getMeshVertexCount(mesh, VertexCountMethod.GPU); for (const prim of mesh.listPrimitives()) { weldPrimitive(prim); } const dstVertexCount = getMeshVertexCount(mesh, VertexCountMethod.GPU);
Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.
Welds a Primitive, merging bitwise identical vertices. When merged and indexed, data is shared more efficiently between vertices. File size can be reduced, and the GPU uses the vertex cache more efficiently.
Example:
import { weldPrimitive, getMeshVertexCount, VertexCountMethod } from '@gltf-transform/functions'; const mesh = document.getRoot().listMeshes() .find((mesh) => mesh.getName() === 'Gizmo'); const srcVertexCount = getMeshVertexCount(mesh, VertexCountMethod.GPU); for (const prim of mesh.listPrimitives()) { weldPrimitive(prim); } const dstVertexCount = getMeshVertexCount(mesh, VertexCountMethod.GPU);