我有一个 BufferGeometry 从中提取边缘并显示线条:
const geometry = new THREE.BufferGeometry();
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
const edges = new THREE.EdgesGeometry(geometry);
const line = new THREE.LineSegments(edges, new THREE.LineBasicMaterial({ color: 0xc4eaff }));
scene.add(line);
现在我有一个相当复杂的形状。此形状中不存在提取的边缘(见下图)。我的第一个想法是,我的形状中可能有小孔,但是当我显示整个网格时,我看不到任何孔。
有没有人知道为什么会这样?
线段:
网:
如果需要,这里是显示网格的代码:
const geometry = new THREE.BufferGeometry();
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
const mesh = new THREE.Mesh(geometry, new THREE.MeshBasicMaterial({color: 0x77a6f2, side: THREE.DoubleSide}));
scene.add(mesh);
带有 LineSegments 覆盖的网格(由于可见性,只有一部分):