checkpoint more image work
This commit is contained in:
parent
022cdd0a73
commit
4ff906e3cb
3 changed files with 38 additions and 28 deletions
1
notes.md
1
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
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<ii; i++) {
|
||||
let iv = index[i] * 3;
|
||||
bigv[bgi++] = verts[iv];
|
||||
bigv[bgi++] = verts[iv+1];
|
||||
bigv[bgi++] = verts[iv+2];
|
||||
}
|
||||
// send.done({done: {verts, index, bigv, vi, ii}}, [ bigv.buffer ]);
|
||||
send.done({done: {bigv}}, [ bigv.buffer ]);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue