wave = {
const loader = new THREE.SVGLoader();
const envMapUrl = await FileAttachment("ocean-1-4K@1.jpg").url();
return new Promise((resolve) =>
loader.load(chartSVGLoader, function (data) {
const paths = data.paths;
const group = new THREE.Group();
for (let i = 0; i < paths.length; i++) {
const path = paths[i];
const loader = new THREE.TextureLoader();
const oceanEnvMap = loader.load(envMapUrl, (texture) => {
texture.mapping = THREE.EquirectangularReflectionMapping;
texture.encoding = THREE.sRGBEncoding;
});
const material = new THREE.MeshPhysicalMaterial({
color: 0xffffff,
metalness: 1,
roughness: 0.2,
transparent: true,
opacity: 0.8,
envMap: oceanEnvMap
});
const extrudeSettings = {
steps: 2,
depth: 32,
bevelEnabled: true,
bevelThickness: 5,
bevelSize: 10,
bevelOffset: 0,
bevelSegments: 3
};
const shapes = THREE.SVGLoader.createShapes(path);
for (let j = 0; j < shapes.length; j++) {
const shape = shapes[j];
const geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings);
const mesh = new THREE.Mesh(geometry, material);
group.add(mesh);
}
group.scale.set(0.1, 0.1, 0.1);
}
for (var i = scene.children.length - 1; i >= 0; i--) {
const obj = scene.children[i];
scene.remove(obj);
}
scene.add(group);
resolve(group);
})
);
}