openbim-components
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -21,2 +21,3 @@ import * as THREE from "three"; | ||
readonly meshes: Map<string, THREE.InstancedMesh<THREE.BufferGeometry, THREE.Material | THREE.Material[]>>; | ||
visibleFragments: Fragment[]; | ||
private readonly previouslyVisibleMeshes; | ||
@@ -23,0 +24,0 @@ private readonly transparentMat; |
@@ -14,2 +14,3 @@ import * as THREE from "three"; | ||
this.meshes = new Map(); | ||
this.visibleFragments = []; | ||
this.previouslyVisibleMeshes = new Set(); | ||
@@ -37,4 +38,5 @@ this.transparentMat = new THREE.MeshBasicMaterial({ | ||
const colors = event.data.colors; | ||
const meshesThatJustDissapeared = new Set(this.previouslyVisibleMeshes); | ||
const meshesThatJustDisappeared = new Set(this.previouslyVisibleMeshes); | ||
this.previouslyVisibleMeshes.clear(); | ||
this.visibleFragments = []; | ||
// Make found meshes visible | ||
@@ -44,5 +46,6 @@ for (const code of colors.values()) { | ||
if (fragment) { | ||
this.visibleFragments.push(fragment); | ||
fragment.mesh.visible = true; | ||
this.previouslyVisibleMeshes.add(fragment.id); | ||
meshesThatJustDissapeared.delete(fragment.id); | ||
meshesThatJustDisappeared.delete(fragment.id); | ||
this.cullEdges(fragment, true); | ||
@@ -52,3 +55,3 @@ } | ||
// Hide meshes that were visible before but not anymore | ||
for (const id of meshesThatJustDissapeared) { | ||
for (const id of meshesThatJustDisappeared) { | ||
const fragment = this.fragment.fragments[id]; | ||
@@ -55,0 +58,0 @@ fragment.mesh.visible = false; |
@@ -9,2 +9,3 @@ import { MeshBasicMaterial } from "three"; | ||
active: boolean; | ||
culledPicking: boolean; | ||
readonly selectionId = "selection"; | ||
@@ -11,0 +12,0 @@ private tempMatrix; |
@@ -11,2 +11,3 @@ import { Matrix4, MeshBasicMaterial } from "three"; | ||
this.active = false; | ||
this.culledPicking = false; | ||
this.selectionId = "selection"; | ||
@@ -28,3 +29,9 @@ this.tempMatrix = new Matrix4(); | ||
return; | ||
const meshes = this.fragments.fragmentMeshes; | ||
let meshes = []; | ||
if (this.culledPicking) { | ||
meshes = this.fragments.culler.visibleFragments.map((x) => x.mesh); | ||
} | ||
else { | ||
meshes = this.fragments.fragmentMeshes; | ||
} | ||
const result = this.components.raycaster.castRay(meshes); | ||
@@ -31,0 +38,0 @@ if (!result) { |
{ | ||
"name": "openbim-components", | ||
"main": "dist/index.js", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"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
322534
4737