add shaped path routing
This commit is contained in:
parent
cbc363d49f
commit
64380b6ef6
4 changed files with 157 additions and 25 deletions
|
|
@ -46,7 +46,7 @@
|
|||
}
|
||||
|
||||
for (const [layer, data] of Object.entries(render.layers)) {
|
||||
const { polys, lines, faces } = data;
|
||||
const { polys, lines, faces, paths } = data;
|
||||
if (polys.length || lines.length) {
|
||||
const mat = new THREE.LineBasicMaterial({ color: data.color.line });
|
||||
const geo = new THREE.Geometry(), vert = geo.vertices;
|
||||
|
|
@ -79,6 +79,29 @@
|
|||
mesh.receiveShadow = true;
|
||||
group.add(mesh);
|
||||
}
|
||||
if (paths.length) {
|
||||
const mat = new THREE.MeshPhongMaterial({
|
||||
transparent: true,
|
||||
shininess: 100,
|
||||
specular: 0x181818,
|
||||
opacity: 1,
|
||||
color: data.color.face,
|
||||
side: THREE.DoubleSide
|
||||
});
|
||||
paths.forEach((path, i) => {
|
||||
const { index, faces, z } = path;
|
||||
const geo = new THREE.BufferGeometry();
|
||||
geo.setAttribute('position', new THREE.BufferAttribute(faces, 3));
|
||||
geo.setIndex(index);
|
||||
geo.computeFaceNormals();
|
||||
geo.computeVertexNormals();
|
||||
const mesh = new THREE.Mesh(geo, mat);
|
||||
mesh.position.z = z;
|
||||
mesh.castShadow = true;
|
||||
mesh.receiveShadow = true;
|
||||
group.add(mesh);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
slice.view.add(group);
|
||||
|
|
|
|||
|
|
@ -124,8 +124,9 @@
|
|||
// sliceAll.push(data.slice);
|
||||
// data.slice.output()
|
||||
// .setLayer("debug", {face: 0xff0000, line: 0})
|
||||
// // .addFlat(POLY.setZ(tshadow.clone(true), data.z), {offset: 1, outline: true});
|
||||
// .addPolys(POLY.setZ(tshadow.clone(true), data.z));
|
||||
// // .addFlats(POLY.setZ(tshadow.clone(true), data.z), {offset: 1, outline: true});
|
||||
// // .addPolys(POLY.setZ(tshadow.clone(true), data.z));
|
||||
// .addPaths(POLY.setZ(tshadow.clone(true), data.z));
|
||||
updateOp(index, total);
|
||||
}, genso: true });
|
||||
let shadowTop = terrain[terrain.length - 1];
|
||||
|
|
|
|||
Loading…
Reference in a new issue