updated approach to deps, mod loading, main entrypoints
This commit is contained in:
parent
70f9146a96
commit
19522665b2
21 changed files with 299 additions and 321 deletions
|
|
@ -2,27 +2,24 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
// dep: moto.license
|
||||
// dep: moto.client
|
||||
// dep: moto.broker
|
||||
// dep: moto.space
|
||||
// dep: mesh.util
|
||||
// dep: add.array
|
||||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
gapp.register("mesh.api", [
|
||||
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.client", // dep: moto.client
|
||||
"moto.broker", // dep: moto.broker
|
||||
"moto.space", // dep: moto.space
|
||||
"data.index", // dep: data.index
|
||||
"mesh.tool", // dep: mesh.tool
|
||||
"mesh.util", // dep: mesh.util
|
||||
"add.array", // dep: add.array
|
||||
|
||||
], (root, exports) => {
|
||||
gapp.register("mesh.api", [], (root, exports) => {
|
||||
|
||||
const { Matrix4, Vector3 } = THREE;
|
||||
const { mesh, moto } = root;
|
||||
const { space } = moto;
|
||||
const { util } = mesh;
|
||||
|
||||
let groups = [];
|
||||
const worker = moto.client.fn
|
||||
const groups = [];
|
||||
|
||||
let selected = [];
|
||||
|
||||
const selection = {
|
||||
|
|
@ -628,7 +625,7 @@ const api = exports({
|
|||
}
|
||||
});
|
||||
|
||||
const broker = gapp.broker;
|
||||
const { broker } = gapp;
|
||||
// publish messages when api functions are called
|
||||
broker.wrapObject(selection, 'selection');
|
||||
broker.wrapObject(model, 'model');
|
||||
|
|
|
|||
|
|
@ -2,19 +2,16 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
// dep: moto.broker
|
||||
// dep: mesh.util
|
||||
// dep: mesh.api
|
||||
gapp.register("mesh.build", [], (root, exports) => {
|
||||
|
||||
gapp.register("mesh.build",[
|
||||
"moto.broker", // dep: moto.broker
|
||||
"mesh.util", // dep: mesh.util
|
||||
"mesh.api", // dep: mesh.api
|
||||
]);
|
||||
const { broker } = gapp;
|
||||
const { mesh } = root;
|
||||
const { api, util } = mesh;
|
||||
|
||||
let mesh = self.mesh = self.mesh || {};
|
||||
|
||||
let broker = gapp.broker;
|
||||
let call = broker.send;
|
||||
let { api, util } = mesh;
|
||||
let rad = 180 / Math.PI;
|
||||
let und = undefined;
|
||||
|
||||
|
|
@ -32,7 +29,7 @@ util.download = (data, filename = "mesh-data") => {
|
|||
};
|
||||
|
||||
// add modal dialog functions to api
|
||||
let modal = api.modal = {
|
||||
const modal = api.modal = {
|
||||
show(title, contents) {
|
||||
if (this.info.showing) {
|
||||
throw `modal conflict showing "${title}"`;
|
||||
|
|
@ -118,7 +115,7 @@ let modal = api.modal = {
|
|||
};
|
||||
|
||||
// transient logging window bottom/left
|
||||
let log = api.log = {
|
||||
const log = api.log = {
|
||||
age: 10000, // age out lines more than 10 seconds old
|
||||
|
||||
data: [], // last n messages
|
||||
|
|
@ -601,4 +598,4 @@ function ui_build() {
|
|||
});
|
||||
}
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,22 +2,16 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
|
||||
// dep: moto.license
|
||||
// dep: add.array
|
||||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
gapp.register("mesh.geom", [
|
||||
"moto.license", // dep: moto.license
|
||||
"add.array", // dep: add.array
|
||||
]);
|
||||
gapp.register("mesh.geom", [], (root, exports) => {
|
||||
|
||||
let mesh = self.mesh = self.mesh || {};
|
||||
if (mesh.geom) return;
|
||||
|
||||
let { Matrix4, Matrix3, Vector3, Box3 } = THREE;
|
||||
const { Matrix4, Matrix3, Vector3, Box3 } = THREE;
|
||||
|
||||
// geometry helper functions
|
||||
let geom = mesh.geom = {
|
||||
const geom = exports({
|
||||
|
||||
// given a closed polyline as an expanded point array
|
||||
// return enclosed area with sign indicating winding order
|
||||
|
|
@ -100,6 +94,6 @@ let geom = mesh.geom = {
|
|||
|
||||
return recs;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,27 +2,24 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
// dep: add.array
|
||||
// dep: add.three
|
||||
// dep: moto.license
|
||||
// dep: moto.broker
|
||||
// dep: moto.client
|
||||
// dep: mesh.object
|
||||
// use: mesh.api
|
||||
// use: mesh.model
|
||||
gapp.register("mesh.group", [], (root, exports) => {
|
||||
|
||||
gapp.register("mesh.group", [
|
||||
"add.array", // dep: add.array
|
||||
"add.three", // dep: add.three
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.broker", // dep: moto.broker
|
||||
"mesh.object", // dep: mesh.object
|
||||
"mesh.model", // dep: mesh.model
|
||||
"mesh.api", // dep: mesh.api
|
||||
]);
|
||||
const { mesh, moto } = root;
|
||||
const { Quaternion, Group, Vector3 } = THREE;
|
||||
const { broker } = gapp;
|
||||
const { space } = moto;
|
||||
|
||||
let mesh = self.mesh = self.mesh || {};
|
||||
if (mesh.group) return;
|
||||
|
||||
let { Quaternion, Group, Vector3 } = THREE;
|
||||
let broker = gapp.broker;
|
||||
let call = broker.send;
|
||||
let space = moto.Space;
|
||||
let worker = moto.client.fn;
|
||||
let lookUp = new Vector3(0,0,-1);
|
||||
const call = broker.send;
|
||||
const worker = moto.client.fn;
|
||||
const lookUp = new Vector3(0,0,-1);
|
||||
|
||||
mesh.group = class MeshGroup extends mesh.object {
|
||||
|
||||
|
|
@ -165,4 +162,4 @@ mesh.group = class MeshGroup extends mesh.object {
|
|||
}
|
||||
};
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,26 +2,23 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
// dep: add.array
|
||||
// dep: add.three
|
||||
// dep: moto.license
|
||||
// dep: moto.client
|
||||
// dep: mesh.object
|
||||
// use: mesh.api
|
||||
// use: mesh.util
|
||||
// use: mesh.group
|
||||
gapp.register("mesh.model", [], (root, exports) => {
|
||||
|
||||
gapp.register("mesh.model", [
|
||||
"add.array", // dep: add.array
|
||||
"add.three", // dep: add.three
|
||||
"moto.license", // dep: moto.license
|
||||
"mesh.object", // dep: mesh.object
|
||||
"mesh.group", // dep: mesh.group
|
||||
"mesh.util", // dep: mesh.util
|
||||
"mesh.api", // dep: mesh.api
|
||||
]);
|
||||
const { MeshPhongMaterial, MeshBasicMaterial } = THREE;
|
||||
const { BufferGeometry, BufferAttribute, DoubleSide, Mesh } = THREE;
|
||||
const { mesh, moto } = root;
|
||||
const { space } = moto;
|
||||
|
||||
let mesh = self.mesh = self.mesh || {};
|
||||
if (mesh.model) return;
|
||||
|
||||
let mapp = mesh;
|
||||
let space = moto.Space;
|
||||
let worker = moto.client.fn;
|
||||
let { MeshPhongMaterial, MeshBasicMaterial } = THREE;
|
||||
let { BufferGeometry, BufferAttribute, DoubleSide, Mesh } = THREE;
|
||||
const mapp = mesh;
|
||||
const worker = moto.client.fn;
|
||||
|
||||
/** default materials **/
|
||||
let materials = mesh.material = {
|
||||
|
|
@ -606,4 +603,4 @@ mesh.model = class MeshModel extends mesh.object {
|
|||
|
||||
};
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,23 +2,18 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
// dep: add.three
|
||||
// dep: moto.license
|
||||
// dep: moto.broker
|
||||
// use: mesh.api
|
||||
// use: mesh.util
|
||||
gapp.register("mesh.object", [], (root, exports) => {
|
||||
|
||||
gapp.register("mesh.object", [
|
||||
"add.three", // dep: add.three
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.broker", // dep: moto.broker
|
||||
"mesh.util", // dep: mesh.util
|
||||
"mesh.api", // dep: mesh.api
|
||||
]);
|
||||
const { Matrix4, Vector3, Box3, Box3Helper, Quaternion, Euler } = THREE;
|
||||
const { mesh, moto } = root;
|
||||
const { space } = moto;
|
||||
|
||||
let mesh = self.mesh = self.mesh || {};
|
||||
if (mesh.object) return;
|
||||
|
||||
let space = moto.Space;
|
||||
let worker = moto.client.fn;
|
||||
|
||||
let { Matrix4, Vector3, Box3, Box3Helper, Quaternion, Euler } = THREE;
|
||||
const worker = moto.client.fn;
|
||||
|
||||
// broker updates generated by objects
|
||||
let publish = {
|
||||
|
|
@ -195,4 +190,4 @@ mesh.object = class MeshObject {
|
|||
}
|
||||
};
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,11 +2,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
|
||||
gapp.finalize("mesh.pool", [
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.worker", // dep: moto.worker
|
||||
]);
|
||||
|
||||
})();
|
||||
// dep: moto.license
|
||||
// dep: moto.worker
|
||||
gapp.main("mesh.pool", [], (root) => {
|
||||
// todo
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,17 +2,12 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
|
||||
// dep: ext.earcut
|
||||
gapp.register("mesh.tool", [
|
||||
"mesh.geom", // dep: mesh.geom
|
||||
]);
|
||||
// dep: mesh.geom
|
||||
gapp.register("mesh.tool", [], (root, exports) => {
|
||||
|
||||
let mesh = self.mesh = self.mesh || {};
|
||||
if (mesh.tool) return;
|
||||
|
||||
let geom = mesh.geom;
|
||||
const { mesh } = root;
|
||||
const { geom } = mesh;
|
||||
|
||||
/**
|
||||
* tool for identiying defects and healing them
|
||||
|
|
@ -470,4 +465,4 @@ mesh.tool = class MeshTool {
|
|||
}
|
||||
};
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,25 +2,22 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
|
||||
// dep: moto.license
|
||||
// dep: add.array
|
||||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
gapp.register("mesh.util", [
|
||||
"moto.license", // dep: moto.license
|
||||
"add.array", // dep: add.array
|
||||
]);
|
||||
// use: mesh.api
|
||||
gapp.register("mesh.util", [], (root, exports) => {
|
||||
|
||||
let mesh = self.mesh = self.mesh || {};
|
||||
if (mesh.util) return;
|
||||
const { Matrix4, Matrix3, Vector3, Box3 } = THREE;
|
||||
const { mesh } = root;
|
||||
|
||||
let { Matrix4, Matrix3, Vector3, Box3 } = THREE;
|
||||
|
||||
let deferFn = [];
|
||||
let boundsCache = {};
|
||||
const deferFn = [];
|
||||
const boundsCache = {};
|
||||
|
||||
// util functions augmented in build (download)
|
||||
let util = mesh.util = {
|
||||
const util = exports({
|
||||
|
||||
uuid(segs = 1) {
|
||||
let uid = [];
|
||||
while (segs-- > 0) {
|
||||
|
|
@ -62,7 +59,7 @@ let util = mesh.util = {
|
|||
},
|
||||
|
||||
// @param object {THREE.Object3D | THREE.Object3D[] | MeshObject | MeshObject[]}
|
||||
// @returns bounds modified for moto.Space
|
||||
// @returns bounds modified for moto.space
|
||||
bounds(object) {
|
||||
let box = new Box3();
|
||||
if (Array.isArray(object)) {
|
||||
|
|
@ -258,6 +255,6 @@ let util = mesh.util = {
|
|||
return new VertexNormalsHelper(mesh);
|
||||
}
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,13 +2,15 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
(function() {
|
||||
|
||||
// start worker pool (disabled for now with *0)
|
||||
moto.client.start(`/code/mesh_pool?${gapp.version}`, moto.client.max() * 0);
|
||||
|
||||
// dep: moto.license
|
||||
// dep: ext.clip2
|
||||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
// dep: add.three
|
||||
// dep: add.array
|
||||
// dep: moto.client
|
||||
// dep: moto.worker
|
||||
// dep: mesh.util
|
||||
// dep: geo.base
|
||||
// dep: geo.line
|
||||
// dep: geo.point
|
||||
|
|
@ -17,24 +19,20 @@ moto.client.start(`/code/mesh_pool?${gapp.version}`, moto.client.max() * 0);
|
|||
// dep: geo.bounds
|
||||
// dep: geo.slicer
|
||||
// dep: geo.csg
|
||||
// dep: ext.clip2
|
||||
gapp.finalize("mesh.work", [
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.client", // dep: moto.client
|
||||
"moto.worker", // dep: moto.worker
|
||||
"mesh.tool", // dep: mesh.tool
|
||||
"mesh.util", // dep: mesh.util
|
||||
"add.three", // dep: add.three
|
||||
]);
|
||||
// dep: mesh.tool
|
||||
gapp.main("mesh.work", [], (root) => {
|
||||
|
||||
let { Matrix4, Vector3, BufferGeometry, BufferAttribute, computeFaceNormal } = THREE;
|
||||
const { Matrix4, Vector3, BufferGeometry, BufferAttribute, computeFaceNormal } = THREE;
|
||||
const { mesh, moto } = root;
|
||||
const { client, worker } = moto;
|
||||
const { util } = mesh;
|
||||
const cache = {};
|
||||
|
||||
// compensation for space/world/platform rotation
|
||||
let core_matrix = new Matrix4().makeRotationX(Math.PI / 2);
|
||||
const core_matrix = new Matrix4().makeRotationX(Math.PI / 2);
|
||||
|
||||
let { client, worker } = moto;
|
||||
let { util } = mesh;
|
||||
let cache = {};
|
||||
// start worker pool (disabled for now with *0)
|
||||
client.start(`/code/mesh_pool?${gapp.version}`, client.max() * 0);
|
||||
|
||||
function log(msg) {
|
||||
return worker.publish("mesh.log", msg);
|
||||
|
|
@ -445,4 +443,4 @@ worker.bindObject({
|
|||
|
||||
worker.ready();
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue