@csi-foxbyte/cityjson-to-3d-tiles
Version:
A Node.js library that converts CityJSON files into Cesium 3D Tiles—complete with automatic texture atlas packing, Basis compression, three LOD levels, and customizable threading.
2 lines • 1.03 kB
JavaScript
import {Logger}from'@gltf-transform/core';import {parentPort}from'worker_threads';import {buildGeometry}from'./buildGeometry.js';import {createDatabase}from'../database/index.js';if(Logger.DEFAULT_INSTANCE=new Logger(Logger.Verbosity.SILENT),!parentPort)throw new Error("Is not being called in a worker context!");let a,i="";const d="+proj=geocent +datum=WGS84 +units=m +no_defs +type=crs";let s=null;parentPort.on("message",async t=>{try{switch(t.type){case "init":a=JSON.parse(t.data.cityJsonRaw),i=t.data.src,s=await createDatabase(t.data.dbFile),parentPort?.postMessage("");break;case "work":try{if(!s)throw new Error("DB Instance not initialized!");const e=await buildGeometry({geometry:a.CityObjects[t.data.id].geometry,vertices:a.vertices,id:t.data.id,cityJson:a,src:i,dest:d,folderPath:t.data.folderPath,appearance:t.data.appearance,noTransform:!1,dbInstance:s});parentPort.postMessage(e);break}catch(e){console.error(e);}}}catch(e){console.error(e);}});//# sourceMappingURL=worker.js.map
//# sourceMappingURL=worker.js.map