@sanox/sangine-core 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gen-types.d.ts +59 -21
- package/dist/gen-types.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +101 -78
- package/dist/wasm/basis-decode/snippets/basisu_c_sys-273c0aeb51b100af/wasm/basisu_transcoder.js +2 -0
- package/dist/wasm/basis-decode/snippets/basisu_c_sys-273c0aeb51b100af/wasm/basisu_transcoder.wasm +0 -0
- package/dist/wasm/basis-decode/wasm_basis_decode.a8b7eebd.js +553 -0
- package/dist/wasm/basis-decode/wasm_basis_decode.d.ts +58 -0
- package/dist/wasm/basis-decode/wasm_basis_decode_bg.a8b7eebd.wasm +0 -0
- package/dist/wasm/basis-decode/wasm_basis_decode_bg.wasm.d.ts +16 -0
- package/dist/wasm/sangine/{sangine.df2c068e.js → sangine.c27a2565.js} +909 -819
- package/dist/wasm/sangine/sangine.d.ts +23 -39
- package/dist/wasm/sangine/{sangine_bg.df2c068e.wasm → sangine_bg.c27a2565.wasm} +0 -0
- package/dist/wasm/sangine/sangine_bg.wasm.d.ts +23 -17
- package/dist/wasm/sbo-decode/{wasm_sbo_decode.fa5ceba1.js → wasm_sbo_decode.5c359661.js} +3 -4
- package/dist/wasm/sbo-decode/wasm_sbo_decode_bg.5c359661.wasm +0 -0
- package/dist/wasm-hashes/basis-decode.d.ts +2 -0
- package/dist/wasm-hashes/basis-decode.d.ts.map +1 -0
- package/dist/wasm-hashes/sangine.d.ts +1 -1
- package/dist/wasm-hashes/sbo-decode.d.ts +1 -1
- package/dist/worker/decodeWorkerImpl.d.ts +9 -4
- package/dist/worker/decodeWorkerImpl.d.ts.map +1 -1
- package/dist/worker/pool.d.ts +1 -0
- package/dist/worker/pool.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/wasm/sbo-decode/wasm_sbo_decode_bg.fa5ceba1.wasm +0 -0
package/dist/gen-types.d.ts
CHANGED
|
@@ -9,28 +9,42 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export type DecodeTask = {
|
|
11
11
|
"texture-file": {
|
|
12
|
+
encoding: TextureEncoding;
|
|
13
|
+
/**
|
|
14
|
+
* GPU compression format — matches `TextureCompression` repr:
|
|
15
|
+
* 0 = RGBA8, 1 = ETC2_RGBA8, 2 = ASTC_4×4, 3 = BC7
|
|
16
|
+
*/
|
|
17
|
+
format: number;
|
|
12
18
|
pk: string;
|
|
19
|
+
textureType: TextureTypeEnum;
|
|
20
|
+
url: string;
|
|
13
21
|
};
|
|
14
22
|
} | {
|
|
15
23
|
"model-part-mesh": {
|
|
16
24
|
pk: string;
|
|
25
|
+
url: string;
|
|
17
26
|
};
|
|
18
27
|
};
|
|
19
28
|
/**
|
|
20
29
|
* This interface was referenced by `Schema`'s JSON-Schema
|
|
21
|
-
* via the `definition` "
|
|
30
|
+
* via the `definition` "TextureEncoding".
|
|
22
31
|
*/
|
|
23
|
-
export type
|
|
32
|
+
export type TextureEncoding = "png" | "webp" | "ktx2";
|
|
24
33
|
/**
|
|
25
34
|
* This interface was referenced by `Schema`'s JSON-Schema
|
|
26
|
-
* via the `definition` "
|
|
35
|
+
* via the `definition` "TextureTypeEnum".
|
|
27
36
|
*/
|
|
28
|
-
export type
|
|
37
|
+
export type TextureTypeEnum = "diffuse" | "normal" | "offset";
|
|
29
38
|
/**
|
|
30
39
|
* This interface was referenced by `Schema`'s JSON-Schema
|
|
31
|
-
* via the `definition` "
|
|
40
|
+
* via the `definition` "LightingMode".
|
|
32
41
|
*/
|
|
33
|
-
export type
|
|
42
|
+
export type LightingMode = "static" | "dynamic";
|
|
43
|
+
/**
|
|
44
|
+
* This interface was referenced by `Schema`'s JSON-Schema
|
|
45
|
+
* via the `definition` "LodEnum".
|
|
46
|
+
*/
|
|
47
|
+
export type LodEnum = "very-high" | "high" | "medium" | "low" | "preview" | "preview-low";
|
|
34
48
|
/**
|
|
35
49
|
* This interface was referenced by `Schema`'s JSON-Schema
|
|
36
50
|
* via the `definition` "ObjTypeEnum".
|
|
@@ -97,6 +111,30 @@ export interface IntensityAndTemperature {
|
|
|
97
111
|
intensity: number;
|
|
98
112
|
temperature: number;
|
|
99
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* This interface was referenced by `Schema`'s JSON-Schema
|
|
116
|
+
* via the `definition` "LodContainer".
|
|
117
|
+
*/
|
|
118
|
+
export interface LodContainer {
|
|
119
|
+
lodMeshes: {
|
|
120
|
+
high?: MeshFile;
|
|
121
|
+
low?: MeshFile;
|
|
122
|
+
medium?: MeshFile;
|
|
123
|
+
preview?: MeshFile;
|
|
124
|
+
"preview-low"?: MeshFile;
|
|
125
|
+
"very-high"?: MeshFile;
|
|
126
|
+
};
|
|
127
|
+
materials: string[];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* This interface was referenced by `Schema`'s JSON-Schema
|
|
131
|
+
* via the `definition` "MeshFile".
|
|
132
|
+
*/
|
|
133
|
+
export interface MeshFile {
|
|
134
|
+
pk: string;
|
|
135
|
+
triangles: number;
|
|
136
|
+
url: string;
|
|
137
|
+
}
|
|
100
138
|
/**
|
|
101
139
|
* Distances for rendering in meters
|
|
102
140
|
*
|
|
@@ -122,16 +160,24 @@ export interface Material {
|
|
|
122
160
|
* via the `definition` "Texture".
|
|
123
161
|
*/
|
|
124
162
|
export interface Texture {
|
|
163
|
+
encoding: TextureEncoding;
|
|
125
164
|
name: string;
|
|
126
165
|
resolutionFiles: {
|
|
127
|
-
|
|
128
|
-
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
129
|
-
* via the `patternProperty` "^-?\d+$".
|
|
130
|
-
*/
|
|
131
|
-
[k: string]: string;
|
|
166
|
+
[k: string]: TextureFile;
|
|
132
167
|
};
|
|
133
168
|
textureType?: TextureTypeEnum | null;
|
|
134
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
172
|
+
* via the `patternProperty` "^-?\d+$".
|
|
173
|
+
*
|
|
174
|
+
* This interface was referenced by `Schema`'s JSON-Schema
|
|
175
|
+
* via the `definition` "TextureFile".
|
|
176
|
+
*/
|
|
177
|
+
export interface TextureFile {
|
|
178
|
+
pk: string;
|
|
179
|
+
url: string;
|
|
180
|
+
}
|
|
135
181
|
/**
|
|
136
182
|
* This interface was referenced by `Schema`'s JSON-Schema
|
|
137
183
|
* via the `definition` "Measurement".
|
|
@@ -156,17 +202,9 @@ export interface ModelCollection {
|
|
|
156
202
|
export interface ModelPart {
|
|
157
203
|
aabb: number[];
|
|
158
204
|
center: number[];
|
|
205
|
+
hq: LodContainer;
|
|
159
206
|
id: string;
|
|
160
|
-
|
|
161
|
-
high?: string;
|
|
162
|
-
low?: string;
|
|
163
|
-
medium?: string;
|
|
164
|
-
preview?: string;
|
|
165
|
-
"preview-low"?: string;
|
|
166
|
-
"very-high"?: string;
|
|
167
|
-
"very-low"?: string;
|
|
168
|
-
};
|
|
169
|
-
materials: string[];
|
|
207
|
+
preview?: LodContainer | null;
|
|
170
208
|
}
|
|
171
209
|
/**
|
|
172
210
|
* This interface was referenced by `Schema`'s JSON-Schema
|
package/dist/gen-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen-types.d.ts","sourceRoot":"","sources":["../src/gen-types.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,cAAc,EAAE;QACd,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"gen-types.d.ts","sourceRoot":"","sources":["../src/gen-types.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,cAAc,EAAE;QACd,QAAQ,EAAE,eAAe,CAAC;QAC1B;;;WAGG;QACH,MAAM,EAAE,MAAM,CAAC;QACf,EAAE,EAAE,MAAM,CAAC;QACX,WAAW,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CAAC;IACtC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var M=Object.defineProperty;var E=(i,e,t)=>e in i?M(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var r=(i,e,t)=>E(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p="/static/sangine/wasm",W="c27a2565";class C{constructor(e,t){r(this,"workers");r(this,"idle");r(this,"queue",[]);this.workers=Array.from({length:t},e),this.idle=[...this.workers]}run(e){return new Promise((t,s)=>{const d=this.idle.pop();d?this.dispatch(d,e,t,s):this.queue.push({request:e,resolve:t,reject:s})})}dispatch(e,t,s,d){const c=g=>{s(g.data),m(),this.release(e)},o=g=>{d(g),m(),this.release(e)},m=()=>{e.removeEventListener("message",c),e.removeEventListener("error",o)};e.addEventListener("message",c,{once:!0}),e.addEventListener("error",o,{once:!0}),e.postMessage(t)}release(e){const t=this.queue.shift();t?this.dispatch(e,t.request,t.resolve,t.reject):this.idle.push(e)}broadcast(e){for(const t of this.workers)t.postMessage(e)}terminate(){for(const e of this.workers)e.terminate()}}class P{constructor(e){r(this,"wasm",null);r(this,"callbackRegistry",{});r(this,"userActionRegistry",{});r(this,"assetsDownloadingRegistry",{});r(this,"windowCreatedPromiseRegistry",{});r(this,"windowCreatedPromiseResolveRegistry",{});r(this,"_inited",!1);r(this,"decodePool");r(this,"_readyPromise");r(this,"_resolveReady");r(this,"_rejectReady");this.config=e,this._readyPromise=new Promise((t,s)=>{this._resolveReady=t,this._rejectReady=s}),this.config=e}async init(){if(!(typeof window>"u")){if(this._inited)return this._readyPromise;try{const t=await import(new URL(`${p}/sangine/sangine.${W}.js`,window.location.origin).toString());await t.default(),this.wasm=t,this._inited=!0;const s=this.config.numWorkers??(navigator.hardwareConcurrency||2)-1;this.decodePool=new C(()=>this.config.createDecodeWorker(),Math.max(s,1)),this.wasm.register_asset_decoder(this.decodeAsset.bind(this)),this.wasm.register_event_listener(this.handleSangineEvent.bind(this)),this._resolveReady()}catch(e){throw this._rejectReady(e),e}return this._readyPromise}}ready(){return this._readyPromise}get inited(){return this._inited}getWasm(){if(!this.wasm)throw new Error("RendererService not initialized");return this.wasm}handleActionChanged(e,t){this.userActionRegistry[e]=t;for(const s of this.callbackRegistry[e].actionChanged)s(t)}handleMeasurementCreated(e,t){for(const s of this.callbackRegistry[e].measurementCreated)s(t)}handleRouteUpdated(e,t){for(const s of this.callbackRegistry[e].routeUpdated)s(t)}handleAssetsDownloading(e,t){this.assetsDownloadingRegistry[e]=t;for(const s of this.callbackRegistry[e].assetsDownloading)s(t)}handleUserInteractionStarted(e){for(const t of this.callbackRegistry[e].userInteractionStarted)t()}handleSangineEvent(e,t){t==="ready"?this.windowCreatedPromiseResolveRegistry[e]():t==="userInteractionStarted"?this.handleUserInteractionStarted(e):"actionChanged"in t?this.handleActionChanged(e,t.actionChanged.action):"measurementCreated"in t?this.handleMeasurementCreated(e,t.measurementCreated.measurement):"routeUnderConstructionUpdated"in t?this.handleRouteUpdated(e,t.routeUnderConstructionUpdated.route):"assetsDownloading"in t&&this.handleAssetsDownloading(e,t.assetsDownloading.downloading)}createWindow(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");let d;const c=new Promise(m=>{d=m}),o=this.wasm.create_window(e,t,s);return this.windowCreatedPromiseResolveRegistry[o]=d,this.callbackRegistry[o]={actionChanged:[],routeUpdated:[],measurementCreated:[],assetsDownloading:[],userInteractionStarted:[]},this.userActionRegistry[o]="watching",this.windowCreatedPromiseRegistry[o]=c,o}getAssetsDownloading(e){return this.assetsDownloadingRegistry[e]||!1}readUserAction(e){return this.userActionRegistry[e]}windowReady(e){return this.windowCreatedPromiseRegistry[e]}registerCallback(e,t,s){this.callbackRegistry[e][t].push(s)}setWindowAction(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_window_action(e,t)}destroyWindow(e){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.destroy_window(e),delete this.callbackRegistry[e],delete this.userActionRegistry[e]}setRouteHighlight(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_route_highlight(e,t,s)}setRouteVisible(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_route_visible(e,t,s)}animateToRoute(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.animate_to_route(e,t)}setSunProperties(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_sun_properties(e,t)}setAmbientLighting(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_ambient_lighting(e,t)}setLightingMode(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_lighting_mode(e,t)}setNorthCorrection(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_north_correction(e,t)}setGpuMemoryBudgetMb(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_gpu_memory_budget_mb(e,t)}setRenderQuality(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_render_quality(e,t)}readCameraPos(e){if(!this.wasm)throw new Error("WASM not initialized");return this.wasm.read_camera_pos(e)}animateTo(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.animate_to(e,t)}setScale(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_window_scale(e,t)}async decodeAsset(e){if(!this.decodePool)throw new Error("Renderer not initialized");return this.decodePool.run(e)}destroy(){var e;(e=this.decodePool)==null||e.terminate()}}const k="a8b7eebd",U="5c359661",D=0;function v(i){let e=!1,t=null,s=null,d=!1,c=null;async function o(f,a){if(c){const w=`https://sangine-asset-cache/${f}`,u=await c.match(w);if(u)return u;const l=await fetch(a);return l.ok&&await c.put(w,l.clone()),l}return fetch(a)}async function m(){if(e)return;const a=await import(new URL(`${p}/sbo-decode/wasm_sbo_decode.${U}.js`,i.location.origin).href);await a.default(),t=a,e=!0}async function g(){if(d)return;const a=await import(new URL(`${p}/basis-decode/wasm_basis_decode.${k}.js`,i.location.origin).href);await a.default(),await a.init_basis(),s=a,d=!0}i.onmessage=async f=>{const{data:a}=f;if(!c&&typeof caches<"u"&&(c=await caches.open("sangine-assets-v1")),"texture-file"in a)try{const{pk:w,url:u,format:l,encoding:_}=a["texture-file"];if(_==="ktx2"){await g();const h=await o(w,u);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);const b=await h.arrayBuffer(),y=new Uint8Array(b),n=s.transcode_basis(y,l);i.postMessage({success:!0,width:n.width,height:n.height,data:n.data.buffer,format:n.format},[n.data.buffer])}else{const h=await o(w,u);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);const b=await h.blob(),y=await createImageBitmap(b),n=new OffscreenCanvas(y.width,y.height),R=n.getContext("2d");if(R===null)throw new Error("Couldnt create canvas");R.drawImage(y,0,0);const S=R.getImageData(0,0,n.width,n.height);i.postMessage({success:!0,width:n.width,height:n.height,data:S.data.buffer,format:D},[S.data.buffer])}}catch(w){i.postMessage({success:!1,error:w.message})}else if("model-part-mesh"in a){await m();const{pk:w,url:u}=a["model-part-mesh"],l=await o(w,u);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);const _=await l.arrayBuffer(),A=new Uint8Array(_),h=t.decode_sbo(A);i.postMessage({success:!0,data:h.buffer},[h.buffer])}}}exports.RendererService=P;exports.registerDecodeWorker=v;
|
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var r = (
|
|
4
|
-
const
|
|
5
|
-
class
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var M = (i, e, t) => e in i ? E(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var r = (i, e, t) => M(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const p = "/static/sangine/wasm", C = "c27a2565";
|
|
5
|
+
class W {
|
|
6
6
|
constructor(e, t) {
|
|
7
7
|
r(this, "workers");
|
|
8
8
|
r(this, "idle");
|
|
@@ -11,30 +11,34 @@ class R {
|
|
|
11
11
|
}
|
|
12
12
|
run(e) {
|
|
13
13
|
return new Promise((t, s) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
const d = this.idle.pop();
|
|
15
|
+
d ? this.dispatch(d, e, t, s) : this.queue.push({ request: e, resolve: t, reject: s });
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
dispatch(e, t, s,
|
|
19
|
-
const
|
|
20
|
-
s(
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
e.removeEventListener("message",
|
|
18
|
+
dispatch(e, t, s, d) {
|
|
19
|
+
const c = (g) => {
|
|
20
|
+
s(g.data), m(), this.release(e);
|
|
21
|
+
}, o = (g) => {
|
|
22
|
+
d(g), m(), this.release(e);
|
|
23
|
+
}, m = () => {
|
|
24
|
+
e.removeEventListener("message", c), e.removeEventListener("error", o);
|
|
25
25
|
};
|
|
26
|
-
e.addEventListener("message",
|
|
26
|
+
e.addEventListener("message", c, { once: !0 }), e.addEventListener("error", o, { once: !0 }), e.postMessage(t);
|
|
27
27
|
}
|
|
28
28
|
release(e) {
|
|
29
29
|
const t = this.queue.shift();
|
|
30
30
|
t ? this.dispatch(e, t.request, t.resolve, t.reject) : this.idle.push(e);
|
|
31
31
|
}
|
|
32
|
+
broadcast(e) {
|
|
33
|
+
for (const t of this.workers)
|
|
34
|
+
t.postMessage(e);
|
|
35
|
+
}
|
|
32
36
|
terminate() {
|
|
33
37
|
for (const e of this.workers)
|
|
34
38
|
e.terminate();
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
|
-
class
|
|
41
|
+
class z {
|
|
38
42
|
constructor(e) {
|
|
39
43
|
r(this, "wasm", null);
|
|
40
44
|
r(this, "callbackRegistry", {});
|
|
@@ -56,12 +60,12 @@ class A {
|
|
|
56
60
|
if (this._inited) return this._readyPromise;
|
|
57
61
|
try {
|
|
58
62
|
const t = await import(new URL(
|
|
59
|
-
`${
|
|
63
|
+
`${p}/sangine/sangine.${C}.js`,
|
|
60
64
|
window.location.origin
|
|
61
65
|
).toString());
|
|
62
66
|
await t.default(), this.wasm = t, this._inited = !0;
|
|
63
67
|
const s = this.config.numWorkers ?? (navigator.hardwareConcurrency || 2) - 1;
|
|
64
|
-
this.decodePool = new
|
|
68
|
+
this.decodePool = new W(
|
|
65
69
|
() => this.config.createDecodeWorker(),
|
|
66
70
|
Math.max(s, 1)
|
|
67
71
|
), this.wasm.register_asset_decoder(this.decodeAsset.bind(this)), this.wasm.register_event_listener(this.handleSangineEvent.bind(this)), this._resolveReady();
|
|
@@ -109,17 +113,17 @@ class A {
|
|
|
109
113
|
}
|
|
110
114
|
createWindow(e, t, s) {
|
|
111
115
|
if (!this.wasm) throw new Error("WASM not initialized");
|
|
112
|
-
let
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
}),
|
|
116
|
-
return this.windowCreatedPromiseResolveRegistry[
|
|
116
|
+
let d;
|
|
117
|
+
const c = new Promise((m) => {
|
|
118
|
+
d = m;
|
|
119
|
+
}), o = this.wasm.create_window(e, t, s);
|
|
120
|
+
return this.windowCreatedPromiseResolveRegistry[o] = d, this.callbackRegistry[o] = {
|
|
117
121
|
actionChanged: [],
|
|
118
122
|
routeUpdated: [],
|
|
119
123
|
measurementCreated: [],
|
|
120
124
|
assetsDownloading: [],
|
|
121
125
|
userInteractionStarted: []
|
|
122
|
-
}, this.userActionRegistry[
|
|
126
|
+
}, this.userActionRegistry[o] = "watching", this.windowCreatedPromiseRegistry[o] = c, o;
|
|
123
127
|
}
|
|
124
128
|
getAssetsDownloading(e) {
|
|
125
129
|
return this.assetsDownloadingRegistry[e] || !1;
|
|
@@ -198,66 +202,85 @@ class A {
|
|
|
198
202
|
(e = this.decodePool) == null || e.terminate();
|
|
199
203
|
}
|
|
200
204
|
}
|
|
201
|
-
const
|
|
202
|
-
function
|
|
203
|
-
let
|
|
204
|
-
async function
|
|
205
|
-
if (
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
208
|
-
const l = await
|
|
209
|
-
return
|
|
210
|
-
}
|
|
211
|
-
return fetch(await a());
|
|
212
|
-
}
|
|
213
|
-
n.onmessage = async (h) => {
|
|
214
|
-
if (!t) {
|
|
215
|
-
const c = await import(new URL(
|
|
216
|
-
`${g}/sbo-decode/wasm_sbo_decode.${p}.js`,
|
|
217
|
-
n.location.origin
|
|
218
|
-
).href);
|
|
219
|
-
await c.default(), s = c, t = !0;
|
|
205
|
+
const P = "a8b7eebd", k = "5c359661", U = 0;
|
|
206
|
+
function v(i) {
|
|
207
|
+
let e = !1, t = null, s = null, d = !1, c = null;
|
|
208
|
+
async function o(f, a) {
|
|
209
|
+
if (c) {
|
|
210
|
+
const w = `https://sangine-asset-cache/${f}`, u = await c.match(w);
|
|
211
|
+
if (u) return u;
|
|
212
|
+
const l = await fetch(a);
|
|
213
|
+
return l.ok && await c.put(w, l.clone()), l;
|
|
220
214
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
215
|
+
return fetch(a);
|
|
216
|
+
}
|
|
217
|
+
async function m() {
|
|
218
|
+
if (e) return;
|
|
219
|
+
const a = await import(new URL(
|
|
220
|
+
`${p}/sbo-decode/wasm_sbo_decode.${k}.js`,
|
|
221
|
+
i.location.origin
|
|
222
|
+
).href);
|
|
223
|
+
await a.default(), t = a, e = !0;
|
|
224
|
+
}
|
|
225
|
+
async function g() {
|
|
226
|
+
if (d) return;
|
|
227
|
+
const a = await import(new URL(
|
|
228
|
+
`${p}/basis-decode/wasm_basis_decode.${P}.js`,
|
|
229
|
+
i.location.origin
|
|
230
|
+
).href);
|
|
231
|
+
await a.default(), await a.init_basis(), s = a, d = !0;
|
|
232
|
+
}
|
|
233
|
+
i.onmessage = async (f) => {
|
|
234
|
+
const { data: a } = f;
|
|
235
|
+
if (!c && typeof caches < "u" && (c = await caches.open("sangine-assets-v1")), "texture-file" in a)
|
|
224
236
|
try {
|
|
225
|
-
const
|
|
226
|
-
if (
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
237
|
+
const { pk: w, url: u, format: l, encoding: _ } = a["texture-file"];
|
|
238
|
+
if (_ === "ktx2") {
|
|
239
|
+
await g();
|
|
240
|
+
const h = await o(w, u);
|
|
241
|
+
if (!h.ok) throw new Error(`HTTP error! status: ${h.status}`);
|
|
242
|
+
const b = await h.arrayBuffer(), y = new Uint8Array(b), n = s.transcode_basis(y, l);
|
|
243
|
+
i.postMessage(
|
|
244
|
+
{
|
|
245
|
+
success: !0,
|
|
246
|
+
width: n.width,
|
|
247
|
+
height: n.height,
|
|
248
|
+
data: n.data.buffer,
|
|
249
|
+
format: n.format
|
|
250
|
+
},
|
|
251
|
+
[n.data.buffer]
|
|
252
|
+
);
|
|
253
|
+
} else {
|
|
254
|
+
const h = await o(w, u);
|
|
255
|
+
if (!h.ok) throw new Error(`HTTP error! status: ${h.status}`);
|
|
256
|
+
const b = await h.blob(), y = await createImageBitmap(b), n = new OffscreenCanvas(y.width, y.height), R = n.getContext("2d");
|
|
257
|
+
if (R === null) throw new Error("Couldnt create canvas");
|
|
258
|
+
R.drawImage(y, 0, 0);
|
|
259
|
+
const S = R.getImageData(0, 0, n.width, n.height);
|
|
260
|
+
i.postMessage(
|
|
261
|
+
{
|
|
262
|
+
success: !0,
|
|
263
|
+
width: n.width,
|
|
264
|
+
height: n.height,
|
|
265
|
+
data: S.data.buffer,
|
|
266
|
+
format: U
|
|
267
|
+
},
|
|
268
|
+
[S.data.buffer]
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
} catch (w) {
|
|
272
|
+
i.postMessage({ success: !1, error: w.message });
|
|
244
273
|
}
|
|
245
274
|
else if ("model-part-mesh" in a) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
{
|
|
252
|
-
success: !0,
|
|
253
|
-
data: d.buffer
|
|
254
|
-
},
|
|
255
|
-
[d.buffer]
|
|
256
|
-
);
|
|
275
|
+
await m();
|
|
276
|
+
const { pk: w, url: u } = a["model-part-mesh"], l = await o(w, u);
|
|
277
|
+
if (!l.ok) throw new Error(`HTTP error! status: ${l.status}`);
|
|
278
|
+
const _ = await l.arrayBuffer(), A = new Uint8Array(_), h = t.decode_sbo(A);
|
|
279
|
+
i.postMessage({ success: !0, data: h.buffer }, [h.buffer]);
|
|
257
280
|
}
|
|
258
281
|
};
|
|
259
282
|
}
|
|
260
283
|
export {
|
|
261
|
-
|
|
262
|
-
|
|
284
|
+
z as RendererService,
|
|
285
|
+
v as registerDecodeWorker
|
|
263
286
|
};
|
package/dist/wasm/basis-decode/snippets/basisu_c_sys-273c0aeb51b100af/wasm/basisu_transcoder.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
async function Module(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("node:module");var require=createRequire(import.meta.url)}var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("node:fs");if(_scriptName.startsWith("file:")){scriptDirectory=require("node:path").dirname(require("node:url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;var HEAP64,HEAPU64;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){}function initRuntime(){runtimeInitialized=true}function postRun(){}function abort(what){what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("basisu_transcoder.wasm")}return new URL("basisu_transcoder.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):"";var ___assert_fail=(condition,filename,line,func)=>abort(`Assertion failed: ${UTF8ToString(condition)}, at: `+[filename?UTF8ToString(filename):"unknown filename",line,func?UTF8ToString(func):"unknown function"]);var __abort_js=()=>abort("");var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{runtimeKeepaliveCounter=0};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e)};var keepRuntimeAlive=()=>true;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{return func()}catch(e){handleException(e)}finally{maybeExit()}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(curr===0||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i<iovcnt;i++){var ptr=HEAPU32[iov>>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j<len;j++){printChar(fd,HEAPU8[ptr+j])}num+=len}HEAPU32[pnum>>2]=num;return 0};{if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"]}var _bt_get_version,_bt_enable_debug_printf,_bt_init,_bt_alloc,_bt_free,_bt_basis_tex_format_is_xuastc_ldr,_bt_basis_tex_format_is_astc_ldr,_bt_basis_tex_format_get_block_width,_bt_basis_tex_format_get_block_height,_bt_basis_tex_format_is_hdr,_bt_basis_tex_format_is_ldr,_bt_basis_get_bytes_per_block_or_pixel,_bt_basis_transcoder_format_has_alpha,_bt_basis_transcoder_format_is_hdr,_bt_basis_transcoder_format_is_ldr,_bt_basis_transcoder_texture_format_is_astc,_bt_basis_transcoder_format_is_uncompressed,_bt_basis_get_uncompressed_bytes_per_pixel,_bt_basis_get_block_width,_bt_basis_get_block_height,_bt_basis_get_transcoder_texture_format_from_basis_tex_format,_bt_basis_is_format_supported,_bt_basis_compute_transcoded_image_size_in_bytes,_bt_ktx2_open,_bt_ktx2_close,_bt_ktx2_get_width,_bt_ktx2_get_height,_bt_ktx2_get_levels,_bt_ktx2_get_faces,_bt_ktx2_get_layers,_bt_ktx2_get_basis_tex_format,_bt_ktx2_is_etc1s,_bt_ktx2_is_uastc_ldr_4x4,_bt_ktx2_is_hdr,_bt_ktx2_is_hdr_4x4,_bt_ktx2_is_hdr_6x6,_bt_ktx2_is_ldr,_bt_ktx2_is_astc_ldr,_bt_ktx2_is_xuastc_ldr,_bt_ktx2_get_block_width,_bt_ktx2_get_block_height,_bt_ktx2_has_alpha,_bt_ktx2_get_dfd_color_model,_bt_ktx2_get_dfd_color_primaries,_bt_ktx2_get_dfd_transfer_func,_bt_ktx2_is_srgb,_bt_ktx2_get_dfd_flags,_bt_ktx2_get_dfd_total_samples,_bt_ktx2_get_dfd_channel_id0,_bt_ktx2_get_dfd_channel_id1,_bt_ktx2_is_video,_bt_ktx2_get_ldr_hdr_upconversion_nit_multiplier,_bt_ktx2_get_level_orig_width,_bt_ktx2_get_level_orig_height,_bt_ktx2_get_level_actual_width,_bt_ktx2_get_level_actual_height,_bt_ktx2_get_level_num_blocks_x,_bt_ktx2_get_level_num_blocks_y,_bt_ktx2_get_level_total_blocks,_bt_ktx2_get_level_alpha_flag,_bt_ktx2_get_level_iframe_flag,_bt_ktx2_start_transcoding,_bt_ktx2_create_transcode_state,_bt_ktx2_destroy_transcode_state,_bt_ktx2_transcode_image_level,__emscripten_timeout,memory,__indirect_function_table,wasmMemory;function assignWasmExports(wasmExports){_bt_get_version=Module["_bt_get_version"]=wasmExports["i"];_bt_enable_debug_printf=Module["_bt_enable_debug_printf"]=wasmExports["j"];_bt_init=Module["_bt_init"]=wasmExports["k"];_bt_alloc=Module["_bt_alloc"]=wasmExports["l"];_bt_free=Module["_bt_free"]=wasmExports["m"];_bt_basis_tex_format_is_xuastc_ldr=Module["_bt_basis_tex_format_is_xuastc_ldr"]=wasmExports["n"];_bt_basis_tex_format_is_astc_ldr=Module["_bt_basis_tex_format_is_astc_ldr"]=wasmExports["o"];_bt_basis_tex_format_get_block_width=Module["_bt_basis_tex_format_get_block_width"]=wasmExports["p"];_bt_basis_tex_format_get_block_height=Module["_bt_basis_tex_format_get_block_height"]=wasmExports["q"];_bt_basis_tex_format_is_hdr=Module["_bt_basis_tex_format_is_hdr"]=wasmExports["r"];_bt_basis_tex_format_is_ldr=Module["_bt_basis_tex_format_is_ldr"]=wasmExports["s"];_bt_basis_get_bytes_per_block_or_pixel=Module["_bt_basis_get_bytes_per_block_or_pixel"]=wasmExports["t"];_bt_basis_transcoder_format_has_alpha=Module["_bt_basis_transcoder_format_has_alpha"]=wasmExports["u"];_bt_basis_transcoder_format_is_hdr=Module["_bt_basis_transcoder_format_is_hdr"]=wasmExports["v"];_bt_basis_transcoder_format_is_ldr=Module["_bt_basis_transcoder_format_is_ldr"]=wasmExports["w"];_bt_basis_transcoder_texture_format_is_astc=Module["_bt_basis_transcoder_texture_format_is_astc"]=wasmExports["x"];_bt_basis_transcoder_format_is_uncompressed=Module["_bt_basis_transcoder_format_is_uncompressed"]=wasmExports["y"];_bt_basis_get_uncompressed_bytes_per_pixel=Module["_bt_basis_get_uncompressed_bytes_per_pixel"]=wasmExports["z"];_bt_basis_get_block_width=Module["_bt_basis_get_block_width"]=wasmExports["A"];_bt_basis_get_block_height=Module["_bt_basis_get_block_height"]=wasmExports["B"];_bt_basis_get_transcoder_texture_format_from_basis_tex_format=Module["_bt_basis_get_transcoder_texture_format_from_basis_tex_format"]=wasmExports["C"];_bt_basis_is_format_supported=Module["_bt_basis_is_format_supported"]=wasmExports["D"];_bt_basis_compute_transcoded_image_size_in_bytes=Module["_bt_basis_compute_transcoded_image_size_in_bytes"]=wasmExports["E"];_bt_ktx2_open=Module["_bt_ktx2_open"]=wasmExports["F"];_bt_ktx2_close=Module["_bt_ktx2_close"]=wasmExports["G"];_bt_ktx2_get_width=Module["_bt_ktx2_get_width"]=wasmExports["H"];_bt_ktx2_get_height=Module["_bt_ktx2_get_height"]=wasmExports["I"];_bt_ktx2_get_levels=Module["_bt_ktx2_get_levels"]=wasmExports["J"];_bt_ktx2_get_faces=Module["_bt_ktx2_get_faces"]=wasmExports["K"];_bt_ktx2_get_layers=Module["_bt_ktx2_get_layers"]=wasmExports["L"];_bt_ktx2_get_basis_tex_format=Module["_bt_ktx2_get_basis_tex_format"]=wasmExports["M"];_bt_ktx2_is_etc1s=Module["_bt_ktx2_is_etc1s"]=wasmExports["N"];_bt_ktx2_is_uastc_ldr_4x4=Module["_bt_ktx2_is_uastc_ldr_4x4"]=wasmExports["O"];_bt_ktx2_is_hdr=Module["_bt_ktx2_is_hdr"]=wasmExports["P"];_bt_ktx2_is_hdr_4x4=Module["_bt_ktx2_is_hdr_4x4"]=wasmExports["Q"];_bt_ktx2_is_hdr_6x6=Module["_bt_ktx2_is_hdr_6x6"]=wasmExports["R"];_bt_ktx2_is_ldr=Module["_bt_ktx2_is_ldr"]=wasmExports["S"];_bt_ktx2_is_astc_ldr=Module["_bt_ktx2_is_astc_ldr"]=wasmExports["T"];_bt_ktx2_is_xuastc_ldr=Module["_bt_ktx2_is_xuastc_ldr"]=wasmExports["U"];_bt_ktx2_get_block_width=Module["_bt_ktx2_get_block_width"]=wasmExports["V"];_bt_ktx2_get_block_height=Module["_bt_ktx2_get_block_height"]=wasmExports["W"];_bt_ktx2_has_alpha=Module["_bt_ktx2_has_alpha"]=wasmExports["X"];_bt_ktx2_get_dfd_color_model=Module["_bt_ktx2_get_dfd_color_model"]=wasmExports["Y"];_bt_ktx2_get_dfd_color_primaries=Module["_bt_ktx2_get_dfd_color_primaries"]=wasmExports["Z"];_bt_ktx2_get_dfd_transfer_func=Module["_bt_ktx2_get_dfd_transfer_func"]=wasmExports["_"];_bt_ktx2_is_srgb=Module["_bt_ktx2_is_srgb"]=wasmExports["$"];_bt_ktx2_get_dfd_flags=Module["_bt_ktx2_get_dfd_flags"]=wasmExports["aa"];_bt_ktx2_get_dfd_total_samples=Module["_bt_ktx2_get_dfd_total_samples"]=wasmExports["ba"];_bt_ktx2_get_dfd_channel_id0=Module["_bt_ktx2_get_dfd_channel_id0"]=wasmExports["ca"];_bt_ktx2_get_dfd_channel_id1=Module["_bt_ktx2_get_dfd_channel_id1"]=wasmExports["da"];_bt_ktx2_is_video=Module["_bt_ktx2_is_video"]=wasmExports["ea"];_bt_ktx2_get_ldr_hdr_upconversion_nit_multiplier=Module["_bt_ktx2_get_ldr_hdr_upconversion_nit_multiplier"]=wasmExports["fa"];_bt_ktx2_get_level_orig_width=Module["_bt_ktx2_get_level_orig_width"]=wasmExports["ga"];_bt_ktx2_get_level_orig_height=Module["_bt_ktx2_get_level_orig_height"]=wasmExports["ha"];_bt_ktx2_get_level_actual_width=Module["_bt_ktx2_get_level_actual_width"]=wasmExports["ia"];_bt_ktx2_get_level_actual_height=Module["_bt_ktx2_get_level_actual_height"]=wasmExports["ja"];_bt_ktx2_get_level_num_blocks_x=Module["_bt_ktx2_get_level_num_blocks_x"]=wasmExports["ka"];_bt_ktx2_get_level_num_blocks_y=Module["_bt_ktx2_get_level_num_blocks_y"]=wasmExports["la"];_bt_ktx2_get_level_total_blocks=Module["_bt_ktx2_get_level_total_blocks"]=wasmExports["ma"];_bt_ktx2_get_level_alpha_flag=Module["_bt_ktx2_get_level_alpha_flag"]=wasmExports["na"];_bt_ktx2_get_level_iframe_flag=Module["_bt_ktx2_get_level_iframe_flag"]=wasmExports["oa"];_bt_ktx2_start_transcoding=Module["_bt_ktx2_start_transcoding"]=wasmExports["pa"];_bt_ktx2_create_transcode_state=Module["_bt_ktx2_create_transcode_state"]=wasmExports["qa"];_bt_ktx2_destroy_transcode_state=Module["_bt_ktx2_destroy_transcode_state"]=wasmExports["ra"];_bt_ktx2_transcode_image_level=Module["_bt_ktx2_transcode_image_level"]=wasmExports["sa"];__emscripten_timeout=wasmExports["ta"];memory=wasmMemory=wasmExports["h"];__indirect_function_table=wasmExports["__indirect_function_table"]}var wasmImports={a:___assert_fail,e:__abort_js,c:__emscripten_runtime_keepalive_clear,d:__setitimer_js,f:_emscripten_resize_heap,g:_fd_write,b:_proc_exit};function run(){preRun();function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);postRun()}{doRun()}}var wasmExports;wasmExports=await (createWasm());run();if(runtimeInitialized){moduleRtn=Module}else{moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject})}
|
|
2
|
+
;return moduleRtn}export default Module;
|