소스 검색

Update IFC Loader (#22352)

Antonio González Viegas 3 년 전
부모
커밋
1dda20c300
4개의 변경된 파일5515개의 추가작업 그리고 4605개의 파일을 삭제
  1. 935 111
      examples/jsm/loaders/IFCLoader.js
  2. 4557 4480
      examples/jsm/loaders/ifc/web-ifc-api.js
  3. BIN
      examples/jsm/loaders/ifc/web-ifc.wasm
  4. 23 14
      examples/webgl_loader_ifc.html

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 935 - 111
examples/jsm/loaders/IFCLoader.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 4557 - 4480
examples/jsm/loaders/ifc/web-ifc-api.js


BIN
examples/jsm/loaders/ifc/web-ifc.wasm


+ 23 - 14
examples/webgl_loader_ifc.html

@@ -69,27 +69,36 @@
 
 				} );
 
-				function selectObject(event) {
-					if (event.button != 0) return;
+				const highlightMaterial = new THREE.MeshPhongMaterial( { color: 0xff00ff, depthTest: false, transparent: true, opacity: 0.3 } );
+
+				function selectObject( event ) {
+
+					if ( event.button != 0 ) return;
 
 					const mouse = new THREE.Vector2();
-					mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
-					mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
+					mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
+					mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
 
 					const raycaster = new THREE.Raycaster();
-					raycaster.setFromCamera(mouse, camera);
+					raycaster.setFromCamera( mouse, camera );
+
+					const intersected = raycaster.intersectObjects( scene.children );
+					if ( intersected.length ) {
 
-					const intersected = raycaster.intersectObjects(scene.children);
-					if (intersected.length){
-						const faceIndex = intersected[0].faceIndex;
-						const id = ifcLoader.getExpressId(faceIndex);
+						const found = intersected[ 0 ];
+						const faceIndex = found.faceIndex;
+						const geometry = found.object.geometry;
+						const id = ifcLoader.ifcManager.getExpressId( geometry, faceIndex );
 
-						ifcLoader.highlightItems([id], scene);
-						const props = ifcLoader.getItemProperties(id, true);
-						console.log(props);
+						const modelID = found.object.modelID;
+						ifcLoader.ifcManager.createSubset( { modelID, ids: [ id ], scene, removePrevious: true, material: highlightMaterial } );
+						const props = ifcLoader.ifcManager.getItemProperties( modelID, id, true );
+						console.log( props );
 						renderer.render( scene, camera );
-					} 
-				}
+			
+		}
+			
+	}
 
 				window.onpointerdown = selectObject;
 

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.