openbim-components
Advanced tools
Comparing version 0.0.35 to 0.0.36
@@ -43,3 +43,2 @@ import * as THREE from "three"; | ||
private _clock; | ||
private _updateRequestCallback; | ||
/** | ||
@@ -46,0 +45,0 @@ * The [Three.js renderer](https://threejs.org/docs/#api/en/renderers/WebGLRenderer) |
@@ -36,3 +36,2 @@ import * as THREE from "three"; | ||
this.meshes = []; | ||
this._updateRequestCallback = -1; | ||
this.update = () => { | ||
@@ -44,3 +43,5 @@ const delta = this._clock.getDelta(); | ||
this.tools.update(delta); | ||
this._updateRequestCallback = requestAnimationFrame(this.update); | ||
const renderer = this.renderer.get(); | ||
// Works the same as requestAnimationFrame, but let us use WebXR. | ||
renderer.setAnimationLoop(this.update); | ||
}; | ||
@@ -191,3 +192,2 @@ this._clock = new THREE.Clock(); | ||
dispose() { | ||
cancelAnimationFrame(this._updateRequestCallback); | ||
// TODO: Implement memory disposal for the whole library | ||
@@ -194,0 +194,0 @@ } |
@@ -27,2 +27,3 @@ import * as THREE from "three"; | ||
antialias: true, | ||
alpha: true | ||
}); | ||
@@ -29,0 +30,0 @@ this._renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2)); |
@@ -0,1 +1,2 @@ | ||
import { Fragments } from './fragment'; | ||
export interface ItemGroupSystems { | ||
@@ -15,3 +16,6 @@ [systemName: string]: { | ||
groupSystems: GroupSystems; | ||
fragments: Fragments; | ||
constructor(fragments: Fragments); | ||
add(guid: string, groupsSystems: ItemGroupSystems): void; | ||
setVisibility(systemName: string, groupName: string, visible: boolean): void; | ||
remove(guid: string): void; | ||
@@ -18,0 +22,0 @@ get(filter: { |
export class FragmentGrouper { | ||
constructor() { | ||
constructor(fragments) { | ||
this.groupSystems = { | ||
@@ -7,2 +7,3 @@ category: {}, | ||
}; | ||
this.fragments = fragments; | ||
} | ||
@@ -24,2 +25,10 @@ add(guid, groupsSystems) { | ||
} | ||
setVisibility(systemName, groupName, visible) { | ||
const fragmentsMap = this.groupSystems[systemName][groupName]; | ||
for (const fragmentId in fragmentsMap) { | ||
const fragment = this.fragments.fragments[fragmentId]; | ||
const ids = fragmentsMap[fragmentId]; | ||
fragment.setVisibility(ids, visible); | ||
} | ||
} | ||
remove(guid) { | ||
@@ -26,0 +35,0 @@ for (const systemName in this.groupSystems) { |
@@ -54,3 +54,3 @@ import * as THREE from "three"; | ||
this.updateFragmentHighlight(name, mesh.uuid); | ||
return { id: mesh.uuid, fragment }; | ||
return { id: itemID, fragment }; | ||
} | ||
@@ -57,0 +57,0 @@ highlightByID(name, ids, removePrevious = true) { |
@@ -49,3 +49,3 @@ import * as THREE from "three"; | ||
this.processAllUniqueItems(); | ||
this.saveModelData(webIfc); | ||
await this.saveModelData(webIfc); | ||
return this._model; | ||
@@ -92,3 +92,4 @@ } | ||
const isInstanced = this._settings.instancedCategories.has(categoryID); | ||
if (!isUnique || isInstanced) { | ||
const noFloors = Object.keys(this._spatialStructure.itemsByFloor).length === 0; | ||
if (!isUnique || isInstanced || noFloors) { | ||
this.processInstancedItems(data); | ||
@@ -95,0 +96,0 @@ } |
@@ -96,2 +96,3 @@ import * as THREE from "three"; | ||
opacity: color.w, | ||
side: THREE.DoubleSide | ||
}); | ||
@@ -98,0 +99,0 @@ } |
@@ -25,3 +25,3 @@ import { FragmentLoader } from "bim-fragment/fragment-loader"; | ||
this.loader = new FragmentLoader(); | ||
this.groups = new FragmentGrouper(); | ||
this.groups = new FragmentGrouper(this); | ||
this.properties = new FragmentProperties(); | ||
@@ -28,0 +28,0 @@ this.tree = new FragmentSpatialTree(this.properties); |
{ | ||
"name": "openbim-components", | ||
"main": "dist/index.js", | ||
"version": "0.0.35", | ||
"version": "0.0.36", | ||
"packageManager": "yarn@3.2.1", | ||
@@ -6,0 +6,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
537026
8460