Add grid; serve WASM locally
This commit is contained in:
parent
207b09cbb8
commit
a9896ad8ce
38
ui.js
38
ui.js
@ -28,8 +28,19 @@ Actions.init = function (container) {
|
||||
components.init();
|
||||
this.world = world;
|
||||
this.components = components;
|
||||
|
||||
return {components, world};
|
||||
}
|
||||
/**
|
||||
* @param {HTMLElement} container The scene container element
|
||||
* @returns {OBC.Components}
|
||||
*/
|
||||
Actions.createScene = function (container) {
|
||||
this.init(container);
|
||||
this.world.scene.setup();
|
||||
// Add a grid to the scene
|
||||
const grids = this.components.get(OBC.Grids);
|
||||
const grid = grids.create(this.world);
|
||||
// (zoom_level, position)
|
||||
this.world.camera.controls.setLookAt(15, 15, 15, 0, 0, 0);
|
||||
}
|
||||
/**
|
||||
* @todo Serve web-ifc.wasm locally via AJAX
|
||||
@ -43,13 +54,11 @@ Actions.loadIfc = async function (buffer) {
|
||||
|
||||
const fragmentIfcLoader = this.components.get(OBC.IfcLoader);
|
||||
// NOTE: loads web-ifc WASM from https://unpkg.com/web-ifc@0.0.53/
|
||||
await fragmentIfcLoader.setup();
|
||||
/*
|
||||
//await fragmentIfcLoader.setup();
|
||||
fragmentIfcLoader.settings.wasm = {
|
||||
path: "./vendor/web-ifc/web-ifc.wasm",
|
||||
path: "./vendor/web-ifc/",
|
||||
absolute: false
|
||||
}
|
||||
*/
|
||||
};
|
||||
// Excludes IFC categories from the fragment
|
||||
const excludedCats = [
|
||||
WEBIFC.IFCTENDONANCHOR,
|
||||
@ -71,19 +80,6 @@ Actions.loadIfc = async function (buffer) {
|
||||
return fragments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} container The scene container element
|
||||
* @returns {OBC.Components}
|
||||
*/
|
||||
Actions.createScene = function (container) {
|
||||
//const {components, world} =
|
||||
this.init(container);
|
||||
|
||||
this.world.scene.setup();
|
||||
this.world.camera.controls.setLookAt(3, 3, 3, 0, 0, 0);
|
||||
|
||||
//return components;
|
||||
}
|
||||
/**
|
||||
* @namespace UI
|
||||
*/
|
||||
@ -94,7 +90,7 @@ const UI = {};
|
||||
* @param {HTMLElement} container The scene container element
|
||||
*/
|
||||
UI.setScene = function (container) {
|
||||
this.components = Actions.createScene(container);
|
||||
Actions.createScene(container);
|
||||
}
|
||||
/**
|
||||
* @param {string} uiContainer The UI div's id
|
||||
|
Loading…
Reference in New Issue
Block a user