2021-12-27 10:14:21 -05:00
|
|
|
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
|
|
|
|
|
|
|
|
|
"use strict";
|
2021-12-26 13:59:02 -05:00
|
|
|
|
|
|
|
|
function $(id) {
|
|
|
|
|
return document.getElementById(id);
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-26 19:43:48 -05:00
|
|
|
function $d(id, v) {
|
|
|
|
|
$(id).style.display = v;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-26 20:01:56 -05:00
|
|
|
function $h(id, h) {
|
|
|
|
|
$(id).innerHTML = h;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
|
|
let DOC = document,
|
|
|
|
|
WIN = window;
|
|
|
|
|
|
2021-12-26 13:59:02 -05:00
|
|
|
function init() {
|
2021-12-26 20:01:56 -05:00
|
|
|
let moto = self.moto,
|
2021-12-27 16:24:39 -05:00
|
|
|
sky = false,
|
2021-12-26 13:59:02 -05:00
|
|
|
dark = false,
|
|
|
|
|
ortho = false,
|
2021-12-27 16:24:39 -05:00
|
|
|
zoomrev = true,
|
2021-12-26 13:59:02 -05:00
|
|
|
zoomspd = 1,
|
2021-12-26 20:01:56 -05:00
|
|
|
space = moto.Space,
|
|
|
|
|
platform = space.platform;
|
2021-12-26 13:59:02 -05:00
|
|
|
|
2021-12-26 17:17:34 -05:00
|
|
|
// setup default workspace
|
2021-12-27 09:00:27 -05:00
|
|
|
space.sky.showGrid(sky);
|
|
|
|
|
space.sky.setColor(dark ? 0 : 0xffffff);
|
2021-12-26 20:01:56 -05:00
|
|
|
space.init($('container'), delta => { }, ortho);
|
2021-12-27 10:14:21 -05:00
|
|
|
platform.onMove(delta => { });
|
2021-12-26 20:01:56 -05:00
|
|
|
platform.setRound(false);
|
|
|
|
|
platform.setZOff(0.2);
|
2021-12-27 07:34:00 -05:00
|
|
|
platform.setSize(300,300,2.5,300);
|
|
|
|
|
platform.setGrid(25,5,0x999999,0xcccccc);
|
|
|
|
|
platform.setColor(0xcccccc);
|
2021-12-27 10:14:21 -05:00
|
|
|
platform.showVolume(false);
|
2021-12-27 07:34:00 -05:00
|
|
|
platform.opacity(0.3);
|
2021-12-26 20:01:56 -05:00
|
|
|
space.view.setZoom(zoomrev, zoomspd);
|
|
|
|
|
space.useDefaultKeys(true);
|
2021-12-26 19:43:48 -05:00
|
|
|
|
|
|
|
|
// start worker
|
|
|
|
|
moto.client.start(`/code/mesh_work?${gapp.version}`);
|
2021-12-26 20:01:56 -05:00
|
|
|
|
|
|
|
|
// set app version
|
|
|
|
|
$h('app-name', "Mesh:Tool");
|
|
|
|
|
$h('app-vers', gapp.version);
|
|
|
|
|
|
|
|
|
|
// hide loading curtain
|
|
|
|
|
$d('curtain','none');
|
2021-12-26 13:59:02 -05:00
|
|
|
}
|
|
|
|
|
|
2021-12-26 20:01:56 -05:00
|
|
|
// remove version cache bust from url
|
|
|
|
|
WIN.history.replaceState({},'','/mesh/');
|
|
|
|
|
|
|
|
|
|
// setup init() trigger when dom + scripts complete
|
|
|
|
|
DOC.onreadystatechange = function() {
|
|
|
|
|
if (DOC.readyState === 'complete') {
|
2021-12-26 13:59:02 -05:00
|
|
|
init();
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-26 20:01:56 -05:00
|
|
|
|
|
|
|
|
})();
|