add mesh.object -- add dependencies to loaders
This commit is contained in:
parent
b5ad39ee08
commit
77eae604c7
10 changed files with 63 additions and 19 deletions
|
|
@ -5,6 +5,8 @@
|
|||
(function() {
|
||||
|
||||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
// dep: ext.three-svg
|
||||
gapp.register('add.three');
|
||||
|
||||
var MP = THREE.Mesh.prototype,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
let load = self.load = self.load || {};
|
||||
if (load.TMF) return;
|
||||
|
||||
// dep: ext.jszip
|
||||
gapp.register('load.3mf');
|
||||
|
||||
load.TMF = {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,13 @@
|
|||
let load = self.load = self.load || {};
|
||||
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_data, load_data,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,9 @@
|
|||
let load = self.load = self.load || {};
|
||||
if (load.SVG) return;
|
||||
|
||||
gapp.register('load.svg');
|
||||
gapp.register('load.svg', [
|
||||
'add.three', // dep: add.three
|
||||
]);
|
||||
|
||||
load.SVG = {
|
||||
parse,
|
||||
|
|
|
|||
|
|
@ -84,7 +84,9 @@ broker.subscribe('space_init', data => {
|
|||
|
||||
// add object loader
|
||||
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
|
||||
|
|
@ -104,6 +106,8 @@ gapp.finalize("main.mesh", [
|
|||
"moto.client", // dep: moto.client
|
||||
"moto.broker", // dep: moto.broker
|
||||
"moto.space", // dep: moto.space
|
||||
"mesh.object", // dep: mesh.object
|
||||
"load.file", // dep: load.file
|
||||
]);
|
||||
|
||||
})();
|
||||
|
|
|
|||
29
src/mesh/object.js
Normal file
29
src/mesh/object.js
Normal 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});
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
(function() {
|
||||
|
||||
gapp.finalize("mesh.pool", [
|
||||
gapp.finalize("mesh.pool", [
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.worker" // dep: moto.worker
|
||||
]);
|
||||
]);
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
(function() {
|
||||
|
||||
// start worker pool (disabled for now with *0)
|
||||
moto.client.start(`/code/mesh_pool?${gapp.version}`, moto.client.max() * 0);
|
||||
// start worker pool (disabled for now with *0)
|
||||
moto.client.start(`/code/mesh_pool?${gapp.version}`, moto.client.max() * 0);
|
||||
|
||||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
gapp.finalize("mesh.work", [
|
||||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
gapp.finalize("mesh.work", [
|
||||
"moto.license", // dep: moto.license
|
||||
"moto.client" // dep: moto.client
|
||||
]);
|
||||
]);
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@
|
|||
|
||||
let MOTO = self.moto = self.moto || {};
|
||||
|
||||
gapp.register('moto.orbit');
|
||||
gapp.register('moto.orbit', [
|
||||
'add.three', // dep: add.three
|
||||
]);
|
||||
|
||||
/**
|
||||
* Adapted from THREE.OrbitControls
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@
|
|||
|
||||
(function() {
|
||||
// dep: ext.tween
|
||||
// dep: ext.three
|
||||
// dep: ext.three-bgu
|
||||
// dep: ext.three-svg
|
||||
gapp.register('moto.space', [
|
||||
'add.three', // dep: add.three
|
||||
'add.array', // dep: add.array
|
||||
'moto.orbit' // dep: moto.orbit
|
||||
]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue