add bare-bones geo slicer and wire into stub for mesh rebuilder
This commit is contained in:
parent
ba2755c476
commit
5f11231e9e
7 changed files with 768 additions and 2 deletions
|
|
@ -430,12 +430,16 @@ let tool = {
|
|||
});
|
||||
},
|
||||
|
||||
clean(models = selection.models()) {
|
||||
clean(models) {
|
||||
models = fallback(models);
|
||||
tool.heal(models, { merge: false }).then(() => {
|
||||
api.log.emit('cleaning complete').unpin();
|
||||
api.selection.update();
|
||||
});
|
||||
},
|
||||
|
||||
rebuild(models) {
|
||||
Promise.all(fallback(models).map(m => m.rebuild()));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -297,8 +297,9 @@ function ui_build() {
|
|||
h.div([
|
||||
h.div({ _: "fix", class: "head" }),
|
||||
// h.div({ class: "vsep" }),
|
||||
h.button({ _: 'automatic', onclick: tool.repair }),
|
||||
h.button({ _: 'analyze', onclick: tool.analyze }),
|
||||
h.button({ _: 'repair', onclick: tool.repair }),
|
||||
h.button({ _: 'rebuild', onclick: tool.rebuild }),
|
||||
h.button({ _: 'clean', onclick: tool.clean }),
|
||||
]),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -153,6 +153,15 @@ mesh.model = class MeshModel extends mesh.object {
|
|||
});
|
||||
}
|
||||
|
||||
rebuild() {
|
||||
worker.model_rebuild({
|
||||
matrix: this.matrix,
|
||||
id: this.id
|
||||
}).then(data => {
|
||||
console.log({rebuild: this.od, data});
|
||||
});
|
||||
}
|
||||
|
||||
load(vertices, indices, normals) {
|
||||
let geo = new BufferGeometry();
|
||||
geo.setAttribute('position', new BufferAttribute(vertices, 3));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,14 @@ moto.client.start(`/code/mesh_pool?${gapp.version}`, moto.client.max() * 0);
|
|||
|
||||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
// dep: geo.base
|
||||
// dep: geo.line
|
||||
// dep: geo.point
|
||||
// dep: geo.polygon
|
||||
// dep: geo.polygons
|
||||
// dep: geo.bounds
|
||||
// dep: geo.slicer
|
||||
// dep: ext.clip2
|
||||
gapp.finalize("mesh.work", [
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.client", // dep: moto.client
|
||||
|
|
@ -281,6 +289,18 @@ let model = {
|
|||
faces.push(Math.min(a,b,c) / 3);
|
||||
}
|
||||
return { faces, edges, verts, point };
|
||||
},
|
||||
|
||||
rebuild(data) {
|
||||
let { id, matrix } = data;
|
||||
log(`${id} | rebuilding...`);
|
||||
let points = translate_encode(id, matrix);
|
||||
log(`${id} | ${points.length} points`);
|
||||
base.slice(points, { flat: true, autoDim: true }).then(sliced => {
|
||||
console.log({sliced});
|
||||
log(`${id} | ${sliced.length} slices`);
|
||||
});
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue