@sanox/sangine-core 0.2.5 → 0.3.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.
@@ -16,6 +16,11 @@ export type DecodeTask = {
16
16
  pk: string;
17
17
  };
18
18
  };
19
+ /**
20
+ * This interface was referenced by `Schema`'s JSON-Schema
21
+ * via the `definition` "LightingMode".
22
+ */
23
+ export type LightingMode = "static" | "dynamic";
19
24
  /**
20
25
  * This interface was referenced by `Schema`'s JSON-Schema
21
26
  * via the `definition` "LodEnum".
@@ -54,6 +59,10 @@ export type SangineEvent = "ready" | {
54
59
  routeUnderConstructionUpdated: {
55
60
  route: Route;
56
61
  };
62
+ } | {
63
+ assetsDownloading: {
64
+ downloading: boolean;
65
+ };
57
66
  };
58
67
  /**
59
68
  * This interface was referenced by `Schema`'s JSON-Schema
@@ -80,6 +89,14 @@ export interface Vec3 {
80
89
  y: number;
81
90
  z: number;
82
91
  }
92
+ /**
93
+ * This interface was referenced by `Schema`'s JSON-Schema
94
+ * via the `definition` "IntensityAndTemperature".
95
+ */
96
+ export interface IntensityAndTemperature {
97
+ intensity: number;
98
+ temperature: number;
99
+ }
83
100
  /**
84
101
  * This interface was referenced by `Schema`'s JSON-Schema
85
102
  * via the `definition` "Material".
@@ -140,6 +157,25 @@ export interface ModelPart {
140
157
  };
141
158
  materials: string[];
142
159
  }
160
+ /**
161
+ * This interface was referenced by `Schema`'s JSON-Schema
162
+ * via the `definition` "RenderingSettings".
163
+ */
164
+ export interface RenderingSettings {
165
+ ambientLighting: IntensityAndTemperature;
166
+ lightingMode: LightingMode;
167
+ quality: RendererAssetQuality;
168
+ sun: SunProperties;
169
+ }
170
+ /**
171
+ * This interface was referenced by `Schema`'s JSON-Schema
172
+ * via the `definition` "SunProperties".
173
+ */
174
+ export interface SunProperties {
175
+ altitudeRad: number;
176
+ azimuthRad: number;
177
+ lightProperties: IntensityAndTemperature;
178
+ }
143
179
  /**
144
180
  * This interface was referenced by `Schema`'s JSON-Schema
145
181
  * via the `definition` "Route".
@@ -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;KACZ,CAAC;CACH,GACD;IACE,iBAAiB,EAAE;QACjB,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AACN;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AACvG;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC9D;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,KAAK,CAAC;AACxC;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AACvE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,OAAO,GACP;IACE,aAAa,EAAE;QACb,MAAM,EAAE,UAAU,CAAC;KACpB,CAAC;CACH,GACD;IACE,kBAAkB,EAAE;QAClB,WAAW,EAAE,WAAW,CAAC;KAC1B,CAAC;CACH,GACD;IACE,6BAA6B,EAAE;QAC7B,KAAK,EAAE,KAAK,CAAC;KACd,CAAC;CACH,CAAC;AACN;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,eAAe,GAAG,WAAW,GAAG,qBAAqB,CAAC;AAE5F,MAAM,WAAW,MAAM;IACrB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AACD;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,IAAI,CAAC;IACf,MAAM,EAAE,IAAI,CAAC;CACd;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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=(n,e,t)=>e in n?f(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var o=(n,e,t)=>y(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g="/static/sangine/wasm",_="77477298";class p{constructor(e,t){o(this,"workers");o(this,"idle");o(this,"queue",[]);this.workers=Array.from({length:t},e),this.idle=[...this.workers]}run(e){return new Promise((t,i)=>{const r=this.idle.pop();r?this.dispatch(r,e,t,i):this.queue.push({request:e,resolve:t,reject:i})})}dispatch(e,t,i,r){const d=s=>{i(s.data),a(),this.release(e)},c=s=>{r(s),a(),this.release(e)},a=()=>{e.removeEventListener("message",d),e.removeEventListener("error",c)};e.addEventListener("message",d,{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 R{constructor(e){o(this,"wasm",null);o(this,"callbackRegistry",{});o(this,"userActionRegistry",{});o(this,"windowCreatedPromiseRegistry",{});o(this,"windowCreatedPromiseResolveRegistry",{});o(this,"_inited",!1);o(this,"decodePool");o(this,"_readyPromise");o(this,"_resolveReady");o(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 p(()=>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 r=new Promise(c=>{i=c}),d=this.wasm.create_window(e,t);return this.windowCreatedPromiseResolveRegistry[d]=i,this.callbackRegistry[d]={actionChanged:[],routeUpdated:[],measurementCreated:[]},this.userActionRegistry[d]="watching",this.windowCreatedPromiseRegistry[d]=r,d}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,r,d,c,a){if(!this.wasm)throw new Error("WASM not initialized");this.wasm.set_sun_properties(e,t,i,r,d,c,a)}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 b="fa5ceba1";function A(n,e){let t=!1,i=null,r=null;async function d(c,a){if(r){const s=`https://sangine-asset-cache/${c}`,w=await r.match(s);if(w)return w;const l=await a(),h=await fetch(l);return h.ok&&await r.put(s,h.clone()),h}return fetch(await a())}n.onmessage=async c=>{if(!t){const w=await import(new URL(`${g}/sbo-decode/wasm_sbo_decode.${b}.js`,n.location.origin).href);await w.default(),i=w,t=!0}!r&&typeof caches<"u"&&(r=await caches.open("sangine-assets-v1"));const{data:a}=c;if("texture-file"in a)try{const s=await d(a["texture-file"].pk,()=>e(a));if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const w=await s.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);n.postMessage({success:!0,width:h.width,height:h.height,data:u.data.buffer},[u.data.buffer])}catch(s){n.postMessage({success:!1,error:s.message})}else if("model-part-mesh"in a){const s=await d(a["model-part-mesh"].pk,()=>e(a));if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const w=await s.arrayBuffer(),l=new Uint8Array(w),h=i.decode_sbo(l);n.postMessage({success:!0,data:h.buffer},[h.buffer])}}}exports.RendererService=R;exports.registerDecodeWorker=A;
1
+ "use strict";var f=Object.defineProperty;var y=(o,e,t)=>e in o?f(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var r=(o,e,t)=>y(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g="/static/sangine/wasm",_="4ff87b52";class R{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 n=this.idle.pop();n?this.dispatch(n,e,t,s):this.queue.push({request:e,resolve:t,reject:s})})}dispatch(e,t,s,n){const w=i=>{s(i.data),a(),this.release(e)},d=i=>{n(i),a(),this.release(e)},a=()=>{e.removeEventListener("message",w),e.removeEventListener("error",d)};e.addEventListener("message",w,{once:!0}),e.addEventListener("error",d,{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,"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(`${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 R(()=>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)}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):"assetsDownloading"in t&&this.handleAssetsDownloading(e,t.assetsDownloading.downloading)}createWindow(e,t,s){if(!this.wasm)throw new Error("WASM not initialized");let n;const w=new Promise(a=>{n=a}),d=this.wasm.create_window(e,t,s);return this.windowCreatedPromiseResolveRegistry[d]=n,this.callbackRegistry[d]={actionChanged:[],routeUpdated:[],measurementCreated:[],assetsDownloading:[]},this.userActionRegistry[d]="watching",this.windowCreatedPromiseRegistry[d]=w,d}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 b="fa5ceba1";function A(o,e){let t=!1,s=null,n=null;async function w(d,a){if(n){const i=`https://sangine-asset-cache/${d}`,c=await n.match(i);if(c)return c;const l=await a(),h=await fetch(l);return h.ok&&await n.put(i,h.clone()),h}return fetch(await a())}o.onmessage=async d=>{if(!t){const c=await import(new URL(`${g}/sbo-decode/wasm_sbo_decode.${b}.js`,o.location.origin).href);await c.default(),s=c,t=!0}!n&&typeof caches<"u"&&(n=await caches.open("sangine-assets-v1"));const{data:a}=d;if("texture-file"in a)try{const i=await w(a["texture-file"].pk,()=>e(a));if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);const c=await i.blob(),l=await createImageBitmap(c),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);o.postMessage({success:!0,width:h.width,height:h.height,data:u.data.buffer},[u.data.buffer])}catch(i){o.postMessage({success:!1,error:i.message})}else if("model-part-mesh"in a){const i=await w(a["model-part-mesh"].pk,()=>e(a));if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);const c=await i.arrayBuffer(),l=new Uint8Array(c),h=s.decode_sbo(l);o.postMessage({success:!0,data:h.buffer},[h.buffer])}}}exports.RendererService=p;exports.registerDecodeWorker=A;
package/dist/index.es.js CHANGED
@@ -1,29 +1,29 @@
1
- var g = Object.defineProperty;
2
- var y = (n, e, t) => e in n ? g(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var o = (n, e, t) => y(n, typeof e != "symbol" ? e + "" : e, t);
4
- const f = "/static/sangine/wasm", _ = "77477298";
5
- class p {
1
+ var f = Object.defineProperty;
2
+ var y = (o, e, t) => e in o ? f(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var r = (o, e, t) => y(o, typeof e != "symbol" ? e + "" : e, t);
4
+ const g = "/static/sangine/wasm", _ = "4ff87b52";
5
+ class R {
6
6
  constructor(e, t) {
7
- o(this, "workers");
8
- o(this, "idle");
9
- o(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
13
  return new Promise((t, s) => {
14
- const r = this.idle.pop();
15
- r ? this.dispatch(r, e, t, s) : this.queue.push({ request: e, resolve: t, reject: s });
14
+ const n = this.idle.pop();
15
+ n ? this.dispatch(n, e, t, s) : this.queue.push({ request: e, resolve: t, reject: s });
16
16
  });
17
17
  }
18
- dispatch(e, t, s, r) {
19
- const d = (i) => {
18
+ dispatch(e, t, s, n) {
19
+ const w = (i) => {
20
20
  s(i.data), a(), this.release(e);
21
- }, c = (i) => {
22
- r(i), a(), this.release(e);
21
+ }, h = (i) => {
22
+ n(i), a(), this.release(e);
23
23
  }, a = () => {
24
- e.removeEventListener("message", d), e.removeEventListener("error", c);
24
+ e.removeEventListener("message", w), e.removeEventListener("error", h);
25
25
  };
26
- e.addEventListener("message", d, { once: !0 }), e.addEventListener("error", c, { once: !0 }), e.postMessage(t);
26
+ e.addEventListener("message", w, { once: !0 }), e.addEventListener("error", h, { once: !0 }), e.postMessage(t);
27
27
  }
28
28
  release(e) {
29
29
  const t = this.queue.shift();
@@ -34,18 +34,19 @@ class p {
34
34
  e.terminate();
35
35
  }
36
36
  }
37
- class A {
37
+ class b {
38
38
  constructor(e) {
39
- o(this, "wasm", null);
40
- o(this, "callbackRegistry", {});
41
- o(this, "userActionRegistry", {});
42
- o(this, "windowCreatedPromiseRegistry", {});
43
- o(this, "windowCreatedPromiseResolveRegistry", {});
44
- o(this, "_inited", !1);
45
- o(this, "decodePool");
46
- o(this, "_readyPromise");
47
- o(this, "_resolveReady");
48
- o(this, "_rejectReady");
39
+ r(this, "wasm", null);
40
+ r(this, "callbackRegistry", {});
41
+ r(this, "userActionRegistry", {});
42
+ r(this, "assetsDownloadingRegistry", {});
43
+ r(this, "windowCreatedPromiseRegistry", {});
44
+ r(this, "windowCreatedPromiseResolveRegistry", {});
45
+ r(this, "_inited", !1);
46
+ r(this, "decodePool");
47
+ r(this, "_readyPromise");
48
+ r(this, "_resolveReady");
49
+ r(this, "_rejectReady");
49
50
  this.config = e, this._readyPromise = new Promise((t, s) => {
50
51
  this._resolveReady = t, this._rejectReady = s;
51
52
  }), this.config = e;
@@ -55,12 +56,12 @@ class A {
55
56
  if (this._inited) return this._readyPromise;
56
57
  try {
57
58
  const t = await import(new URL(
58
- `${f}/sangine/sangine.${_}.js`,
59
+ `${g}/sangine/sangine.${_}.js`,
59
60
  window.location.origin
60
61
  ).toString());
61
62
  await t.default(), this.wasm = t, this._inited = !0;
62
63
  const s = this.config.numWorkers ?? (navigator.hardwareConcurrency || 2) - 1;
63
- this.decodePool = new p(
64
+ this.decodePool = new R(
64
65
  () => this.config.createDecodeWorker(),
65
66
  Math.max(s, 1)
66
67
  ), this.wasm.register_asset_decoder(this.decodeAsset.bind(this)), this.wasm.register_event_listener(this.handleSangineEvent.bind(this)), this._resolveReady();
@@ -94,20 +95,29 @@ class A {
94
95
  for (const s of this.callbackRegistry[e].routeUpdated)
95
96
  s(t);
96
97
  }
98
+ handleAssetsDownloading(e, t) {
99
+ this.assetsDownloadingRegistry[e] = t;
100
+ for (const s of this.callbackRegistry[e].assetsDownloading)
101
+ s(t);
102
+ }
97
103
  handleSangineEvent(e, t) {
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);
104
+ 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) : "assetsDownloading" in t && this.handleAssetsDownloading(e, t.assetsDownloading.downloading);
99
105
  }
100
- createWindow(e, t) {
106
+ createWindow(e, t, s) {
101
107
  if (!this.wasm) throw new Error("WASM not initialized");
102
- let s;
103
- const r = new Promise((c) => {
104
- s = c;
105
- }), d = this.wasm.create_window(e, t);
106
- return this.windowCreatedPromiseResolveRegistry[d] = s, this.callbackRegistry[d] = {
108
+ let n;
109
+ const w = new Promise((a) => {
110
+ n = a;
111
+ }), h = this.wasm.create_window(e, t, s);
112
+ return this.windowCreatedPromiseResolveRegistry[h] = n, this.callbackRegistry[h] = {
107
113
  actionChanged: [],
108
114
  routeUpdated: [],
109
- measurementCreated: []
110
- }, this.userActionRegistry[d] = "watching", this.windowCreatedPromiseRegistry[d] = r, d;
115
+ measurementCreated: [],
116
+ assetsDownloading: []
117
+ }, this.userActionRegistry[h] = "watching", this.windowCreatedPromiseRegistry[h] = w, h;
118
+ }
119
+ getAssetsDownloading(e) {
120
+ return this.assetsDownloadingRegistry[e] || !1;
111
121
  }
112
122
  readUserAction(e) {
113
123
  return this.userActionRegistry[e];
@@ -138,17 +148,17 @@ class A {
138
148
  if (!this.wasm) throw new Error("WASM not initialized");
139
149
  this.wasm.animate_to_route(e, t);
140
150
  }
141
- setSunProperties(e, t, s, r, d, c, a) {
151
+ setSunProperties(e, t) {
152
+ if (!this.wasm) throw new Error("WASM not initialized");
153
+ this.wasm.set_sun_properties(e, t);
154
+ }
155
+ setAmbientLighting(e, t) {
156
+ if (!this.wasm) throw new Error("WASM not initialized");
157
+ this.wasm.set_ambient_lighting(e, t);
158
+ }
159
+ setLightingMode(e, t) {
142
160
  if (!this.wasm) throw new Error("WASM not initialized");
143
- this.wasm.set_sun_properties(
144
- e,
145
- t,
146
- s,
147
- r,
148
- d,
149
- c,
150
- a
151
- );
161
+ this.wasm.set_lighting_mode(e, t);
152
162
  }
153
163
  setNorthCorrection(e, t) {
154
164
  if (!this.wasm) throw new Error("WASM not initialized");
@@ -183,66 +193,66 @@ class A {
183
193
  (e = this.decodePool) == null || e.terminate();
184
194
  }
185
195
  }
186
- const R = "fa5ceba1";
187
- function E(n, e) {
188
- let t = !1, s = null, r = null;
189
- async function d(c, a) {
190
- if (r) {
191
- const i = `https://sangine-asset-cache/${c}`, w = await r.match(i);
192
- if (w) return w;
193
- const l = await a(), h = await fetch(l);
194
- return h.ok && await r.put(i, h.clone()), h;
196
+ const p = "fa5ceba1";
197
+ function E(o, e) {
198
+ let t = !1, s = null, n = null;
199
+ async function w(h, a) {
200
+ if (n) {
201
+ const i = `https://sangine-asset-cache/${h}`, c = await n.match(i);
202
+ if (c) return c;
203
+ const l = await a(), d = await fetch(l);
204
+ return d.ok && await n.put(i, d.clone()), d;
195
205
  }
196
206
  return fetch(await a());
197
207
  }
198
- n.onmessage = async (c) => {
208
+ o.onmessage = async (h) => {
199
209
  if (!t) {
200
- const w = await import(new URL(
201
- `${f}/sbo-decode/wasm_sbo_decode.${R}.js`,
202
- n.location.origin
210
+ const c = await import(new URL(
211
+ `${g}/sbo-decode/wasm_sbo_decode.${p}.js`,
212
+ o.location.origin
203
213
  ).href);
204
- await w.default(), s = w, t = !0;
214
+ await c.default(), s = c, t = !0;
205
215
  }
206
- !r && typeof caches < "u" && (r = await caches.open("sangine-assets-v1"));
207
- const { data: a } = c;
216
+ !n && typeof caches < "u" && (n = await caches.open("sangine-assets-v1"));
217
+ const { data: a } = h;
208
218
  if ("texture-file" in a)
209
219
  try {
210
- const i = await d(a["texture-file"].pk, () => e(a));
220
+ const i = await w(a["texture-file"].pk, () => e(a));
211
221
  if (!i.ok)
212
222
  throw new Error(`HTTP error! status: ${i.status}`);
213
- const w = await i.blob(), l = await createImageBitmap(w), h = new OffscreenCanvas(l.width, l.height), m = h.getContext("2d");
223
+ const c = await i.blob(), l = await createImageBitmap(c), d = new OffscreenCanvas(l.width, l.height), m = d.getContext("2d");
214
224
  if (m === null)
215
225
  throw new Error("Couldnt create canvas");
216
226
  m.drawImage(l, 0, 0);
217
- const u = m.getImageData(0, 0, h.width, h.height);
218
- n.postMessage(
227
+ const u = m.getImageData(0, 0, d.width, d.height);
228
+ o.postMessage(
219
229
  {
220
230
  success: !0,
221
- width: h.width,
222
- height: h.height,
231
+ width: d.width,
232
+ height: d.height,
223
233
  data: u.data.buffer
224
234
  },
225
235
  [u.data.buffer]
226
236
  );
227
237
  } catch (i) {
228
- n.postMessage({ success: !1, error: i.message });
238
+ o.postMessage({ success: !1, error: i.message });
229
239
  }
230
240
  else if ("model-part-mesh" in a) {
231
- const i = await d(a["model-part-mesh"].pk, () => e(a));
241
+ const i = await w(a["model-part-mesh"].pk, () => e(a));
232
242
  if (!i.ok)
233
243
  throw new Error(`HTTP error! status: ${i.status}`);
234
- const w = await i.arrayBuffer(), l = new Uint8Array(w), h = s.decode_sbo(l);
235
- n.postMessage(
244
+ const c = await i.arrayBuffer(), l = new Uint8Array(c), d = s.decode_sbo(l);
245
+ o.postMessage(
236
246
  {
237
247
  success: !0,
238
- data: h.buffer
248
+ data: d.buffer
239
249
  },
240
- [h.buffer]
250
+ [d.buffer]
241
251
  );
242
252
  }
243
253
  };
244
254
  }
245
255
  export {
246
- A as RendererService,
256
+ b as RendererService,
247
257
  E as registerDecodeWorker
248
258
  };
@@ -1,18 +1,21 @@
1
- import type { CameraPos, DecodeTask, Measurement, RendererAssetQuality, RendererConfig, Route, SangineEvent, Scene, UserAction } from './types.js';
1
+ import type { CameraPos, DecodeTask, IntensityAndTemperature, LightingMode, Measurement, RendererAssetQuality, RendererConfig, RenderingSettings, Route, SangineEvent, Scene, SunProperties, 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;
5
5
  type MeasurementCreatedCallback = (measurement: Measurement) => void;
6
+ type AssetsDownloadingCallback = (downloading: boolean) => void;
6
7
  interface CallbackMap {
7
8
  actionChanged: ActionChangedCallback;
8
9
  routeUpdated: RouteUpdatedCallback;
9
10
  measurementCreated: MeasurementCreatedCallback;
11
+ assetsDownloading: AssetsDownloadingCallback;
10
12
  }
11
13
  export declare class RendererService {
12
14
  private config;
13
15
  private wasm;
14
16
  private callbackRegistry;
15
17
  private userActionRegistry;
18
+ private assetsDownloadingRegistry;
16
19
  private windowCreatedPromiseRegistry;
17
20
  private windowCreatedPromiseResolveRegistry;
18
21
  private _inited;
@@ -28,8 +31,10 @@ export declare class RendererService {
28
31
  handleActionChanged(windowId: number, action: UserAction): void;
29
32
  handleMeasurementCreated(windowId: number, measurement: Measurement): void;
30
33
  handleRouteUpdated(windowId: number, route: Route): void;
34
+ handleAssetsDownloading(windowId: number, downloading: boolean): void;
31
35
  handleSangineEvent(windowId: number, event: SangineEvent): void;
32
- createWindow(containerId: string, scene: Scene): number;
36
+ createWindow(containerId: string, scene: Scene, settings: RenderingSettings | undefined): number;
37
+ getAssetsDownloading(containerId: number): boolean;
33
38
  readUserAction(windowId: number): UserAction;
34
39
  windowReady(windowId: number): Promise<void>;
35
40
  registerCallback<K extends keyof CallbackMap>(windowId: number, event: K, callback: CallbackMap[K]): void;
@@ -38,7 +43,9 @@ export declare class RendererService {
38
43
  setRouteHighlight(windowId: number, routeId: string, highlight: number): void;
39
44
  setRouteVisible(windowId: number, routeId: string, visible: number): void;
40
45
  animateToRoute(windowId: number, routeId: string): void;
41
- setSunProperties(windowId: number, altitudeRad: number, azimuthRad: number, colorR: number, colorG: number, colorB: number, intensity: number): void;
46
+ setSunProperties(windowId: number, sunProperties: SunProperties): void;
47
+ setAmbientLighting(windowId: number, properties: IntensityAndTemperature): void;
48
+ setLightingMode(windowId: number, mode: LightingMode): void;
42
49
  setNorthCorrection(windowId: number, northCorrection: number): void;
43
50
  setGpuMemoryBudgetMb(windowId: number, memoryMb: number): void;
44
51
  setRenderQuality(windowId: number, quality: RendererAssetQuality): void;
@@ -1 +1 @@
1
- {"version":3,"file":"rendererService.d.ts","sourceRoot":"","sources":["../src/rendererService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,cAAc,EACd,KAAK,EACL,YAAY,EACZ,KAAK,EACL,UAAU,EACX,MAAM,YAAY,CAAA;AAEnB,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,CA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,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"}
@@ -50,13 +50,17 @@ export function animate_to_route(window_id, route_id) {
50
50
  /**
51
51
  * @param {string} container_id
52
52
  * @param {any} scene
53
+ * @param {any | null} [rendering_settings]
53
54
  * @returns {number}
54
55
  */
55
- export function create_window(container_id, scene) {
56
+ export function create_window(container_id, scene, rendering_settings) {
56
57
  const ptr0 = passStringToWasm0(container_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
57
58
  const len0 = WASM_VECTOR_LEN;
58
- const ret = wasm.create_window(ptr0, len0, scene);
59
- return ret >>> 0;
59
+ const ret = wasm.create_window(ptr0, len0, scene, isLikeNone(rendering_settings) ? 0 : addToExternrefTable0(rendering_settings));
60
+ if (ret[2]) {
61
+ throw takeFromExternrefTable0(ret[1]);
62
+ }
63
+ return ret[0] >>> 0;
60
64
  }
61
65
 
62
66
  /**
@@ -103,6 +107,17 @@ export function run() {
103
107
  wasm.run();
104
108
  }
105
109
 
110
+ /**
111
+ * @param {number} window_id
112
+ * @param {any} properties
113
+ */
114
+ export function set_ambient_lighting(window_id, properties) {
115
+ const ret = wasm.set_ambient_lighting(window_id, properties);
116
+ if (ret[1]) {
117
+ throw takeFromExternrefTable0(ret[0]);
118
+ }
119
+ }
120
+
106
121
  /**
107
122
  * @param {number} window_id
108
123
  * @param {number} memory_budget
@@ -114,6 +129,17 @@ export function set_gpu_memory_budget_mb(window_id, memory_budget) {
114
129
  }
115
130
  }
116
131
 
132
+ /**
133
+ * @param {number} window_id
134
+ * @param {any} mode
135
+ */
136
+ export function set_lighting_mode(window_id, mode) {
137
+ const ret = wasm.set_lighting_mode(window_id, mode);
138
+ if (ret[1]) {
139
+ throw takeFromExternrefTable0(ret[0]);
140
+ }
141
+ }
142
+
117
143
  /**
118
144
  * @param {number} window_id
119
145
  * @param {number} north_correction
@@ -166,15 +192,10 @@ export function set_route_visible(window_id, route_id, visible) {
166
192
 
167
193
  /**
168
194
  * @param {number} window_id
169
- * @param {number} altitude_rad
170
- * @param {number} azimuth_rad
171
- * @param {number} color_r
172
- * @param {number} color_g
173
- * @param {number} color_b
174
- * @param {number} intensity
195
+ * @param {any} properties
175
196
  */
176
- export function set_sun_properties(window_id, altitude_rad, azimuth_rad, color_r, color_g, color_b, intensity) {
177
- const ret = wasm.set_sun_properties(window_id, altitude_rad, azimuth_rad, color_r, color_g, color_b, intensity);
197
+ export function set_sun_properties(window_id, properties) {
198
+ const ret = wasm.set_sun_properties(window_id, properties);
178
199
  if (ret[1]) {
179
200
  throw takeFromExternrefTable0(ret[0]);
180
201
  }
@@ -209,6 +230,10 @@ function __wbg_get_imports() {
209
230
  const ret = Error(getStringFromWasm0(arg0, arg1));
210
231
  return ret;
211
232
  },
233
+ __wbg_Number_04624de7d0e8332d: function(arg0) {
234
+ const ret = Number(arg0);
235
+ return ret;
236
+ },
212
237
  __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {
213
238
  const ret = String(arg1);
214
239
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1227,6 +1252,10 @@ function __wbg_get_imports() {
1227
1252
  const ret = arg0.isIntersecting;
1228
1253
  return ret;
1229
1254
  },
1255
+ __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {
1256
+ const ret = Number.isSafeInteger(arg0);
1257
+ return ret;
1258
+ },
1230
1259
  __wbg_is_f29129f676e5410c: function(arg0, arg1) {
1231
1260
  const ret = Object.is(arg0, arg1);
1232
1261
  return ret;
@@ -2618,52 +2647,52 @@ function __wbg_get_imports() {
2618
2647
  arg0.writeTexture(arg1, arg2, arg3, arg4);
2619
2648
  }, arguments); },
2620
2649
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
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`.
2650
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3794, function: Function { arguments: [NamedExternref("Array<any>"), NamedExternref("ResizeObserver")], shim_idx: 3800, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2622
2651
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h2a85c969f4c20848);
2623
2652
  return ret;
2624
2653
  },
2625
2654
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
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`.
2655
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3794, function: Function { arguments: [NamedExternref("Array<any>")], shim_idx: 3795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2627
2656
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2628
2657
  return ret;
2629
2658
  },
2630
2659
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
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`.
2660
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3794, function: Function { arguments: [NamedExternref("Event")], shim_idx: 3795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2632
2661
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2633
2662
  return ret;
2634
2663
  },
2635
2664
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
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`.
2665
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3794, function: Function { arguments: [NamedExternref("FocusEvent")], shim_idx: 3795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2637
2666
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2638
2667
  return ret;
2639
2668
  },
2640
2669
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
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`.
2670
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3794, function: Function { arguments: [NamedExternref("KeyboardEvent")], shim_idx: 3795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2642
2671
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2643
2672
  return ret;
2644
2673
  },
2645
2674
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
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`.
2675
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3794, function: Function { arguments: [NamedExternref("PageTransitionEvent")], shim_idx: 3795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2647
2676
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2648
2677
  return ret;
2649
2678
  },
2650
2679
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
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`.
2680
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3794, function: Function { arguments: [NamedExternref("PointerEvent")], shim_idx: 3795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2652
2681
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2653
2682
  return ret;
2654
2683
  },
2655
2684
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
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`.
2685
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3794, function: Function { arguments: [NamedExternref("WheelEvent")], shim_idx: 3795, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2657
2686
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__h091d820f15c8c0c2);
2658
2687
  return ret;
2659
2688
  },
2660
2689
  __wbindgen_cast_0000000000000009: function(arg0, arg1) {
2661
- // Cast intrinsic for `Closure(Closure { dtor_idx: 3770, function: Function { arguments: [], shim_idx: 3774, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2690
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3794, function: Function { arguments: [], shim_idx: 3798, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2662
2691
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h17333457aae2b090, wasm_bindgen__convert__closures_____invoke__he5f4030ca973712a);
2663
2692
  return ret;
2664
2693
  },
2665
2694
  __wbindgen_cast_000000000000000a: function(arg0, arg1) {
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`.
2695
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 3851, function: Function { arguments: [Externref], shim_idx: 3852, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2667
2696
  const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf05ec8f078dda008, wasm_bindgen__convert__closures_____invoke__h07eaa4ea93496cfb);
2668
2697
  return ret;
2669
2698
  },
@@ -2721,6 +2750,10 @@ function __wbg_get_imports() {
2721
2750
  table.set(offset + 2, true);
2722
2751
  table.set(offset + 3, false);
2723
2752
  },
2753
+ __wbindgen_object_is_undefined: function(arg0) {
2754
+ const ret = arg0 === undefined;
2755
+ return ret;
2756
+ },
2724
2757
  };
2725
2758
  return {
2726
2759
  __proto__: null,
@@ -3201,7 +3234,7 @@ async function __wbg_init(module_or_path) {
3201
3234
  }
3202
3235
 
3203
3236
  if (module_or_path === undefined) {
3204
- module_or_path = new URL('sangine_bg.77477298.wasm', import.meta.url);
3237
+ module_or_path = new URL('sangine_bg.4ff87b52.wasm', import.meta.url);
3205
3238
  }
3206
3239
  const imports = __wbg_get_imports();
3207
3240
 
@@ -27,7 +27,7 @@ export function animate_to(window_id: number, camera_target: any): void;
27
27
 
28
28
  export function animate_to_route(window_id: number, route_id: string): void;
29
29
 
30
- export function create_window(container_id: string, scene: any): number;
30
+ export function create_window(container_id: string, scene: any, rendering_settings?: any | null): number;
31
31
 
32
32
  export function destroy_window(window_id: number): void;
33
33
 
@@ -42,8 +42,12 @@ export function register_event_listener(event_listener: Function): void;
42
42
 
43
43
  export function run(): Promise<void>;
44
44
 
45
+ export function set_ambient_lighting(window_id: number, properties: any): void;
46
+
45
47
  export function set_gpu_memory_budget_mb(window_id: number, memory_budget: number): void;
46
48
 
49
+ export function set_lighting_mode(window_id: number, mode: any): void;
50
+
47
51
  export function set_north_correction(window_id: number, north_correction: number): void;
48
52
 
49
53
  export function set_render_quality(window_id: number, quality: any): void;
@@ -52,7 +56,7 @@ export function set_route_highlight(window_id: number, route_id: string, highlig
52
56
 
53
57
  export function set_route_visible(window_id: number, route_id: string, visible: number): void;
54
58
 
55
- export function set_sun_properties(window_id: number, altitude_rad: number, azimuth_rad: number, color_r: number, color_g: number, color_b: number, intensity: number): void;
59
+ export function set_sun_properties(window_id: number, properties: any): void;
56
60
 
57
61
  export function set_window_action(window_id: number, action: any): void;
58
62
 
@@ -64,10 +68,12 @@ export interface InitOutput {
64
68
  readonly memory: WebAssembly.Memory;
65
69
  readonly register_event_listener: (a: any) => void;
66
70
  readonly register_asset_decoder: (a: any) => void;
71
+ readonly set_lighting_mode: (a: number, b: any) => [number, number];
72
+ readonly set_ambient_lighting: (a: number, b: any) => [number, number];
67
73
  readonly set_render_quality: (a: number, b: any) => [number, number];
68
74
  readonly set_gpu_memory_budget_mb: (a: number, b: number) => [number, number];
69
75
  readonly set_north_correction: (a: number, b: number) => [number, number];
70
- readonly set_sun_properties: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
76
+ readonly set_sun_properties: (a: number, b: any) => [number, number];
71
77
  readonly set_window_scale: (a: number, b: number) => [number, number];
72
78
  readonly read_camera_pos: (a: number) => [number, number, number];
73
79
  readonly animate_to: (a: number, b: any) => [number, number];
@@ -76,7 +82,7 @@ export interface InitOutput {
76
82
  readonly set_route_highlight: (a: number, b: number, c: number, d: number) => [number, number];
77
83
  readonly destroy_window: (a: number) => [number, number];
78
84
  readonly set_window_action: (a: number, b: any) => [number, number];
79
- readonly create_window: (a: number, b: number, c: any) => number;
85
+ readonly create_window: (a: number, b: number, c: any, d: number) => [number, number, number];
80
86
  readonly run: () => void;
81
87
  readonly wasm_bindgen__closure__destroy__h17333457aae2b090: (a: number, b: number) => void;
82
88
  readonly wasm_bindgen__closure__destroy__hf05ec8f078dda008: (a: number, b: number) => void;
@@ -3,10 +3,12 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const register_event_listener: (a: any) => void;
5
5
  export const register_asset_decoder: (a: any) => void;
6
+ export const set_lighting_mode: (a: number, b: any) => [number, number];
7
+ export const set_ambient_lighting: (a: number, b: any) => [number, number];
6
8
  export const set_render_quality: (a: number, b: any) => [number, number];
7
9
  export const set_gpu_memory_budget_mb: (a: number, b: number) => [number, number];
8
10
  export const set_north_correction: (a: number, b: number) => [number, number];
9
- export const set_sun_properties: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
11
+ export const set_sun_properties: (a: number, b: any) => [number, number];
10
12
  export const set_window_scale: (a: number, b: number) => [number, number];
11
13
  export const read_camera_pos: (a: number) => [number, number, number];
12
14
  export const animate_to: (a: number, b: any) => [number, number];
@@ -15,7 +17,7 @@ export const set_route_visible: (a: number, b: number, c: number, d: number) =>
15
17
  export const set_route_highlight: (a: number, b: number, c: number, d: number) => [number, number];
16
18
  export const destroy_window: (a: number) => [number, number];
17
19
  export const set_window_action: (a: number, b: any) => [number, number];
18
- export const create_window: (a: number, b: number, c: any) => number;
20
+ export const create_window: (a: number, b: number, c: any, d: number) => [number, number, number];
19
21
  export const run: () => void;
20
22
  export const wasm_bindgen__closure__destroy__h17333457aae2b090: (a: number, b: number) => void;
21
23
  export const wasm_bindgen__closure__destroy__hf05ec8f078dda008: (a: number, b: number) => void;
@@ -1,2 +1,2 @@
1
- export declare const SANGINE_HASH = "77477298";
1
+ export declare const SANGINE_HASH = "4ff87b52";
2
2
  //# sourceMappingURL=sangine.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanox/sangine-core",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "Sangine core renderer runtime (WASM + workers)",
5
5
  "type": "module",
6
6
  "private": false,
@@ -38,6 +38,7 @@
38
38
  "build:wasm-dev": "./build-sangine.sh --dev && ./build-workers.sh --dev",
39
39
  "build:js": "./build-types.sh && vite build && tsc --emitDeclarationOnly",
40
40
  "build": "./build-sangine.sh && ./build-workers.sh && ./build-types.sh && vite build && tsc --emitDeclarationOnly",
41
+ "build-dev": "./build-sangine.sh --dev && ./build-workers.sh --dev && ./build-types.sh && vite build && tsc --emitDeclarationOnly",
41
42
  "clean": "rm -rf dist",
42
43
  "dev": "vite build --watch",
43
44
  "typecheck": "tsc --noEmit",