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
|
* drag knife support
|
||||||
* all
|
* all
|
||||||
* 2d image to 3d part
|
* 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
|
* circular fit/layout when no-layout to prevent collisions
|
||||||
|
|
||||||
## 2.5 roadmap
|
## 2.5 roadmap
|
||||||
|
|
|
||||||
|
|
@ -947,33 +947,33 @@
|
||||||
|
|
||||||
function loadImage(image) {
|
function loadImage(image) {
|
||||||
KIRI.client.image2mesh({settings, png:image}, progress => {
|
KIRI.client.image2mesh({settings, png:image}, progress => {
|
||||||
console.log({i2m_progress: progress});
|
API.show.progress(progress, "converting");
|
||||||
}, output => {
|
}, output => {
|
||||||
console.log({i2m_mesh: output});
|
API.show.progress(0);
|
||||||
let {verts, index, vi, ii} = output;
|
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({
|
platform.add(newWidget().loadVertices(bigv));
|
||||||
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);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,6 @@ KIRI.worker = {
|
||||||
} else {
|
} else {
|
||||||
div = height / bedDepth;
|
div = height / bedDepth;
|
||||||
}
|
}
|
||||||
send.data({progress: { width, height }});
|
|
||||||
let points =
|
let points =
|
||||||
width * height + // grid
|
width * height + // grid
|
||||||
height * 2 + // left/right
|
height * 2 + // left/right
|
||||||
|
|
@ -297,10 +296,20 @@ KIRI.worker = {
|
||||||
index[ii++] = p2;
|
index[ii++] = p2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
send.data({progress: x / width});
|
||||||
}
|
}
|
||||||
verts = verts.slice(0, vi);
|
verts = verts.slice(0, vi);
|
||||||
index = index.slice(0, ii);
|
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