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OjE,GACPiE,EAAOjE,EAAI,GACXiE,EAAOjE,EAAI,IAGtB,IAAI,QAAsBqE,EAAaG,EAAKC,GAAM,CAC9CF,GAAW,EACX,KACJ,CACJ,CACAnJ,KAAKc,YAAYmE,IAAIiB,EAAI,CACrByC,WACAE,SACAxE,QACA0E,cACAI,aAEJhC,EAASb,SACTtG,KAAKe,gBACT,CACA,kBAAM2E,SACI1F,KAAKE,gBAAgB0B,QAAQ5B,KAAKkB,SACxClB,KAAKkB,QAAU,KACflB,KAAKkB,QAAU,EACnB,CACA,sBAAMsE,GACF,IAAIqB,EAAS7G,KAAKa,kBAAkBiG,OAAO9G,KAAKc,aAC5CgB,EAAO,CAAC,EACZ,IAAK,MAAOoE,GAAI,YAAE6C,EAAW,SAAEI,MAAenJ,KAAKc,YAC/CgB,EAAKoE,GAAM,CAAE6C,cAAaI,kBAExBnJ,KAAKC,mBAAmB2B,QAAQ,CAAEE,OAAM+E,WAE9C/E,EAAO,KACP+E,EAAS,KACT7G,KAAKc,YAAYiG,QACjB/G,KAAKe,eAAiB,CAC1B,EAEJnB,EAA2B2B,KAAO,uCAClC,KAAc+H,aAAahI,IAAI1B,EAA2B2B,K","sources":["webpack://client-app/./node_modules/openbim-components/src/fragments/FragmentIfcStreamer/src/fragment-ifc-stream-converter.js"],"sourcesContent":["import * as WEBIFC from \"web-ifc\";\r\nimport * as THREE from \"three\";\r\nimport * as FRAGS from \"bim-fragment\";\r\nimport { Event, Component } from \"../../../base-types\";\r\nimport { ToolComponent } from \"../../../core\";\r\nimport { IfcStreamingSettings } from \"./streaming-settings\";\r\nimport { isPointInFrontOfPlane, obbFromPoints } from \"../../../utils\";\r\nimport { SpatialStructure } from \"../../FragmentIfcLoader/src/spatial-structure\";\r\nimport { CivilReader } from \"../../FragmentIfcLoader/src/civil-reader\";\r\nimport { IfcMetadataReader } from \"../../FragmentIfcLoader/src/ifc-metadata-reader\";\r\n// TODO: Deduplicate with IfcFragmentLoader\r\nexport class FragmentIfcStreamConverter extends Component {\r\n constructor(components) {\r\n super(components);\r\n this.onGeometryStreamed = new Event();\r\n this.onAssetStreamed = new Event();\r\n this.onProgress = new Event();\r\n this.onIfcLoaded = new Event();\r\n /** {@link Disposable.onDisposed} */\r\n this.onDisposed = new Event();\r\n this.settings = new IfcStreamingSettings();\r\n this.enabled = true;\r\n this._spatialTree = new SpatialStructure();\r\n this._metaData = new IfcMetadataReader();\r\n this._visitedGeometries = new Map();\r\n this._webIfc = new WEBIFC.IfcAPI();\r\n this._streamSerializer = new FRAGS.StreamSerializer();\r\n this._geometries = new Map();\r\n this._geometryCount = 0;\r\n this._civil = new CivilReader();\r\n this._groupSerializer = new FRAGS.Serializer();\r\n this._assets = [];\r\n this._meshesWithHoles = new Set();\r\n this.components.tools.add(FragmentIfcStreamConverter.uuid, this);\r\n this.settings.excludedCategories.add(WEBIFC.IFCOPENINGELEMENT);\r\n }\r\n get() {\r\n return this._webIfc;\r\n }\r\n async dispose() {\r\n this.onIfcLoaded.reset();\r\n this.onGeometryStreamed.reset();\r\n this.onAssetStreamed.reset();\r\n this._webIfc = null;\r\n await this.onDisposed.trigger(FragmentIfcStreamConverter.uuid);\r\n this.onDisposed.reset();\r\n }\r\n async streamFromBuffer(data) {\r\n const before = performance.now();\r\n await this.readIfcFile(data);\r\n await this.streamAllGeometries();\r\n this.cleanUp();\r\n console.log(`Streaming the IFC took ${performance.now() - before} ms!`);\r\n }\r\n async streamFromCallBack(loadCallback) {\r\n const before = performance.now();\r\n await this.streamIfcFile(loadCallback);\r\n await this.streamAllGeometries();\r\n this.cleanUp();\r\n console.log(`Streaming the IFC took ${performance.now() - before} ms!`);\r\n }\r\n async readIfcFile(data) {\r\n const { path, absolute, logLevel } = this.settings.wasm;\r\n this._webIfc.SetWasmPath(path, absolute);\r\n await this._webIfc.Init();\r\n if (logLevel) {\r\n this._webIfc.SetLogLevel(logLevel);\r\n }\r\n this._webIfc.OpenModel(data, this.settings.webIfc);\r\n }\r\n async streamIfcFile(loadCallback) {\r\n const { path, absolute, logLevel } = this.settings.wasm;\r\n this._webIfc.SetWasmPath(path, absolute);\r\n await this._webIfc.Init();\r\n if (logLevel) {\r\n this._webIfc.SetLogLevel(logLevel);\r\n }\r\n this._webIfc.OpenModelFromCallback(loadCallback, this.settings.webIfc);\r\n }\r\n async streamAllGeometries() {\r\n const { minGeometrySize, minAssetsSize } = this.settings;\r\n // Precompute the level to which each item belongs\r\n this._spatialTree.setUp(this._webIfc);\r\n // Get all IFC objects and group them in chunks of specified size\r\n const allIfcEntities = this._webIfc.GetIfcEntityList(0);\r\n const chunks = [[]];\r\n const group = new FRAGS.FragmentsGroup();\r\n const { FILE_NAME, FILE_DESCRIPTION } = WEBIFC;\r\n group.ifcMetadata = {\r\n name: this._metaData.get(this._webIfc, FILE_NAME),\r\n description: this._metaData.get(this._webIfc, FILE_DESCRIPTION),\r\n schema: this._webIfc.GetModelSchema(0) || \"IFC2X3\",\r\n maxExpressID: this._webIfc.GetMaxExpressID(0),\r\n };\r\n let counter = 0;\r\n let index = 0;\r\n for (const type of allIfcEntities) {\r\n if (!this._webIfc.IsIfcElement(type) && type !== WEBIFC.IFCSPACE) {\r\n continue;\r\n }\r\n if (this.settings.excludedCategories.has(type)) {\r\n continue;\r\n }\r\n const result = this._webIfc.GetLineIDsWithType(0, type);\r\n const size = result.size();\r\n for (let i = 0; i < size; i++) {\r\n if (counter > minGeometrySize) {\r\n counter = 0;\r\n index++;\r\n chunks.push([]);\r\n }\r\n const itemID = result.get(i);\r\n chunks[index].push(itemID);\r\n const level = this._spatialTree.itemsByFloor[itemID] || 0;\r\n group.data.set(itemID, [[], [level, type]]);\r\n counter++;\r\n }\r\n }\r\n this._spatialTree.cleanUp();\r\n let nextProgress = 0.01;\r\n let chunkCounter = 0;\r\n for (const chunk of chunks) {\r\n chunkCounter++;\r\n this._webIfc.StreamMeshes(0, chunk, (mesh) => {\r\n this.getMesh(this._webIfc, mesh, group);\r\n });\r\n if (this._geometryCount > minGeometrySize) {\r\n await this.streamGeometries();\r\n }\r\n if (this._assets.length > minAssetsSize) {\r\n await this.streamAssets();\r\n }\r\n const currentProgress = chunkCounter / chunks.length;\r\n if (currentProgress > nextProgress) {\r\n nextProgress += 0.01;\r\n nextProgress = Math.max(nextProgress, currentProgress);\r\n await this.onProgress.trigger(Math.round(nextProgress * 100) / 100);\r\n }\r\n }\r\n // Stream remaining assets and geometries\r\n if (this._geometryCount) {\r\n await this.streamGeometries();\r\n }\r\n if (this._assets.length) {\r\n await this.streamAssets();\r\n }\r\n const { opaque, transparent } = group.geometryIDs;\r\n for (const [id, { index, uuid }] of this._visitedGeometries) {\r\n group.keyFragments.set(index, uuid);\r\n const geometryID = id > 1 ? opaque : transparent;\r\n geometryID.set(id, index);\r\n }\r\n // Delete assets that have no geometric representation\r\n const ids = group.data.keys();\r\n for (const id of ids) {\r\n const [keys] = group.data.get(id);\r\n if (!keys.length) {\r\n group.data.delete(id);\r\n }\r\n }\r\n const matrix = this._webIfc.GetCoordinationMatrix(0);\r\n group.coordinationMatrix.fromArray(matrix);\r\n group.civilData = this._civil.read(this._webIfc);\r\n const buffer = this._groupSerializer.export(group);\r\n await this.onIfcLoaded.trigger(buffer);\r\n group.dispose(true);\r\n }\r\n cleanUp() {\r\n this._webIfc = null;\r\n this._webIfc = new WEBIFC.IfcAPI();\r\n this._visitedGeometries.clear();\r\n this._geometries.clear();\r\n this._assets = [];\r\n this._meshesWithHoles.clear();\r\n }\r\n getMesh(webIfc, mesh, group) {\r\n const size = mesh.geometries.size();\r\n const id = mesh.expressID;\r\n const asset = { id, geometries: [] };\r\n if (mesh.expressID === 664833) {\r\n console.log(\"Heyyy\");\r\n }\r\n for (let i = 0; i < size; i++) {\r\n const geometry = mesh.geometries.get(i);\r\n const geometryID = geometry.geometryExpressID;\r\n // Distinguish between opaque and transparent geometries\r\n const factor = geometry.color.w === 1 ? 1 : -1;\r\n const transpGeometryID = geometryID * factor;\r\n if (!this._visitedGeometries.has(transpGeometryID)) {\r\n if (!this._visitedGeometries.has(geometryID)) {\r\n // This is the first time we see this geometry\r\n this.getGeometry(webIfc, geometryID);\r\n }\r\n // Save geometry for fragment generation\r\n // separating transparent and opaque geometries\r\n const index = this._visitedGeometries.size;\r\n const uuid = THREE.MathUtils.generateUUID();\r\n this._visitedGeometries.set(transpGeometryID, { uuid, index });\r\n }\r\n const geometryData = this._visitedGeometries.get(transpGeometryID);\r\n if (geometryData === undefined) {\r\n throw new Error(\"Error getting geometry data for streaming!\");\r\n }\r\n const data = group.data.get(id);\r\n if (!data) {\r\n throw new Error(\"Data not found!\");\r\n }\r\n data[0].push(geometryData.index);\r\n const { x, y, z, w } = geometry.color;\r\n const color = [x, y, z, w];\r\n const transformation = geometry.flatTransformation;\r\n asset.geometries.push({ color, geometryID, transformation });\r\n }\r\n this._assets.push(asset);\r\n }\r\n getGeometry(webIfc, id) {\r\n const geometry = webIfc.GetGeometry(0, id);\r\n const index = webIfc.GetIndexArray(geometry.GetIndexData(), geometry.GetIndexDataSize());\r\n const vertexData = webIfc.GetVertexArray(geometry.GetVertexData(), geometry.GetVertexDataSize());\r\n const position = new Float32Array(vertexData.length / 2);\r\n const normal = new Float32Array(vertexData.length / 2);\r\n for (let i = 0; i < vertexData.length; i += 6) {\r\n position[i / 2] = vertexData[i];\r\n position[i / 2 + 1] = vertexData[i + 1];\r\n position[i / 2 + 2] = vertexData[i + 2];\r\n normal[i / 2] = vertexData[i + 3];\r\n normal[i / 2 + 1] = vertexData[i + 4];\r\n normal[i / 2 + 2] = vertexData[i + 5];\r\n }\r\n // const bbox = makeApproxBoundingBox(position, index);\r\n const obb = obbFromPoints(position);\r\n const boundingBox = new Float32Array(obb.transformation.elements);\r\n // Simple hole test: see if all triangles are facing away the center\r\n // Using the vertex normal because it's easier\r\n // Geometries with holes are treated as transparent items\r\n // in the visibility test for geometry streaming\r\n // Not perfect, but it will work for most cases and all the times it fails\r\n // are false positives, so it's always on the safety side\r\n const centerArray = [obb.center.x, obb.center.y, obb.center.z];\r\n let hasHoles = false;\r\n for (let i = 0; i < position.length - 2; i += 3) {\r\n const x = position[i];\r\n const y = position[i + 1];\r\n const z = position[i + 2];\r\n const nx = normal[i];\r\n const ny = normal[i + 1];\r\n const nz = normal[i + 2];\r\n const pos = [x, y, z];\r\n const nor = [nx, ny, nz];\r\n if (isPointInFrontOfPlane(centerArray, pos, nor)) {\r\n hasHoles = true;\r\n break;\r\n }\r\n }\r\n this._geometries.set(id, {\r\n position,\r\n normal,\r\n index,\r\n boundingBox,\r\n hasHoles,\r\n });\r\n geometry.delete();\r\n this._geometryCount++;\r\n }\r\n async streamAssets() {\r\n await this.onAssetStreamed.trigger(this._assets);\r\n this._assets = null;\r\n this._assets = [];\r\n }\r\n async streamGeometries() {\r\n let buffer = this._streamSerializer.export(this._geometries);\r\n let data = {};\r\n for (const [id, { boundingBox, hasHoles }] of this._geometries) {\r\n data[id] = { boundingBox, hasHoles };\r\n }\r\n await this.onGeometryStreamed.trigger({ data, buffer });\r\n // Force memory disposal of all created items\r\n data = null;\r\n buffer = null;\r\n this._geometries.clear();\r\n this._geometryCount = 0;\r\n }\r\n}\r\nFragmentIfcStreamConverter.uuid = \"d9999a00-e1f5-4d3f-8cfe-c56e08609764\";\r\nToolComponent.libraryUUIDs.add(FragmentIfcStreamConverter.uuid);\r\n//# sourceMappingURL=fragment-ifc-stream-converter.js.map"],"names":["FragmentIfcStreamConverter","constructor","components","super","this","onGeometryStreamed","onAssetStreamed","onProgress","onIfcLoaded","onDisposed","settings","enabled","_spatialTree","_metaData","_visitedGeometries","Map","_webIfc","_streamSerializer","_geometries","_geometryCount","_civil","_groupSerializer","_assets","_meshesWithHoles","Set","tools","add","uuid","excludedCategories","get","dispose","reset","trigger","streamFromBuffer","data","before","performance","now","readIfcFile","streamAllGeometries","cleanUp","console","log","streamFromCallBack","loadCallback","streamIfcFile","path","absolute","logLevel","wasm","SetWasmPath","Init","SetLogLevel","OpenModel","webIfc","OpenModelFromCallback","minGeometrySize","minAssetsSize","setUp","allIfcEntities","GetIfcEntityList","chunks","group","FILE_NAME","FILE_DESCRIPTION","ifcMetadata","name","description","schema","GetModelSchema","maxExpressID","GetMaxExpressID","counter","index","type","IsIfcElement","has","result","GetLineIDsWithType","size","i","push","itemID","level","itemsByFloor","set","nextProgress","chunkCounter","chunk","StreamMeshes","mesh","getMesh","streamGeometries","length","streamAssets","currentProgress","Math","max","round","opaque","transparent","geometryIDs","id","keyFragments","ids","keys","delete","matrix","GetCoordinationMatrix","coordinationMatrix","fromArray","civilData","read","buffer","export","clear","geometries","expressID","asset","geometry","geometryID","geometryExpressID","transpGeometryID","color","w","getGeometry","generateUUID","geometryData","undefined","Error","x","y","z","transformation","flatTransformation","GetGeometry","GetIndexArray","GetIndexData","GetIndexDataSize","vertexData","GetVertexArray","GetVertexData","GetVertexDataSize","position","Float32Array","normal","obb","boundingBox","elements","centerArray","center","hasHoles","pos","nor","libraryUUIDs"],"sourceRoot":""}