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 • 600 B
import n from'sharp';async function c(a,r){for(const e of a.getRoot().listMaterials()){const t=e.getName();if(!t.endsWith(".jpg")&&!t.endsWith(".png")&&!t.endsWith(".jpeg"))continue;const o=await r.get("SELECT img FROM textures WHERE path = ?",[t]);if(!o){console.warn(`No texture with name "${t}" found!`);return}const i=await n(o.img,{limitInputPixels:false}).toFormat("png").toBuffer(),s=a.createTexture().setImage(i).setMimeType("image/png");e.setBaseColorTexture(s),e.setAlphaMode("MASK");}}export{c as getTextures};//# sourceMappingURL=getTextures.js.map //# sourceMappingURL=getTextures.js.map