diff --git a/notes.md b/notes.md index d18a1ba0..09d62ba4 100644 --- a/notes.md +++ b/notes.md @@ -10,6 +10,7 @@ * drag knife support * all * 2d image to 3d part +* cnc: abandon mapping (tshadow) when z count high (organic) and just use top z * circular fit/layout when no-layout to prevent collisions ## 2.5 roadmap diff --git a/src/kiri/main.js b/src/kiri/main.js index 2a99348f..0a0cc2da 100644 --- a/src/kiri/main.js +++ b/src/kiri/main.js @@ -947,33 +947,33 @@ function loadImage(image) { KIRI.client.image2mesh({settings, png:image}, progress => { - console.log({i2m_progress: progress}); + API.show.progress(progress, "converting"); }, output => { - console.log({i2m_mesh: output}); - let {verts, index, vi, ii} = output; + API.show.progress(0); + let {bigv, verts, index, vi, ii} = output; - console.log({verts, index, vi, ii}); + // let mat = new THREE.MeshPhongMaterial({ + // shininess: 0x101010, + // specular: 0x101010, + // transparent: true, + // opacity: 1, + // color: 0x999999, + // side: THREE.DoubleSide + // }); + // + // let geo = new THREE.BufferGeometry(); + // geo.setAttribute('position', new THREE.BufferAttribute(bigv, 3)); + // // geo.setIndex([...index]); // doesn't like the Uint32Array + // geo.computeFaceNormals(); + // geo.computeVertexNormals(); + // + // let mesh = new THREE.Mesh(geo, mat); + // mesh.castShadow = true; + // mesh.receiveShadow = true; + // + // SPACE.platform.world.add(mesh); - let mat = new THREE.MeshPhongMaterial({ - shininess: 0x101010, - specular: 0x101010, - transparent: true, - opacity: 1, - color: 0x999999, - side: THREE.DoubleSide - }); - - let geo = new THREE.BufferGeometry(); - geo.setAttribute('position', new THREE.BufferAttribute(verts, 3)); - geo.setIndex([...index]); // doesn't like the Uint32Array - geo.computeFaceNormals(); - geo.computeVertexNormals(); - - let mesh = new THREE.Mesh(geo, mat); - mesh.castShadow = true; - mesh.receiveShadow = true; - - SPACE.platform.world.add(mesh); + platform.add(newWidget().loadVertices(bigv)); }); } diff --git a/src/kiri/worker.js b/src/kiri/worker.js index 7a38d76e..f440ca25 100644 --- a/src/kiri/worker.js +++ b/src/kiri/worker.js @@ -253,7 +253,6 @@ KIRI.worker = { } else { div = height / bedDepth; } - send.data({progress: { width, height }}); let points = width * height + // grid height * 2 + // left/right @@ -297,10 +296,20 @@ KIRI.worker = { index[ii++] = p2; } } + send.data({progress: x / width}); } verts = verts.slice(0, vi); index = index.slice(0, ii); - send.done({done: {verts, index, vi, ii}}); + let bigv = new Float32Array(ii * 3); + let bgi = 0; + for (let i=0; i