@sanox/sangine-core 0.1.0 → 0.2.2

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.
@@ -3,6 +3,19 @@
3
3
  * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
4
  * and run json-schema-to-typescript to regenerate this file.
5
5
  */
6
+ /**
7
+ * This interface was referenced by `Schema`'s JSON-Schema
8
+ * via the `definition` "DecodeTask".
9
+ */
10
+ export type DecodeTask = {
11
+ "texture-file": {
12
+ pk: string;
13
+ };
14
+ } | {
15
+ "model-part-mesh": {
16
+ pk: string;
17
+ };
18
+ };
6
19
  /**
7
20
  * This interface was referenced by `Schema`'s JSON-Schema
8
21
  * via the `definition` "LodEnum".
@@ -81,9 +94,14 @@ export interface Material {
81
94
  * via the `definition` "Texture".
82
95
  */
83
96
  export interface Texture {
84
- downloadTemplate: string;
85
97
  name: string;
86
- resolutions: number[];
98
+ resolutionFiles: {
99
+ /**
100
+ * This interface was referenced by `undefined`'s JSON-Schema definition
101
+ * via the `patternProperty` "^-?\d+$".
102
+ */
103
+ [k: string]: string;
104
+ };
87
105
  textureType?: TextureTypeEnum | null;
88
106
  }
89
107
  /**
@@ -110,9 +128,16 @@ export interface ModelCollection {
110
128
  export interface ModelPart {
111
129
  aabb: number[];
112
130
  center: number[];
113
- downloadTemplate: string;
114
131
  id: string;
115
- lods: LodEnum[];
132
+ lodMeshes: {
133
+ high?: string;
134
+ low?: string;
135
+ medium?: string;
136
+ preview?: string;
137
+ "preview-low"?: string;
138
+ "very-high"?: string;
139
+ "very-low"?: string;
140
+ };
116
141
  materials: string[];
117
142
  }
118
143
  /**
@@ -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,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,UAA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AAgB,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 f=Object.defineProperty;var y=(r,e,t)=>e in r?f(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var n=(r,e,t)=>y(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g="/static/sangine/wasm";class _{constructor(e,t){n(this,"workers");n(this,"idle");n(this,"queue",[]);this.workers=Array.from({length:t},e),this.idle=[...this.workers]}run(e){return new Promise((t,i)=>{const a=this.idle.pop();a?this.dispatch(a,e,t,i):this.queue.push({request:e,resolve:t,reject:i})})}dispatch(e,t,i,a){const o=d=>{i(d.data),c(),this.release(e)},s=d=>{a(d),c(),this.release(e)},c=()=>{e.removeEventListener("message",o),e.removeEventListener("error",s)};e.addEventListener("message",o,{once:!0}),e.addEventListener("error",s,{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)}terminate(){for(const e of this.workers)e.terminate()}}class R{constructor(e){n(this,"wasm",null);n(this,"callbackRegistry",{});n(this,"userActionRegistry",{});n(this,"windowCreatedPromiseRegistry",{});n(this,"windowCreatedPromiseResolveRegistry",{});n(this,"_inited",!1);n(this,"decodePool");n(this,"_readyPromise");n(this,"_resolveReady");n(this,"_rejectReady");this.config=e,this._readyPromise=new Promise((t,i)=>{this._resolveReady=t,this._rejectReady=i}),this.config=e}async init(){if(!(typeof window>"u")){if(this._inited)return this._readyPromise;try{const t=await import(new URL(`${g}/sangine/sangine.js`,window.location.origin).toString());await t.default(),this.wasm=t,this._inited=!0;const i=this.config.numWorkers??(navigator.hardwareConcurrency||2)-1;this.decodePool=new _(()=>this.config.createDecodeWorker(),Math.max(i,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 i of this.callbackRegistry[e].actionChanged)i(t)}handleMeasurementCreated(e,t){for(const i of this.callbackRegistry[e].measurementCreated)i(t)}handleRouteUpdated(e,t){for(const i of this.callbackRegistry[e].routeUpdated)i(t)}handleSangineEvent(e,t){t==="ready"?this.windowCreatedPromiseResolveRegistry[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)}createWindow(e,t){if(!this.wasm)throw new Error("WASM not initialized");let i;const a=new Promise(s=>{i=s}),o=this.wasm.create_window(e,t);return this.windowCreatedPromiseResolveRegistry[o]=i,this.callbackRegistry[o]={actionChanged:[],routeUpdated:[],measurementCreated:[]},this.userActionRegistry[o]="watching",this.windowCreatedPromiseRegistry[o]=a,o}readUserAction(e){return this.userActionRegistry[e]}windowReady(e){return this.windowCreatedPromiseRegistry[e]}registerCallback(e,t,i){this.callbackRegistry[e][t].push(i)}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,i){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_route_highlight(e,t,i)}setRouteVisible(e,t,i){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_route_visible(e,t,i)}animateToRoute(e,t){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.animate_to_route(e,t)}setSunProperties(e,t,i,a,o,s,c){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_sun_properties(e,t,i,a,o,s,c)}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,t){if(!this.decodePool)throw new Error("Renderer not initialized");return this.decodePool.run({kind:e,url:t})}destroy(){var e;(e=this.decodePool)==null||e.terminate()}}const u=Object.freeze({Webp:0,0:"Webp",Sbo:1,1:"Sbo"});typeof FinalizationRegistry>"u"||new FinalizationRegistry(r=>r.dtor(r.a,r.b));let b=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});b.decode();const l=new TextEncoder;"encodeInto"in l||(l.encodeInto=function(r,e){const t=l.encode(r);return e.set(t),{read:r.length,written:t.length}});function p(r){let e=!1,t=null;r.onmessage=async i=>{if(!e){const s=await import(new URL(`${g}/sbo-decode/wasm_sbo_decode.js`,r.location.origin).href);await s.default(),t=s,e=!0}const{data:a}=i;if(a.kind===u.Webp){const o=a.url;try{const s=await fetch(o);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const c=await s.blob(),d=await createImageBitmap(c),h=new OffscreenCanvas(d.width,d.height),w=h.getContext("2d");if(w===null)throw new Error("Couldnt create canvas");w.drawImage(d,0,0);const m=w.getImageData(0,0,h.width,h.height);r.postMessage({success:!0,width:h.width,height:h.height,data:m.data.buffer},[m.data.buffer])}catch(s){r.postMessage({success:!1,error:s.message})}}else if(a.kind===u.Sbo){const o=a.url,s=await fetch(o);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const c=await s.arrayBuffer(),d=new Uint8Array(c),h=t.decode_sbo(d);r.postMessage({success:!0,data:h.buffer},[h.buffer])}}}exports.DecodeKind=u;exports.RendererService=R;exports.registerDecodeWorker=p;
1
+ "use strict";var f=Object.defineProperty;var y=(a,e,t)=>e in a?f(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var r=(a,e,t)=>y(a,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g="/static/sangine/wasm";class _{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 o=this.idle.pop();o?this.dispatch(o,e,t,s):this.queue.push({request:e,resolve:t,reject:s})})}dispatch(e,t,s,o){const n=i=>{s(i.data),d(),this.release(e)},c=i=>{o(i),d(),this.release(e)},d=()=>{e.removeEventListener("message",n),e.removeEventListener("error",c)};e.addEventListener("message",n,{once:!0}),e.addEventListener("error",c,{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)}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,"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(`${g}/sangine/sangine.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 _(()=>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)}handleSangineEvent(e,t){t==="ready"?this.windowCreatedPromiseResolveRegistry[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)}createWindow(e,t){if(!this.wasm)throw new Error("WASM not initialized");let s;const o=new Promise(c=>{s=c}),n=this.wasm.create_window(e,t);return this.windowCreatedPromiseResolveRegistry[n]=s,this.callbackRegistry[n]={actionChanged:[],routeUpdated:[],measurementCreated:[]},this.userActionRegistry[n]="watching",this.windowCreatedPromiseRegistry[n]=o,n}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,s,o,n,c,d){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_sun_properties(e,t,s,o,n,c,d)}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()}}function R(a,e){let t=!1,s=null,o=null;async function n(c,d){const i=`https://sangine-asset-cache/${c}`,w=await o.match(i);if(w)return w;const l=await d(),h=await fetch(l);return h.ok&&await o.put(i,h.clone()),h}a.onmessage=async c=>{if(!t){const w=await import(new URL(`${g}/sbo-decode/wasm_sbo_decode.js`,a.location.origin).href);await w.default(),s=w,t=!0}o||(o=await caches.open("sangine-assets-v1"));const{data:d}=c;if("texture-file"in d)try{const i=await n(d["texture-file"].pk,()=>e(d));if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);const w=await i.blob(),l=await createImageBitmap(w),h=new OffscreenCanvas(l.width,l.height),m=h.getContext("2d");if(m===null)throw new Error("Couldnt create canvas");m.drawImage(l,0,0);const u=m.getImageData(0,0,h.width,h.height);a.postMessage({success:!0,width:h.width,height:h.height,data:u.data.buffer},[u.data.buffer])}catch(i){a.postMessage({success:!1,error:i.message})}else if("model-part-mesh"in d){const i=await n(d["model-part-mesh"].pk,()=>e(d));if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);const w=await i.arrayBuffer(),l=new Uint8Array(w),h=s.decode_sbo(l);a.postMessage({success:!0,data:h.buffer},[h.buffer])}}}exports.RendererService=p;exports.registerDecodeWorker=R;
package/dist/index.es.js CHANGED
@@ -1,29 +1,29 @@
1
1
  var f = Object.defineProperty;
2
- var y = (s, e, t) => e in s ? f(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var a = (s, e, t) => y(s, typeof e != "symbol" ? e + "" : e, t);
2
+ var y = (a, e, t) => e in a ? f(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
+ var r = (a, e, t) => y(a, typeof e != "symbol" ? e + "" : e, t);
4
4
  const g = "/static/sangine/wasm";
5
5
  class _ {
6
6
  constructor(e, t) {
7
- a(this, "workers");
8
- a(this, "idle");
9
- a(this, "queue", []);
7
+ r(this, "workers");
8
+ r(this, "idle");
9
+ r(this, "queue", []);
10
10
  this.workers = Array.from({ length: t }, e), this.idle = [...this.workers];
11
11
  }
12
12
  run(e) {
13
- return new Promise((t, i) => {
14
- const n = this.idle.pop();
15
- n ? this.dispatch(n, e, t, i) : this.queue.push({ request: e, resolve: t, reject: i });
13
+ return new Promise((t, s) => {
14
+ const o = this.idle.pop();
15
+ o ? this.dispatch(o, e, t, s) : this.queue.push({ request: e, resolve: t, reject: s });
16
16
  });
17
17
  }
18
- dispatch(e, t, i, n) {
19
- const o = (d) => {
20
- i(d.data), h(), this.release(e);
21
- }, r = (d) => {
22
- n(d), h(), this.release(e);
23
- }, h = () => {
24
- e.removeEventListener("message", o), e.removeEventListener("error", r);
18
+ dispatch(e, t, s, o) {
19
+ const n = (i) => {
20
+ s(i.data), d(), this.release(e);
21
+ }, c = (i) => {
22
+ o(i), d(), this.release(e);
23
+ }, d = () => {
24
+ e.removeEventListener("message", n), e.removeEventListener("error", c);
25
25
  };
26
- e.addEventListener("message", o, { once: !0 }), e.addEventListener("error", r, { once: !0 }), e.postMessage(t);
26
+ e.addEventListener("message", n, { once: !0 }), e.addEventListener("error", c, { once: !0 }), e.postMessage(t);
27
27
  }
28
28
  release(e) {
29
29
  const t = this.queue.shift();
@@ -34,20 +34,20 @@ class _ {
34
34
  e.terminate();
35
35
  }
36
36
  }
37
- class p {
37
+ class R {
38
38
  constructor(e) {
39
- a(this, "wasm", null);
40
- a(this, "callbackRegistry", {});
41
- a(this, "userActionRegistry", {});
42
- a(this, "windowCreatedPromiseRegistry", {});
43
- a(this, "windowCreatedPromiseResolveRegistry", {});
44
- a(this, "_inited", !1);
45
- a(this, "decodePool");
46
- a(this, "_readyPromise");
47
- a(this, "_resolveReady");
48
- a(this, "_rejectReady");
49
- this.config = e, this._readyPromise = new Promise((t, i) => {
50
- this._resolveReady = t, this._rejectReady = i;
39
+ r(this, "wasm", null);
40
+ r(this, "callbackRegistry", {});
41
+ r(this, "userActionRegistry", {});
42
+ r(this, "windowCreatedPromiseRegistry", {});
43
+ r(this, "windowCreatedPromiseResolveRegistry", {});
44
+ r(this, "_inited", !1);
45
+ r(this, "decodePool");
46
+ r(this, "_readyPromise");
47
+ r(this, "_resolveReady");
48
+ r(this, "_rejectReady");
49
+ this.config = e, this._readyPromise = new Promise((t, s) => {
50
+ this._resolveReady = t, this._rejectReady = s;
51
51
  }), this.config = e;
52
52
  }
53
53
  async init() {
@@ -59,10 +59,10 @@ class p {
59
59
  window.location.origin
60
60
  ).toString());
61
61
  await t.default(), this.wasm = t, this._inited = !0;
62
- const i = this.config.numWorkers ?? (navigator.hardwareConcurrency || 2) - 1;
62
+ const s = this.config.numWorkers ?? (navigator.hardwareConcurrency || 2) - 1;
63
63
  this.decodePool = new _(
64
64
  () => this.config.createDecodeWorker(),
65
- Math.max(i, 1)
65
+ Math.max(s, 1)
66
66
  ), this.wasm.register_asset_decoder(this.decodeAsset.bind(this)), this.wasm.register_event_listener(this.handleSangineEvent.bind(this)), this._resolveReady();
67
67
  } catch (e) {
68
68
  throw this._rejectReady(e), e;
@@ -83,31 +83,31 @@ class p {
83
83
  }
84
84
  handleActionChanged(e, t) {
85
85
  this.userActionRegistry[e] = t;
86
- for (const i of this.callbackRegistry[e].actionChanged)
87
- i(t);
86
+ for (const s of this.callbackRegistry[e].actionChanged)
87
+ s(t);
88
88
  }
89
89
  handleMeasurementCreated(e, t) {
90
- for (const i of this.callbackRegistry[e].measurementCreated)
91
- i(t);
90
+ for (const s of this.callbackRegistry[e].measurementCreated)
91
+ s(t);
92
92
  }
93
93
  handleRouteUpdated(e, t) {
94
- for (const i of this.callbackRegistry[e].routeUpdated)
95
- i(t);
94
+ for (const s of this.callbackRegistry[e].routeUpdated)
95
+ s(t);
96
96
  }
97
97
  handleSangineEvent(e, t) {
98
98
  t === "ready" ? this.windowCreatedPromiseResolveRegistry[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);
99
99
  }
100
100
  createWindow(e, t) {
101
101
  if (!this.wasm) throw new Error("WASM not initialized");
102
- let i;
103
- const n = new Promise((r) => {
104
- i = r;
105
- }), o = this.wasm.create_window(e, t);
106
- return this.windowCreatedPromiseResolveRegistry[o] = i, this.callbackRegistry[o] = {
102
+ let s;
103
+ const o = new Promise((c) => {
104
+ s = c;
105
+ }), n = this.wasm.create_window(e, t);
106
+ return this.windowCreatedPromiseResolveRegistry[n] = s, this.callbackRegistry[n] = {
107
107
  actionChanged: [],
108
108
  routeUpdated: [],
109
109
  measurementCreated: []
110
- }, this.userActionRegistry[o] = "watching", this.windowCreatedPromiseRegistry[o] = n, o;
110
+ }, this.userActionRegistry[n] = "watching", this.windowCreatedPromiseRegistry[n] = o, n;
111
111
  }
112
112
  readUserAction(e) {
113
113
  return this.userActionRegistry[e];
@@ -115,8 +115,8 @@ class p {
115
115
  windowReady(e) {
116
116
  return this.windowCreatedPromiseRegistry[e];
117
117
  }
118
- registerCallback(e, t, i) {
119
- this.callbackRegistry[e][t].push(i);
118
+ registerCallback(e, t, s) {
119
+ this.callbackRegistry[e][t].push(s);
120
120
  }
121
121
  setWindowAction(e, t) {
122
122
  if (!this.wasm) throw new Error("WASM not initialized");
@@ -126,28 +126,28 @@ class p {
126
126
  if (!this.wasm) throw new Error("WASM not initialized");
127
127
  this.wasm.destroy_window(e), delete this.callbackRegistry[e], delete this.userActionRegistry[e];
128
128
  }
129
- setRouteHighlight(e, t, i) {
129
+ setRouteHighlight(e, t, s) {
130
130
  if (!this.wasm) throw new Error("WASM not initialized");
131
- this.wasm.set_route_highlight(e, t, i);
131
+ this.wasm.set_route_highlight(e, t, s);
132
132
  }
133
- setRouteVisible(e, t, i) {
133
+ setRouteVisible(e, t, s) {
134
134
  if (!this.wasm) throw new Error("WASM not initialized");
135
- this.wasm.set_route_visible(e, t, i);
135
+ this.wasm.set_route_visible(e, t, s);
136
136
  }
137
137
  animateToRoute(e, t) {
138
138
  if (!this.wasm) throw new Error("WASM not initialized");
139
139
  this.wasm.animate_to_route(e, t);
140
140
  }
141
- setSunProperties(e, t, i, n, o, r, h) {
141
+ setSunProperties(e, t, s, o, n, c, d) {
142
142
  if (!this.wasm) throw new Error("WASM not initialized");
143
143
  this.wasm.set_sun_properties(
144
144
  e,
145
145
  t,
146
- i,
147
- n,
146
+ s,
148
147
  o,
149
- r,
150
- h
148
+ n,
149
+ c,
150
+ d
151
151
  );
152
152
  }
153
153
  setNorthCorrection(e, t) {
@@ -174,83 +174,71 @@ class p {
174
174
  if (!this.wasm) throw new Error("WASM not initialized");
175
175
  this.wasm.set_window_scale(e, t);
176
176
  }
177
- async decodeAsset(e, t) {
177
+ async decodeAsset(e) {
178
178
  if (!this.decodePool) throw new Error("Renderer not initialized");
179
- return this.decodePool.run({ kind: e, url: t });
179
+ return this.decodePool.run(e);
180
180
  }
181
181
  destroy() {
182
182
  var e;
183
183
  (e = this.decodePool) == null || e.terminate();
184
184
  }
185
185
  }
186
- const m = Object.freeze({
187
- Webp: 0,
188
- 0: "Webp",
189
- Sbo: 1,
190
- 1: "Sbo"
191
- });
192
- typeof FinalizationRegistry > "u" || new FinalizationRegistry((s) => s.dtor(s.a, s.b));
193
- let R = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
194
- R.decode();
195
- const l = new TextEncoder();
196
- "encodeInto" in l || (l.encodeInto = function(s, e) {
197
- const t = l.encode(s);
198
- return e.set(t), {
199
- read: s.length,
200
- written: t.length
201
- };
202
- });
203
- function A(s) {
204
- let e = !1, t = null;
205
- s.onmessage = async (i) => {
206
- if (!e) {
207
- const r = await import(new URL(
186
+ function b(a, e) {
187
+ let t = !1, s = null, o = null;
188
+ async function n(c, d) {
189
+ const i = `https://sangine-asset-cache/${c}`, w = await o.match(i);
190
+ if (w) return w;
191
+ const l = await d(), h = await fetch(l);
192
+ return h.ok && await o.put(i, h.clone()), h;
193
+ }
194
+ a.onmessage = async (c) => {
195
+ if (!t) {
196
+ const w = await import(new URL(
208
197
  `${g}/sbo-decode/wasm_sbo_decode.js`,
209
- s.location.origin
198
+ a.location.origin
210
199
  ).href);
211
- await r.default(), t = r, e = !0;
200
+ await w.default(), s = w, t = !0;
212
201
  }
213
- const { data: n } = i;
214
- if (n.kind === m.Webp) {
215
- const o = n.url;
202
+ o || (o = await caches.open("sangine-assets-v1"));
203
+ const { data: d } = c;
204
+ if ("texture-file" in d)
216
205
  try {
217
- const r = await fetch(o);
218
- if (!r.ok)
219
- throw new Error(`HTTP error! status: ${r.status}`);
220
- const h = await r.blob(), d = await createImageBitmap(h), c = new OffscreenCanvas(d.width, d.height), w = c.getContext("2d");
221
- if (w === null)
206
+ const i = await n(d["texture-file"].pk, () => e(d));
207
+ if (!i.ok)
208
+ throw new Error(`HTTP error! status: ${i.status}`);
209
+ const w = await i.blob(), l = await createImageBitmap(w), h = new OffscreenCanvas(l.width, l.height), m = h.getContext("2d");
210
+ if (m === null)
222
211
  throw new Error("Couldnt create canvas");
223
- w.drawImage(d, 0, 0);
224
- const u = w.getImageData(0, 0, c.width, c.height);
225
- s.postMessage(
212
+ m.drawImage(l, 0, 0);
213
+ const u = m.getImageData(0, 0, h.width, h.height);
214
+ a.postMessage(
226
215
  {
227
216
  success: !0,
228
- width: c.width,
229
- height: c.height,
217
+ width: h.width,
218
+ height: h.height,
230
219
  data: u.data.buffer
231
220
  },
232
221
  [u.data.buffer]
233
222
  );
234
- } catch (r) {
235
- s.postMessage({ success: !1, error: r.message });
223
+ } catch (i) {
224
+ a.postMessage({ success: !1, error: i.message });
236
225
  }
237
- } else if (n.kind === m.Sbo) {
238
- const o = n.url, r = await fetch(o);
239
- if (!r.ok)
240
- throw new Error(`HTTP error! status: ${r.status}`);
241
- const h = await r.arrayBuffer(), d = new Uint8Array(h), c = t.decode_sbo(d);
242
- s.postMessage(
226
+ else if ("model-part-mesh" in d) {
227
+ const i = await n(d["model-part-mesh"].pk, () => e(d));
228
+ if (!i.ok)
229
+ throw new Error(`HTTP error! status: ${i.status}`);
230
+ const w = await i.arrayBuffer(), l = new Uint8Array(w), h = s.decode_sbo(l);
231
+ a.postMessage(
243
232
  {
244
233
  success: !0,
245
- data: c.buffer
234
+ data: h.buffer
246
235
  },
247
- [c.buffer]
236
+ [h.buffer]
248
237
  );
249
238
  }
250
239
  };
251
240
  }
252
241
  export {
253
- m as DecodeKind,
254
- p as RendererService,
255
- A as registerDecodeWorker
242
+ R as RendererService,
243
+ b as registerDecodeWorker
256
244
  };
@@ -1,4 +1,4 @@
1
- import type { CameraPos, DecodeKind, Measurement, RendererAssetQuality, RendererConfig, Route, SangineEvent, Scene, UserAction } from './types.js';
1
+ import type { CameraPos, DecodeTask, Measurement, RendererAssetQuality, RendererConfig, Route, SangineEvent, Scene, UserAction } from './types.js';
2
2
  import type * as SangineModule from './wasm-types/sangine';
3
3
  type ActionChangedCallback = (action: UserAction) => void;
4
4
  type RouteUpdatedCallback = (route: Route) => void;
@@ -45,7 +45,7 @@ export declare class RendererService {
45
45
  readCameraPos(windowId: number): CameraPos;
46
46
  animateTo(windowId: number, position: CameraPos): void;
47
47
  setScale(windowId: number, scale: number): void;
48
- decodeAsset(kind: DecodeKind, url: string): Promise<ArrayBuffer>;
48
+ decodeAsset(task: DecodeTask): Promise<ArrayBuffer>;
49
49
  destroy(): void;
50
50
  }
51
51
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"rendererService.d.ts","sourceRoot":"","sources":["../src/rendererService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EAEV,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,KAAK,EACL,YAAY,EACZ,KAAK,EACL,UAAU,EACX,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,KAAK,aAAa,MAAM,sBAAsB,CAAA;AAI1D,KAAK,qBAAqB,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;AACzD,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;AAClD,KAAK,0BAA0B,GAAG,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAA;AAEpE,UAAU,WAAW;IACnB,aAAa,EAAE,qBAAqB,CAAA;IACpC,YAAY,EAAE,oBAAoB,CAAA;IAClC,kBAAkB,EAAE,0BAA0B,CAAA;CAC/C;AAMD,qBAAa,eAAe;IAad,OAAO,CAAC,MAAM;IAZ1B,OAAO,CAAC,IAAI,CAA2B;IACvC,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,kBAAkB,CAAsC;IAChE,OAAO,CAAC,4BAA4B,CAAyC;IAC7E,OAAO,CAAC,mCAAmC,CAAsC;IACjF,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,UAAU,CAAC,CAAqC;IAExD,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,YAAY,CAAyB;gBAEzB,MAAM,EAAE,cAAc;IAQpC,IAAI;IAgCV,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,IAAI,MAAM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MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM;IAcnB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAK5D,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAKvD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB;IAKhE,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAK1C,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS;IAK/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAKlC,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IAKzD,OAAO;CAGR"}
package/dist/types.d.ts CHANGED
@@ -1,10 +1,4 @@
1
- import { type DecodeKind } from './wasm-types/sangine';
2
1
  export * from './gen-types';
3
- export { DecodeKind } from './wasm-types/sangine';
4
- export interface DecodeTask {
5
- kind: DecodeKind;
6
- url: string;
7
- }
8
2
  export interface RendererConfig {
9
3
  createDecodeWorker(): Worker;
10
4
  numWorkers?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEjD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,cAAc;IAC7B,kBAAkB,IAAI,MAAM,CAAA;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,MAAM,WAAW,cAAc;IAC7B,kBAAkB,IAAI,MAAM,CAAA;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
@@ -1,9 +1,26 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
- export enum DecodeKind {
5
- Webp = 0,
6
- Sbo = 1,
4
+ /**
5
+ * Chroma subsampling format
6
+ */
7
+ export enum ChromaSampling {
8
+ /**
9
+ * Both vertically and horizontally subsampled.
10
+ */
11
+ Cs420 = 0,
12
+ /**
13
+ * Horizontally subsampled.
14
+ */
15
+ Cs422 = 1,
16
+ /**
17
+ * Not subsampled.
18
+ */
19
+ Cs444 = 2,
20
+ /**
21
+ * Monochrome.
22
+ */
23
+ Cs400 = 3,
7
24
  }
8
25
 
9
26
  export function animate_to(window_id: number, camera_target: any): void;
@@ -45,28 +62,28 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
45
62
 
46
63
  export interface InitOutput {
47
64
  readonly memory: WebAssembly.Memory;
48
- readonly animate_to: (a: number, b: any) => [number, number];
49
- readonly animate_to_route: (a: number, b: number, c: number) => [number, number];
50
- readonly create_window: (a: number, b: number, c: any) => number;
51
- readonly destroy_window: (a: number) => [number, number];
52
- readonly read_camera_pos: (a: number) => [number, number, number];
53
- readonly register_asset_decoder: (a: any) => void;
54
65
  readonly register_event_listener: (a: any) => void;
66
+ readonly register_asset_decoder: (a: any) => void;
67
+ readonly set_render_quality: (a: number, b: any) => [number, number];
55
68
  readonly set_gpu_memory_budget_mb: (a: number, b: number) => [number, number];
56
69
  readonly set_north_correction: (a: number, b: number) => [number, number];
57
- readonly set_render_quality: (a: number, b: any) => [number, number];
58
- readonly set_route_highlight: (a: number, b: number, c: number, d: number) => [number, number];
59
- readonly set_route_visible: (a: number, b: number, c: number, d: number) => [number, number];
60
70
  readonly set_sun_properties: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
61
- readonly set_window_action: (a: number, b: any) => [number, number];
62
71
  readonly set_window_scale: (a: number, b: number) => [number, number];
72
+ readonly read_camera_pos: (a: number) => [number, number, number];
73
+ readonly animate_to: (a: number, b: any) => [number, number];
74
+ readonly animate_to_route: (a: number, b: number, c: number) => [number, number];
75
+ readonly set_route_visible: (a: number, b: number, c: number, d: number) => [number, number];
76
+ readonly set_route_highlight: (a: number, b: number, c: number, d: number) => [number, number];
77
+ readonly destroy_window: (a: number) => [number, number];
78
+ readonly set_window_action: (a: number, b: any) => [number, number];
79
+ readonly create_window: (a: number, b: number, c: any) => number;
63
80
  readonly run: () => void;
64
- readonly wasm_bindgen__closure__destroy__h0f9502aef9ad7012: (a: number, b: number) => void;
65
- readonly wasm_bindgen__closure__destroy__h756fff185ea9610f: (a: number, b: number) => void;
66
- readonly wasm_bindgen__convert__closures_____invoke__h9bcfaf9db4ab96db: (a: number, b: number, c: any, d: any) => void;
67
- readonly wasm_bindgen__convert__closures_____invoke__h355f794c725ec492: (a: number, b: number, c: any) => void;
68
- readonly wasm_bindgen__convert__closures_____invoke__h11a2876e668b0630: (a: number, b: number, c: any) => void;
69
- readonly wasm_bindgen__convert__closures_____invoke__h81c46bf303557186: (a: number, b: number) => void;
81
+ readonly wasm_bindgen__closure__destroy__h17333457aae2b090: (a: number, b: number) => void;
82
+ readonly wasm_bindgen__closure__destroy__hf05ec8f078dda008: (a: number, b: number) => void;
83
+ readonly wasm_bindgen__convert__closures_____invoke__h2a85c969f4c20848: (a: number, b: number, c: any, d: any) => void;
84
+ readonly wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2: (a: number, b: number, c: any) => void;
85
+ readonly wasm_bindgen__convert__closures_____invoke__h07eaa4ea93496cfb: (a: number, b: number, c: any) => void;
86
+ readonly wasm_bindgen__convert__closures_____invoke__he5f4030ca973712a: (a: number, b: number) => void;
70
87
  readonly __wbindgen_malloc: (a: number, b: number) => number;
71
88
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
72
89
  readonly __externref_table_alloc: () => number;
@@ -1,11 +1,26 @@
1
1
  /* @ts-self-types="./sangine.d.ts" */
2
2
 
3
3
  /**
4
- * @enum {0 | 1}
4
+ * Chroma subsampling format
5
+ * @enum {0 | 1 | 2 | 3}
5
6
  */
6
- export const DecodeKind = Object.freeze({
7
- Webp: 0, "0": "Webp",
8
- Sbo: 1, "1": "Sbo",
7
+ export const ChromaSampling = Object.freeze({
8
+ /**
9
+ * Both vertically and horizontally subsampled.
10
+ */
11
+ Cs420: 0, "0": "Cs420",
12
+ /**
13
+ * Horizontally subsampled.
14
+ */
15
+ Cs422: 1, "1": "Cs422",
16
+ /**
17
+ * Not subsampled.
18
+ */
19
+ Cs444: 2, "2": "Cs444",
20
+ /**
21
+ * Monochrome.
22
+ */
23
+ Cs400: 3, "3": "Cs400",
9
24
  });
10
25
 
11
26
  /**
@@ -194,10 +209,6 @@ function __wbg_get_imports() {
194
209
  const ret = Error(getStringFromWasm0(arg0, arg1));
195
210
  return ret;
196
211
  },
197
- __wbg_Number_04624de7d0e8332d: function(arg0) {
198
- const ret = Number(arg0);
199
- return ret;
200
- },
201
212
  __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
202
213
  const ret = String(arg1);
203
214
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -454,6 +465,10 @@ function __wbg_get_imports() {
454
465
  const ret = arg0.call(arg1);
455
466
  return ret;
456
467
  }, arguments); },
468
+ __wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
469
+ const ret = arg0.call(arg1, arg2);
470
+ return ret;
471
+ }, arguments); },
457
472
  __wbg_call_812d25f1510c13c8: function() { return handleError(function (arg0, arg1, arg2, arg3) {
458
473
  const ret = arg0.call(arg1, arg2, arg3);
459
474
  return ret;
@@ -1212,10 +1227,6 @@ function __wbg_get_imports() {
1212
1227
  const ret = arg0.isIntersecting;
1213
1228
  return ret;
1214
1229
  },
1215
- __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
1216
- const ret = Number.isSafeInteger(arg0);
1217
- return ret;
1218
- },
1219
1230
  __wbg_is_f29129f676e5410c: function(arg0, arg1) {
1220
1231
  const ret = Object.is(arg0, arg1);
1221
1232
  return ret;
@@ -2607,53 +2618,53 @@ function __wbg_get_imports() {
2607
2618
  arg0.writeTexture(arg1, arg2, arg3, arg4);
2608
2619
  }, arguments); },
2609
2620
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2610
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3804, function: Function { arguments: [NamedExternref("Array<any>"), NamedExternref("ResizeObserver")], shim_idx: 3811, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2611
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f9502aef9ad7012, wasm_bindgen__convert__closures_____invoke__h9bcfaf9db4ab96db);
2621
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [NamedExternref("Array<any>"), NamedExternref("ResizeObserver")], shim_idx: 3776, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2622
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h2a85c969f4c20848);
2612
2623
  return ret;
2613
2624
  },
2614
2625
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2615
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3804, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 3805, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2616
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f9502aef9ad7012, wasm_bindgen__convert__closures_____invoke__h355f794c725ec492);
2626
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 3771, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2627
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2617
2628
  return ret;
2618
2629
  },
2619
2630
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2620
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3804, function: Function { arguments: [NamedExternref("Event")], shim_idx: 3805, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2621
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f9502aef9ad7012, wasm_bindgen__convert__closures_____invoke__h355f794c725ec492);
2631
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [NamedExternref("Event")], shim_idx: 3771, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2632
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2622
2633
  return ret;
2623
2634
  },
2624
2635
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
2625
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3804, function: Function { arguments: [NamedExternref("FocusEvent")], shim_idx: 3805, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2626
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f9502aef9ad7012, wasm_bindgen__convert__closures_____invoke__h355f794c725ec492);
2636
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [NamedExternref("FocusEvent")], shim_idx: 3771, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2637
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2627
2638
  return ret;
2628
2639
  },
2629
2640
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
2630
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3804, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 3805, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2631
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f9502aef9ad7012, wasm_bindgen__convert__closures_____invoke__h355f794c725ec492);
2641
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 3771, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2642
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2632
2643
  return ret;
2633
2644
  },
2634
2645
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
2635
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3804, function: Function { arguments: [NamedExternref("PageTransitionEvent")], shim_idx: 3805, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2636
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f9502aef9ad7012, wasm_bindgen__convert__closures_____invoke__h355f794c725ec492);
2646
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [NamedExternref("PageTransitionEvent")], shim_idx: 3771, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2647
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2637
2648
  return ret;
2638
2649
  },
2639
2650
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
2640
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3804, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 3805, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2641
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f9502aef9ad7012, wasm_bindgen__convert__closures_____invoke__h355f794c725ec492);
2651
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 3771, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2652
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2642
2653
  return ret;
2643
2654
  },
2644
2655
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
2645
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3804, function: Function { arguments: [NamedExternref("WheelEvent")], shim_idx: 3805, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2646
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f9502aef9ad7012, wasm_bindgen__convert__closures_____invoke__h355f794c725ec492);
2656
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [NamedExternref("WheelEvent")], shim_idx: 3771, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2657
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2647
2658
  return ret;
2648
2659
  },
2649
2660
  __wbindgen_cast_0000000000000009: function(arg0, arg1) {
2650
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3804, function: Function { arguments: [], shim_idx: 3808, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2651
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h0f9502aef9ad7012, wasm_bindgen__convert__closures_____invoke__h81c46bf303557186);
2661
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [], shim_idx: 3774, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2662
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__he5f4030ca973712a);
2652
2663
  return ret;
2653
2664
  },
2654
2665
  __wbindgen_cast_000000000000000a: function(arg0, arg1) {
2655
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3878, function: Function { arguments: [Externref], shim_idx: 3879, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2656
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h756fff185ea9610f, wasm_bindgen__convert__closures_____invoke__h11a2876e668b0630);
2666
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3827, function: Function { arguments: [Externref], shim_idx: 3828, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2667
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf05ec8f078dda008, wasm_bindgen__convert__closures_____invoke__h07eaa4ea93496cfb);
2657
2668
  return ret;
2658
2669
  },
2659
2670
  __wbindgen_cast_000000000000000b: function(arg0) {
@@ -2717,20 +2728,20 @@ function __wbg_get_imports() {
2717
2728
  };
2718
2729
  }
2719
2730
 
2720
- function wasm_bindgen__convert__closures_____invoke__h81c46bf303557186(arg0, arg1) {
2721
- wasm.wasm_bindgen__convert__closures_____invoke__h81c46bf303557186(arg0, arg1);
2731
+ function wasm_bindgen__convert__closures_____invoke__he5f4030ca973712a(arg0, arg1) {
2732
+ wasm.wasm_bindgen__convert__closures_____invoke__he5f4030ca973712a(arg0, arg1);
2722
2733
  }
2723
2734
 
2724
- function wasm_bindgen__convert__closures_____invoke__h355f794c725ec492(arg0, arg1, arg2) {
2725
- wasm.wasm_bindgen__convert__closures_____invoke__h355f794c725ec492(arg0, arg1, arg2);
2735
+ function wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2(arg0, arg1, arg2) {
2736
+ wasm.wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2(arg0, arg1, arg2);
2726
2737
  }
2727
2738
 
2728
- function wasm_bindgen__convert__closures_____invoke__h11a2876e668b0630(arg0, arg1, arg2) {
2729
- wasm.wasm_bindgen__convert__closures_____invoke__h11a2876e668b0630(arg0, arg1, arg2);
2739
+ function wasm_bindgen__convert__closures_____invoke__h07eaa4ea93496cfb(arg0, arg1, arg2) {
2740
+ wasm.wasm_bindgen__convert__closures_____invoke__h07eaa4ea93496cfb(arg0, arg1, arg2);
2730
2741
  }
2731
2742
 
2732
- function wasm_bindgen__convert__closures_____invoke__h9bcfaf9db4ab96db(arg0, arg1, arg2, arg3) {
2733
- wasm.wasm_bindgen__convert__closures_____invoke__h9bcfaf9db4ab96db(arg0, arg1, arg2, arg3);
2743
+ function wasm_bindgen__convert__closures_____invoke__h2a85c969f4c20848(arg0, arg1, arg2, arg3) {
2744
+ wasm.wasm_bindgen__convert__closures_____invoke__h2a85c969f4c20848(arg0, arg1, arg2, arg3);
2734
2745
  }
2735
2746
 
2736
2747
 
Binary file
@@ -1,28 +1,28 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const animate_to: (a: number, b: any) => [number, number];
5
- export const animate_to_route: (a: number, b: number, c: number) => [number, number];
6
- export const create_window: (a: number, b: number, c: any) => number;
7
- export const destroy_window: (a: number) => [number, number];
8
- export const read_camera_pos: (a: number) => [number, number, number];
9
- export const register_asset_decoder: (a: any) => void;
10
4
  export const register_event_listener: (a: any) => void;
5
+ export const register_asset_decoder: (a: any) => void;
6
+ export const set_render_quality: (a: number, b: any) => [number, number];
11
7
  export const set_gpu_memory_budget_mb: (a: number, b: number) => [number, number];
12
8
  export const set_north_correction: (a: number, b: number) => [number, number];
13
- export const set_render_quality: (a: number, b: any) => [number, number];
14
- export const set_route_highlight: (a: number, b: number, c: number, d: number) => [number, number];
15
- export const set_route_visible: (a: number, b: number, c: number, d: number) => [number, number];
16
9
  export const set_sun_properties: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
17
- export const set_window_action: (a: number, b: any) => [number, number];
18
10
  export const set_window_scale: (a: number, b: number) => [number, number];
11
+ export const read_camera_pos: (a: number) => [number, number, number];
12
+ export const animate_to: (a: number, b: any) => [number, number];
13
+ export const animate_to_route: (a: number, b: number, c: number) => [number, number];
14
+ export const set_route_visible: (a: number, b: number, c: number, d: number) => [number, number];
15
+ export const set_route_highlight: (a: number, b: number, c: number, d: number) => [number, number];
16
+ export const destroy_window: (a: number) => [number, number];
17
+ export const set_window_action: (a: number, b: any) => [number, number];
18
+ export const create_window: (a: number, b: number, c: any) => number;
19
19
  export const run: () => void;
20
- export const wasm_bindgen__closure__destroy__h0f9502aef9ad7012: (a: number, b: number) => void;
21
- export const wasm_bindgen__closure__destroy__h756fff185ea9610f: (a: number, b: number) => void;
22
- export const wasm_bindgen__convert__closures_____invoke__h9bcfaf9db4ab96db: (a: number, b: number, c: any, d: any) => void;
23
- export const wasm_bindgen__convert__closures_____invoke__h355f794c725ec492: (a: number, b: number, c: any) => void;
24
- export const wasm_bindgen__convert__closures_____invoke__h11a2876e668b0630: (a: number, b: number, c: any) => void;
25
- export const wasm_bindgen__convert__closures_____invoke__h81c46bf303557186: (a: number, b: number) => void;
20
+ export const wasm_bindgen__closure__destroy__h17333457aae2b090: (a: number, b: number) => void;
21
+ export const wasm_bindgen__closure__destroy__hf05ec8f078dda008: (a: number, b: number) => void;
22
+ export const wasm_bindgen__convert__closures_____invoke__h2a85c969f4c20848: (a: number, b: number, c: any, d: any) => void;
23
+ export const wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2: (a: number, b: number, c: any) => void;
24
+ export const wasm_bindgen__convert__closures_____invoke__h07eaa4ea93496cfb: (a: number, b: number, c: any) => void;
25
+ export const wasm_bindgen__convert__closures_____invoke__he5f4030ca973712a: (a: number, b: number) => void;
26
26
  export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __externref_table_alloc: () => number;
@@ -1,2 +1,5 @@
1
- export declare function registerDecodeWorker(self: DedicatedWorkerGlobalScope): void;
1
+ import { type DecodeTask } from '../types';
2
+ type UrlResolver = (task: DecodeTask) => Promise<string>;
3
+ export declare function registerDecodeWorker(self: DedicatedWorkerGlobalScope, urlResolver: UrlResolver): void;
4
+ export {};
2
5
  //# sourceMappingURL=decodeWorkerImpl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decodeWorkerImpl.d.ts","sourceRoot":"","sources":["../../src/worker/decodeWorkerImpl.ts"],"names":[],"mappings":"AAMA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,QA8EpE"}
1
+ {"version":3,"file":"decodeWorkerImpl.d.ts","sourceRoot":"","sources":["../../src/worker/decodeWorkerImpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA;AAI1C,KAAK,WAAW,GAAG,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;AAExD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,EAAE,WAAW,EAAE,WAAW,QA2F9F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanox/sangine-core",
3
- "version": "0.1.0",
3
+ "version": "0.2.2",
4
4
  "description": "Sangine core renderer runtime (WASM + workers)",
5
5
  "type": "module",
6
6
  "private": false,