add client/worker sync test

This commit is contained in:
Stewart Allen 2021-12-31 22:11:20 -05:00
commit 650a9b4d68
2 changed files with 31 additions and 0 deletions

View file

@ -52,6 +52,20 @@ mesh.model = class MeshModel extends mesh.object {
return this.mesh;
}
sync() {
moto.client.fn.model_sync({
vertices: this.mesh.geometry.attributes.position.array,
matrix: this.mesh.matrixWorld.elements
}).then(data => {
console.log({data: data[0]});
// mesh.api.group.new([new mesh.model({
// file: "synth",
// mesh: data[0]
// })]);
this.load(data[0]);
});
}
load(vertices, indices) {
let geo = new THREE.BufferGeometry();
if (indices) geo.setIndex(new THREE.BufferAttribute(indices, 1));