more debugging. fix version in kiri workers
This commit is contained in:
parent
9b77c837e3
commit
ec61c9ed22
5 changed files with 22 additions and 23 deletions
|
|
@ -21,6 +21,8 @@ let BASE = self.base,
|
|||
minifns = {},
|
||||
miniseq = 0;
|
||||
|
||||
KIRI.version = gapp.version;
|
||||
|
||||
// catch clipper alerts and convert to console messages
|
||||
self.alert = function(o) {
|
||||
console.log(o);
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ function space_init(data) {
|
|||
.then(data => {
|
||||
if (data) {
|
||||
console.log({data});
|
||||
m.load(
|
||||
m.reload(
|
||||
// Float32Array.from(data.vertices.toFloat32()),
|
||||
Float32Array.from([...data.v]),
|
||||
Uint32Array.from([...data.f])
|
||||
|
|
|
|||
|
|
@ -90,14 +90,11 @@ mesh.model = class MeshModel extends mesh.object {
|
|||
}
|
||||
|
||||
load(vertices, indices) {
|
||||
this.wireframe(false);
|
||||
let geo = new THREE.BufferGeometry();
|
||||
geo.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
||||
if (indices) geo.setIndex(new THREE.BufferAttribute(indices, 1));
|
||||
geo.computeVertexNormals();
|
||||
// reuse mesh if this is a "reload"
|
||||
let meh = this.mesh || new THREE.Mesh(geo, materials.unselected);
|
||||
meh.geometry = geo;
|
||||
let meh = new THREE.Mesh(geo, materials.unselected);
|
||||
meh.receiveShadow = true;
|
||||
meh.castShadow = true;
|
||||
meh.renderOrder = 1;
|
||||
|
|
@ -105,28 +102,27 @@ mesh.model = class MeshModel extends mesh.object {
|
|||
meh.model = this;
|
||||
// sync data to worker
|
||||
worker.model_load({id: this.id, name: this.file, vertices, indices});
|
||||
// update mesh in group
|
||||
// if (this.group) this.group.update(oldmesh, meh);
|
||||
return meh;
|
||||
}
|
||||
|
||||
optimize() {
|
||||
let ind = THREE.BufferGeometryUtils.mergeVertices(this.mesh.geometry);
|
||||
console.log({geo: this.mesh.geometry, ind});
|
||||
optimize(geo) {
|
||||
let ind = THREE.BufferGeometryUtils.mergeVertices(geo || this.mesh.geometry);
|
||||
console.log({geo: geo || this.mesh.geometry.clone(), ind});
|
||||
return ind;
|
||||
}
|
||||
|
||||
// reload(vertices, indices) {
|
||||
// this.wireframe(false);
|
||||
// let geo = this.mesh.geometry;
|
||||
// geo.attributes.position.array = vertices;
|
||||
// geo.attributes.position.needsUpdate = true;
|
||||
// geo.setAttribute('normal', undefined);
|
||||
// if (indices) {
|
||||
// geo.setIndex(new THREE.BufferAttribute(indices, 1));
|
||||
// }
|
||||
// geo.computeVertexNormals();
|
||||
// worker.model_load({id: this.id, name: this.name, vertices, indices});
|
||||
// }
|
||||
reload(vertices, indices) {
|
||||
this.wireframe(false);
|
||||
let geo = this.mesh.geometry;
|
||||
geo.attributes.position.array = vertices;
|
||||
geo.attributes.position.needsUpdate = true;
|
||||
geo.setAttribute('normal', undefined);
|
||||
if (indices) {
|
||||
geo.setIndex(new THREE.BufferAttribute(indices, 1));
|
||||
}
|
||||
geo.computeVertexNormals();
|
||||
worker.model_load({id: this.id, name: this.name, vertices, indices});
|
||||
}
|
||||
|
||||
get group() {
|
||||
return this._group;
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ mesh.tool = class MeshTool {
|
|||
}
|
||||
vertices = nuvt;
|
||||
this.stats = {cull, dups, faces:faces.length/3};
|
||||
// console.log({stats: this.stats});
|
||||
} else {
|
||||
faces = faces.map(v => v*3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ let model = {
|
|||
debug: false
|
||||
});
|
||||
dbug.log('...imported data');
|
||||
tool.heal();
|
||||
// tool.heal();
|
||||
dbug.log('...healed');
|
||||
dbug.log(tool);
|
||||
return true || tool.newFaces ? {
|
||||
|
|
|
|||
Loading…
Reference in a new issue