fix mirroring. fix cache refresh bug

This commit is contained in:
Stewart Allen 2021-02-14 16:21:51 -05:00
commit 55baeea6c8
2 changed files with 12 additions and 6 deletions

12
app.js
View file

@ -780,10 +780,14 @@ function getCachedFile(file, fn) {
let smod = lastmod(filePath),
cmod = cached.mtime;
if (!smod) throw "missing source file";
if (smod > cmod) cached = null;
cached.lastcheck = now;
if (!smod) {
throw "missing source file";
}
if (smod > cmod) {
cached = null;
} else {
cached.lastcheck = now;
}
}
}

View file

@ -519,12 +519,14 @@
PRO._mirror = function() {
this.setWireframe(false);
this.clearSlices();
this.mesh.applyMatrix4(new THREE.Matrix4().makeScale(-1, 1, 1));
let vert = this.getGeoVertices();
for (let i=0; i<vert.length; i += 3) {
vert[i] = -vert[i];
}
let geo = this.mesh.geometry,
o = this.track;
geo.computeFaceNormals();
geo.computeVertexNormals();
this.mesh.position.x = -this.mesh.position.x;
o.mirror = !o.mirror;
this.modified = true;
};