function getSymbolMesh(data) {
const group = new THREE.Group();
const scale = 0.01;
const colorDepth = 30;
const outlineDepth = 40;
data.paths.forEach((path, i) => {
const isOutline = true;
console.log(path.color)
const mat = new THREE.MeshPhysicalMaterial({
color: "yellow",
metalness: 0.15,
roughness: 0.1,
transmission: 0.1,
opacity: 0.1,
ior: 1.3,
thickness: 0.3,
envMapIntensity: 0.9,
specularIntensity: 0.5,
exposure: 0.99,
side: THREE.DoubleSide
})
path.toShapes(isOutline).forEach((shape) => {
const geo = new THREE.ExtrudeGeometry(shape, { depth: isOutline ? outlineDepth : colorDepth });
const shapeMesh = new THREE.Mesh(geo, mat);
const shift = (outlineDepth - colorDepth) * scale;
shapeMesh.position.z = isOutline ? 0 : shift / 2;
shapeMesh.scale.set(scale, -scale, scale)
group.add(shapeMesh);
});
});
const box = new THREE.Box3().setFromObject(group);
const groupSize = new THREE.Vector3();
box.getSize(groupSize);
group.children.forEach(item => {
item.position.x = groupSize.x / -2;
item.position.y = groupSize.y / 2;
item.position.z -= groupSize.z / 2;
});
return group;
}