From 7c4d113f137e099904662206231c0ff8568c3fdb Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Sun, 25 Sep 2022 19:07:32 -0400 Subject: [PATCH] fix build volume z for cnc, laser. try new lighting points --- src/kiri/conf.js | 2 ++ src/moto/space.js | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/kiri/conf.js b/src/kiri/conf.js index 82a99955..4253b475 100644 --- a/src/kiri/conf.js +++ b/src/kiri/conf.js @@ -438,6 +438,7 @@ const conf = exports({ bedWidth: 300, bedDepth: 175, bedHeight: 2.5, + maxHeight: 300, originCenter: false, spindleMax: 0, gcodePre: [], @@ -560,6 +561,7 @@ const conf = exports({ bedWidth: 300, bedDepth: 175, bedHeight: 2.5, + maxHeight: 300, gcodePre: [], gcodePost: [], gcodeFExt: "", diff --git a/src/moto/space.js b/src/moto/space.js index 64b03ef4..f7d36c43 100644 --- a/src/moto/space.js +++ b/src/moto/space.js @@ -243,8 +243,8 @@ gapp.register("moto.space", [], (root, exports) => { } } - function addLight(x,y,z,i) { - let l = new THREE.DirectionalLight(0xffffff, i, 0); + function addLight(x, y, z, i, color = 0xffffff) { + let l = new THREE.DirectionalLight(color, i, 0); l.position.set(x,z,y); // let b; l.add(b = new THREE.Mesh( // new THREE.BoxGeometry(1,1,1), @@ -260,19 +260,20 @@ gapp.register("moto.space", [], (root, exports) => { for (let l of lights || []) { SCENE.remove(l); } - // override - x *= 4; y *= 4; z *= 4; + // override Z + z = Math.max(x,y,z); // add new let x0 = -x/2, y0 = -y/2, z0 = 0; let x1 = x/2, y1 = y/2, z1 = z / 2, z2 = z; + lights = [ // over addLight( 0, 0, z2, lightIntensity * 1.2), - addLight( x0, y0, z1, lightIntensity * 2.5), + addLight( x0, y0, z1, lightIntensity * 2.5, 0xeeeeee), addLight( x1, y1, z1, lightIntensity * 2.5), // under addLight( x0, y1, -z1, lightIntensity * 0.5), - addLight( x1, y0, -z1, lightIntensity * 0.5), + addLight( x1, y0, -z1, lightIntensity * 0.5, 0xeeeeee), addLight( 0, 0, -z2, lightIntensity * 0.8), ]; }