我有一个THREE.Geometry对象,它实际上是THREE.Group中所有网格的几何的合并版本。我需要将元数据附加到合并的THREE.Geometry对象中的每个顶点,即mesh-id(来自组)等。
目标是附加此元数据并在合并几何时保持其完整性。
private merge(groupObject: any): THREE.Geometry {
const editableGroupObject = _.cloneDeep(groupObject);
const mergedGeometry = new THREE.Geometry();
const uniqueMaterials: THREE.Material[] = [];
for (const childMesh of editableGroupObject.children) {
mergedGeometry.merge(childMesh.geometry);
}
return mergedGeometry;
}