update three.js. extract inner funcs from init. fix cache on windows. update clipper

This commit is contained in:
Stewart Allen 2020-03-16 23:57:14 -04:00
commit a13cdc309f
9 changed files with 8752 additions and 1125 deletions

View file

@ -104,7 +104,7 @@
THREE.Geometry.fromVertices = function(vertices) {
var geometry = new THREE.BufferGeometry();
geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
return geometry;
};

7629
js/ext-clip2.js Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -252,14 +252,14 @@ var gs_kiri_widget = exports;
*/
PRO.loadVertices = function(vertices) {
if (this.mesh) {
this.mesh.geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));
this.mesh.geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
this.mesh.geometry.computeFaceNormals();
this.mesh.geometry.computeVertexNormals();
this.points = null;
return this;
} else {
var geometry = new THREE.BufferGeometry();
geometry.addAttribute('position', new THREE.BufferAttribute(vertices, 3));
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3));
return this.loadGeometry(geometry);
}
};
@ -430,7 +430,7 @@ var gs_kiri_widget = exports;
this.bounds = null;
this.setWireframe(false);
this.clearSlices();
mesh.geometry.applyMatrix(new THREE.Matrix4().makeScale(x, y, z));
mesh.geometry.applyMatrix4(new THREE.Matrix4().makeScale(x, y, z));
this.center();
scale.x *= (x || 1.0);
scale.y *= (y || 1.0);
@ -447,7 +447,7 @@ var gs_kiri_widget = exports;
this.bounds = null;
this.setWireframe(false);
this.clearSlices();
this.mesh.geometry.applyMatrix(new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0)));
this.mesh.geometry.applyMatrix4(new THREE.Matrix4().makeRotationFromEuler(new THREE.Euler(x || 0, y || 0, z || 0)));
this.center();
let rot = this.orient.rot;
rot.x += (x || 0);

View file

@ -19,8 +19,8 @@ if (debug) {
try {
[
"license",
"ext-n3d",
"ext-clip",
"ext-n3d", // for math/geometry only
"ext-clip2",
"add-array",
"add-three",
"geo",

View file

@ -65,7 +65,7 @@ self.kiri.license = exports.LICENSE;
viewMode = VIEWS.ARRANGE,
layoutOnAdd = true,
local = SETUP.local,
mouseMoved = false,
// mouseMoved = false,
camStock = null,
camTopZ = 0,
topZ = 0,
@ -199,10 +199,10 @@ self.kiri.license = exports.LICENSE;
set: setMode,
switch: switchMode
},
mouse : {
moved : function() { return mouseMoved },
movedSet : function(b) { mouseMoved = b }
},
// mouse : {
// moved : function() { return mouseMoved },
// movedSet : function(b) { mouseMoved = b }
// },
opacity,
print: {
get: function() { return currentPrint },
@ -1814,14 +1814,12 @@ self.kiri.license = exports.LICENSE;
UI.ctrlRight.style.display = show ? 'block' : 'none';
}
SPACE.addEventListener(DOC, 'DOMContentLoaded', function () { KIRI.init() }, false);
SPACE.addEventListener(WIN, 'mousemove', function() { mouseMoved = true });
// prevent safari from exiting full screen mode
DOC.onkeydown = function (evt) { if (evt.keyCode == 27) evt.preventDefault() }
// run optional module functions
// run optional module functions NOW before kiri-init has run
if (Array.isArray(self.kirimod)) {
kirimod.forEach(function(mod) { mod(kiri.api) });
}
})();

View file

@ -92,10 +92,7 @@ function lastmod(path) {
* @returns {*}
*/
function getCachedFile(filePath, cpath, fn) {
let cachePath = ".cache/" + cpath
.replace(/\//g,'_')
.replace(/\\/g,'_')
.replace(/:/g,'_'),
let cachePath = ".cache/" + cpath.replace(/\//g,'_'),
cached = fileCache[filePath],
now = time();
@ -185,12 +182,9 @@ function concatCode(array) {
filepath;
array.forEach((file, index) => {
if (file.charAt(0) === "/" || file.indexOf(":\\") > 0) {
if (file.charAt(0) === "/") {
filepath = file;
cachepath = "js_mod" + file
.replace(/\//g,'_')
.replace(/\\/g,'_')
.replace(/:/g,'_');
cachepath = "js_mod" + file.replace(/\//g,'_');
array[index] = cachepath.substring(3).replace('.js','');
fileMap[cachepath.replace("js_","js/")] = filepath;
} else {
@ -797,7 +791,7 @@ let ver = require('../js/license.js'),
script = {
kiri : [
"license",
"ext-clip",
// "ext-clip2",
"ext-tween",
"ext-fsave",
"add-array",
@ -857,7 +851,7 @@ let ver = require('../js/license.js'),
work : [
"license",
"ext-n3d",
"ext-clip",
"ext-clip2",
"add-array",
"add-three",
"geo",

View file

@ -2,9 +2,10 @@
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix
* `C` hide the bed with a checkbox? indication of part outside printable area?
* `B` restore settings should restore all mode/device/settings
* `C` set page background color? or dark mode?
* `C` better small screen support (on screen button for hiding side panels, compact selectors)
* `F` implement an in-app bug reporting system
* `F` widget general add-ons (fdm supports, cam tabs)
* `F` extend mesh object to store raw + annotations (rot,scale,pos)
* share raw data w/ dups, encode/decode
@ -39,12 +40,14 @@
# CAM
* `B` import scale off when units are NOT set to "mm"
* `B` fix zooming, workspace thickness for larger workspaces
* `B` fails in pancaking (clone) when there are no sliced layers (like z bottom too high)
* `B` outside cutting direction in roughing mode inverted
* `F` send gcode to cncjs
* `F` trapezoidal tabs (in the Z axis)
* `F` lead-in milling
* `F` ease-in and ease-out especially on tab cut-out start/stop
* `F` implement z line-only follows for ball/taper
* `F` add option to spiral in vs out (optimal tool life) vs mixed (optimal path)
* `F` add endmill spiral direction to fully respect climb vs conventional
* `F` add tapered ball mills

View file

@ -37,7 +37,7 @@
"n3d-threejs": "^72.0.0",
"pixi.js": "^4.8.9",
"serve-static": "^1.14.1",
"three": "^0.96.0",
"three": "^0.114.0",
"tween.js": "^0.14.0",
"uglify-es": "^3.3.10",
"validator": "^8.2.0",