Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
The returned arrays can be used directly with Three.js:
const geo = new THREE.BufferGeometry();geo.setAttribute('position', new THREE.BufferAttribute(data.position, 3));geo.setAttribute('normal', new THREE.BufferAttribute(data.normal, 3));geo.setIndex(new THREE.BufferAttribute(data.index, 1)); Copy
const geo = new THREE.BufferGeometry();geo.setAttribute('position', new THREE.BufferAttribute(data.position, 3));geo.setAttribute('normal', new THREE.BufferAttribute(data.normal, 3));geo.setIndex(new THREE.BufferAttribute(data.index, 1));
Convert a ShapeMesh into BufferGeometry-compatible typed arrays.
The returned arrays can be used directly with Three.js: