diff --git a/src/mode/cam/animate.js b/src/mode/cam/animate.js
index 29865a28..f36a22d2 100644
--- a/src/mode/cam/animate.js
+++ b/src/mode/cam/animate.js
@@ -29,6 +29,7 @@ kiri.loader.push(function() {
UC.newButton(null,play,{icon:''}),
UC.newButton(null,pause,{icon:''})
]);
+ play();
});
};
@@ -38,7 +39,7 @@ kiri.loader.push(function() {
}
if (data.mesh_add) {
const { id, ind, pos } = data.mesh_add;
- addMesh(id, ind, pos);
+ meshAdd(id, ind, pos);
}
if (data.mesh_del) {
deleteMesh(data.mesh_del);
@@ -50,9 +51,12 @@ kiri.loader.push(function() {
mesh.position.y = pos.y;
mesh.position.z = pos.z;
}
+ if (data.mesh_update) {
+ meshUpdates(data.id, data.mesh_update);
+ }
}
- function addMesh(id, ind, pos) {
+ function meshAdd(id, ind, pos) {
const geo = new THREE.BufferGeometry();
geo.setAttribute('position', new THREE.BufferAttribute(pos, 3));
geo.setIndex(new THREE.BufferAttribute(new Uint16Array(ind), 1));
@@ -66,8 +70,15 @@ kiri.loader.push(function() {
meshes[id] = mesh;
}
- function updateMesh(id) {
-
+ function meshUpdates(id, updates) {
+ const mesh = meshes[id];
+ const mpos = mesh.geometry.attributes.position;
+ for (let i=0, il=updates.length; i