add mesh.object -- add dependencies to loaders

This commit is contained in:
Stewart Allen 2021-12-29 16:49:15 -05:00
commit 77eae604c7
10 changed files with 63 additions and 19 deletions

View file

@ -5,6 +5,8 @@
(function() { (function() {
// dep: ext.three // dep: ext.three
// dep: ext.three-bgu
// dep: ext.three-svg
gapp.register('add.three'); gapp.register('add.three');
var MP = THREE.Mesh.prototype, var MP = THREE.Mesh.prototype,

View file

@ -7,6 +7,7 @@
let load = self.load = self.load || {}; let load = self.load = self.load || {};
if (load.TMF) return; if (load.TMF) return;
// dep: ext.jszip
gapp.register('load.3mf'); gapp.register('load.3mf');
load.TMF = { load.TMF = {

View file

@ -7,7 +7,13 @@
let load = self.load = self.load || {}; let load = self.load = self.load || {};
if (load.File) return; if (load.File) return;
gapp.register('load.file'); gapp.register('load.file', [
'load.3mf', // dep: load.3mf
'load.obj', // dep: load.obj
'load.stl', // dep: load.stl
'load.svg', // dep: load.svg
'load.url', // dep: load.url
]);
load.File = { load.File = {
load_data, load_data, load_data, load_data,

View file

@ -7,7 +7,9 @@
let load = self.load = self.load || {}; let load = self.load = self.load || {};
if (load.SVG) return; if (load.SVG) return;
gapp.register('load.svg'); gapp.register('load.svg', [
'add.three', // dep: add.three
]);
load.SVG = { load.SVG = {
parse, parse,

View file

@ -84,7 +84,9 @@ broker.subscribe('space_init', data => {
// add object loader // add object loader
broker.subscribe('space_load', data => { broker.subscribe('space_load', data => {
console.log({space_load: data}); for (let od of data) {
new mesh.object(od);
}
}); });
// remove version cache bust from url // remove version cache bust from url
@ -104,6 +106,8 @@ gapp.finalize("main.mesh", [
"moto.client", // dep: moto.client "moto.client", // dep: moto.client
"moto.broker", // dep: moto.broker "moto.broker", // dep: moto.broker
"moto.space", // dep: moto.space "moto.space", // dep: moto.space
"mesh.object", // dep: mesh.object
"load.file", // dep: load.file
]); ]);
})(); })();

29
src/mesh/object.js Normal file
View file

@ -0,0 +1,29 @@
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
"use strict";
(function() {
gapp.register("mesh.object", [
"add.three", // dep: add.three
"moto.license", // dep: moto.license
"moto.worker", // dep: moto.worker
]);
let mesh = self.mesh = self.mesh || {};
if (mesh.object) return;
mesh.object = class MeshObject {
constructor(data) {
let { file, mesh } = data;
if (!mesh) {
dbug.error(`'${file}' missing mesh data`);
return;
}
console.log({new_mesh_object: data});
}
};
})();

View file

@ -4,9 +4,9 @@
(function() { (function() {
gapp.finalize("mesh.pool", [ gapp.finalize("mesh.pool", [
"moto.license", // dep: moto.license "moto.license", // dep: moto.license
"moto.worker" // dep: moto.worker "moto.worker" // dep: moto.worker
]); ]);
})(); })();

View file

@ -4,14 +4,14 @@
(function() { (function() {
// start worker pool (disabled for now with *0) // start worker pool (disabled for now with *0)
moto.client.start(`/code/mesh_pool?${gapp.version}`, moto.client.max() * 0); moto.client.start(`/code/mesh_pool?${gapp.version}`, moto.client.max() * 0);
// dep: ext.three // dep: ext.three
// dep: ext.three-bgu // dep: ext.three-bgu
gapp.finalize("mesh.work", [ gapp.finalize("mesh.work", [
"moto.license", // dep: moto.license "moto.license", // dep: moto.license
"moto.client" // dep: moto.client "moto.client" // dep: moto.client
]); ]);
})(); })();

View file

@ -6,7 +6,9 @@
let MOTO = self.moto = self.moto || {}; let MOTO = self.moto = self.moto || {};
gapp.register('moto.orbit'); gapp.register('moto.orbit', [
'add.three', // dep: add.three
]);
/** /**
* Adapted from THREE.OrbitControls * Adapted from THREE.OrbitControls

View file

@ -4,10 +4,8 @@
(function() { (function() {
// dep: ext.tween // dep: ext.tween
// dep: ext.three
// dep: ext.three-bgu
// dep: ext.three-svg
gapp.register('moto.space', [ gapp.register('moto.space', [
'add.three', // dep: add.three
'add.array', // dep: add.array 'add.array', // dep: add.array
'moto.orbit' // dep: moto.orbit 'moto.orbit' // dep: moto.orbit
]); ]);