update fdm driver to use gapp.register()

This commit is contained in:
Stewart Allen 2022-02-21 13:27:01 -05:00
commit 47903526b6
6 changed files with 59 additions and 24 deletions

View file

@ -2,11 +2,18 @@
"use strict"; "use strict";
(function() { // dep: add.three
// dep: geo.base
// dep: moto.space
// dep: kiri.api
// dep: kiri.lang
// dep: kiri.consts
// dep: kiri-mode.fdm.driver
gapp.register("kiri-mode.fdm.client", [], (root, exports) => {
const { Quaternion, Matrix4, Vector3, BufferAttribute, BufferGeometryUtils } = THREE; const { Quaternion, Matrix4, Vector3, BufferAttribute, BufferGeometryUtils } = THREE;
const { Mesh, BoxGeometry, MeshPhongMaterial, Raycaster, Euler } = THREE; const { Mesh, BoxGeometry, MeshPhongMaterial, Raycaster, Euler } = THREE;
const { base, kiri, moto } = self; const { base, kiri, moto } = root;
const { util } = base; const { util } = base;
const { api, consts, lang } = kiri; const { api, consts, lang } = kiri;
const { FDM } = kiri.driver; const { FDM } = kiri.driver;
@ -682,4 +689,4 @@ FDM.delbox = delbox;
FDM.addbox = addbox; FDM.addbox = addbox;
FDM.restoreSupports = restoreSupports; FDM.restoreSupports = restoreSupports;
})(); });

View file

@ -2,10 +2,12 @@
"use strict"; "use strict";
(function() { // use: kiri.api
gapp.register("kiri-mode.fdm.driver", [], (root, exports) => {
const { kiri } = self; const { kiri } = root;
const FDM = kiri.driver.FDM = { getRangeParameters }; const { driver } = kiri;
const FDM = driver.FDM = { getRangeParameters };
// shared by client and worker contexts // shared by client and worker contexts
function getRangeParameters(process, index) { function getRangeParameters(process, index) {
@ -29,7 +31,7 @@ function getRangeParameters(process, index) {
} }
// defer loading until client and worker exist // defer loading until client and worker exist
kiri.load(function(api) { kiri.load(api => {
const { client, worker } = kiri; const { client, worker } = kiri;
@ -66,4 +68,4 @@ kiri.load(function(api) {
}); });
})(); });

View file

@ -2,9 +2,13 @@
"use strict"; "use strict";
(function() { // dep: geo.base
// dep: kiri.api
// dep: kiri.util
// dep: kiri-mode.fdm.driver
gapp.register("kiri-mode.fdm.export", [], (root, exports) => {
const { base, kiri } = self; const { base, kiri } = root;
const { util, config } = base; const { util, config } = base;
const { FDM } = kiri.driver; const { FDM } = kiri.driver;
const { getRangeParameters } = FDM; const { getRangeParameters } = FDM;
@ -935,4 +939,4 @@ FDM.export = function(print, online, ondone, ondebug) {
} }
}; };
})(); });

View file

@ -2,13 +2,16 @@
"use strict"; "use strict";
(function() { // dep: geo.base
// dep: kiri.api
// dep: kiri-mode.fdm.driver
gapp.register("kiri-mode.fdm.fill", [], (root, exports) => {
const { base, kiri } = self; const { base, kiri } = root;
const { util } = base; const { util } = base;
const DEG2RAD = Math.PI / 180, const DEG2RAD = Math.PI / 180,
FILL = self.kiri.fill = { FILL = kiri.fill = {
hex: fillHexFull, hex: fillHexFull,
grid: fillGrid, grid: fillGrid,
gyroid: fillGyroid, gyroid: fillGyroid,
@ -16,7 +19,7 @@ const DEG2RAD = Math.PI / 180,
linear: fillLinear, linear: fillLinear,
cubic: fillCubic cubic: fillCubic
}, },
CACHE = self.kiri.fill_fixed = { CACHE = kiri.fill_fixed = {
hex: fillHexFull, hex: fillHexFull,
grid: fillGrid, grid: fillGrid,
triangle: fillTriangle triangle: fillTriangle
@ -314,4 +317,4 @@ function fillTriangle(target) {
} }
} }
})(); });

View file

@ -2,9 +2,19 @@
"use strict"; "use strict";
(function() { // dep: geo.base
// dep: geo.paths
// dep: geo.point
// dep: geo.polygons
// dep: kiri.api
// dep: kiri.utils
// dep: kiri.slice
// dep: kiri.consts
// dep: kiri-mode.fdm.driver
// use: kiri.worker
gapp.register("kiri-mode.fdm.prepare", [], (root, exports) => {
const { base, kiri, noop } = self; const { base, kiri, noop } = root;
const { consts, driver, newSlice, utils } = kiri; const { consts, driver, newSlice, utils } = kiri;
const { config, polygons, paths, util, newPoint, newPolygon, Polygon } = base; const { config, polygons, paths, util, newPoint, newPolygon, Polygon } = base;
const { poly2polyEmit, tip2tipEmit } = paths; const { poly2polyEmit, tip2tipEmit } = paths;
@ -1742,4 +1752,4 @@ function color4(rgb, inc, seg) {
} }
} }
})(); });

View file

@ -2,9 +2,18 @@
"use strict"; "use strict";
(function() { // dep: geo.base
// dep: geo.polygons
// dep: kiri.api
// dep: kiri.fill
// dep: kiri.utils
// dep: kiri.consts
// dep: kiri-mode.fdm.driver
// use: add.clip2
// use: add.three
gapp.register("kiri-mode.fdm.slice", [], (root, exports) => {
const { base, kiri, noop } = self; const { base, kiri, noop } = root;
const { consts, driver, fill, fill_fixed, newSlice, utils } = kiri; const { consts, driver, fill, fill_fixed, newSlice, utils } = kiri;
const { config, polygons, util, newPoint } = base; const { config, polygons, util, newPoint } = base;
const { fillArea } = polygons; const { fillArea } = polygons;
@ -1897,4 +1906,4 @@ class Coplanars {
} }
} }
})(); });