async function createIconGeometryFromSVGPath(pathStr) {
const ICON_SIZE = 5;
const ICON_DEPTH = 5
const svgUrl = URL.createObjectURL( new Blob([`<svg><path d="${pathStr}"/></svg>`], { type: 'image/svg+xml' }) );
const loader = new THREE.SVGLoader();
const data = await new Promise(resolve => { loader.load(svgUrl, resolve); });
const shapes = data.paths[0].toShapes(false);
URL.revokeObjectURL(svgUrl);
const shapeBufferGeometry = [];
shapes.forEach(shape =>
shapeBufferGeometry.push(
new THREE.ExtrudeBufferGeometry(shape, { depth: ICON_DEPTH, bevelEnabled: false })
)
);
const iconGeometry = THREE.BufferGeometryUtils.mergeBufferGeometries( shapeBufferGeometry, true );
iconGeometry.computeBoundingSphere();
iconGeometry.scale(
ICON_SIZE / iconGeometry.boundingSphere.radius,
ICON_SIZE / iconGeometry.boundingSphere.radius,
1
);
return iconGeometry;
}