@@ -26,6 +26,7 @@ import { dedup, prune } from "@gltf-transform/functions";
2626import { addOBJ } from "../../trees/lib/obj.js" ;
2727import { addGLB } from "../../trees/lib/gltf.js" ;
2828import { generateFlowMap } from '../flowmap.js' ;
29+ import { EXTRA_RESOURCE_PATH } from '../app.js' ;
2930
3031
3132function decodeImage ( data ) {
@@ -71,7 +72,8 @@ async function compressTextures(glbBuffer) {
7172 ktx2 ( {
7273 isUASTC : true ,
7374 generateMipmap : true ,
74- imageDecoder : decodeImage
75+ imageDecoder : decodeImage ,
76+ wasmUrl : path . join ( EXTRA_RESOURCE_PATH , 'basis/basis_encoder.wasm' ) ,
7577 // imageDecoder: async (data) => {
7678 // return decodeImage(data);
7779 // const { info, data: raw } = await sharp(Buffer.from(data))
@@ -157,15 +159,16 @@ export async function exportTreePackage(inputFiles, outputFile) {
157159 ktx2 ( {
158160 isUASTC : true ,
159161 generateMipmap : true ,
160- imageDecoder : decodeImage
162+ imageDecoder : decodeImage ,
163+ wasmUrl : path . join ( EXTRA_RESOURCE_PATH , 'basis/basis_encoder.wasm' ) ,
161164 // imageDecoder: async (data) => {
162- // const { info, data: raw } = await sharp(Buffer.from(data))
163- // .ensureAlpha()
164- // .raw()
165- // .toBuffer({ resolveWithObject: true });
166- // const pixels = new Uint8Array(raw.length);
167- // pixels.set(raw);
168- // return { width: info.width, height: info.height, data: pixels };
165+ // const { info, data: raw } = await sharp(Buffer.from(data))
166+ // .ensureAlpha()
167+ // .raw()
168+ // .toBuffer({ resolveWithObject: true });
169+ // const pixels = new Uint8Array(raw.length);
170+ // pixels.set(raw);
171+ // return { width: info.width, height: info.height, data: pixels };
169172 // }
170173 } )
171174 ) ;
0 commit comments