UNPKG

@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 • 948 B
import {createDatabase}from'../database/index.js';import {generateDocument}from'./generateDocument.js';import {writeFile}from'fs/promises';import {getIO}from'./io.js';import s from'sharp';s.concurrency(1),s.cache(false);let o;async function u(e){return o||(o=await createDatabase(e)),o}let t;async function p(){return t||(t=await getIO()),t}process.on("message",async e=>{try{const r=await u(e.databasePath),n=await p(),a=await generateDocument(e.cells,r,n,e.hasAlphaEnabled,e.minVolume,e.resizeFactor);if(!a)return process.send?.(null);await writeFile(e.file,await n.writeBinary(a.document)),process.send?.({localBBox:{min:{x:a.localBBox.min.x,y:a.localBBox.min.y,z:a.localBBox.min.z},max:{x:a.localBBox.max.x,y:a.localBBox.max.y,z:a.localBBox.max.z}},heapUsed:process.memoryUsage().heapUsed});}catch(r){console.error(r),process.send?.(null);}});//# sourceMappingURL=generateDocumentWorker.js.map //# sourceMappingURL=generateDocumentWorker.js.map