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