Messing with the clipper
This commit is contained in:
parent
354f4fef0f
commit
4c5af75d66
13
bim.js
13
bim.js
@ -30,7 +30,6 @@ BIM.init = function (container) {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {HTMLElement} container The scene container element
|
* @param {HTMLElement} container The scene container element
|
||||||
* @returns {OBC.Components}
|
|
||||||
*/
|
*/
|
||||||
BIM.createScene = function (container) {
|
BIM.createScene = function (container) {
|
||||||
this.init(container);
|
this.init(container);
|
||||||
@ -42,6 +41,18 @@ BIM.createScene = function (container) {
|
|||||||
// (zoom_level, position)
|
// (zoom_level, position)
|
||||||
this.world.camera.controls.setLookAt(15, 15, 15, 0, 0, 0);
|
this.world.camera.controls.setLookAt(15, 15, 15, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @param {HTMLElement} container The scene container element
|
||||||
|
*/
|
||||||
|
BIM.activateClipper = function () {
|
||||||
|
const casters = this.components.get(OBC.Raycasters);
|
||||||
|
casters.get(this.world);
|
||||||
|
// Enable plane clipper
|
||||||
|
const clipper = this.components.get(OBC.Clipper);
|
||||||
|
clipper.enabled = true;
|
||||||
|
clipper.create(this.world);
|
||||||
|
clipper.visible = true;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @todo Serve web-ifc.wasm locally via AJAX
|
* @todo Serve web-ifc.wasm locally via AJAX
|
||||||
* @param {ArrayBuffer} buffer The uploaded IFC file
|
* @param {ArrayBuffer} buffer The uploaded IFC file
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<div class="column is-full">
|
<div class="column is-full">
|
||||||
<div id="scene"></div>
|
<div id="scene"></div>
|
||||||
<div id="ui" data-theme="light">
|
<div id="ui" data-theme="light">
|
||||||
<div class="file ml-4">
|
<div class="file ml-4 mt-4 is-link">
|
||||||
<label class="file-label">
|
<label class="file-label">
|
||||||
<input class="file-input"
|
<input class="file-input"
|
||||||
type="file"
|
type="file"
|
||||||
@ -51,7 +51,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<aside class="menu ml-4">
|
<aside class="menu ml-4">
|
||||||
<p class="menu-label">Proprietà IFC (selezione)</p>
|
<p class="menu-label is-size-6">Proprietà IFC (selezione)</p>
|
||||||
<ul class="menu-list">
|
<ul class="menu-list">
|
||||||
<li id="selected-prop"></li>
|
<li id="selected-prop"></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
7
main.js
7
main.js
@ -1,8 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import UI from './ui.js';
|
import UI from './ui.js';
|
||||||
|
import BIM from './bim.js';
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
UI.setScene(document.querySelector('#scene'));
|
const container = document.querySelector('#scene');
|
||||||
const model = UI.ifcLoader();
|
UI.setScene(container);
|
||||||
|
const model = UI.ifcLoader(container);
|
||||||
|
container.ondblclick = () => BIM.activateClipper();
|
||||||
});
|
});
|
3
ui.js
3
ui.js
@ -15,9 +15,10 @@ UI.setScene = function (container) {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the loaded model
|
* Returns the loaded model
|
||||||
|
* @param {HTMLElement} container The container element
|
||||||
* @param {string} btnId The loading button's id
|
* @param {string} btnId The loading button's id
|
||||||
*/
|
*/
|
||||||
UI.ifcLoader = function (btnId = 'load-ifc') {
|
UI.ifcLoader = function (container, btnId = 'load-ifc') {
|
||||||
const loadBtn = document.querySelector(`#${btnId}`);
|
const loadBtn = document.querySelector(`#${btnId}`);
|
||||||
let model = null;
|
let model = null;
|
||||||
loadBtn.onchange = async function () {
|
loadBtn.onchange = async function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user