@sanox/sangine-core 0.2.6 → 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.
- package/dist/gen-types.d.ts +32 -0
- package/dist/gen-types.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +59 -59
- package/dist/rendererService.d.ts +5 -3
- package/dist/rendererService.d.ts.map +1 -1
- package/dist/wasm/sangine/{sangine.2f6d6a9d.js → sangine.4ff87b52.js} +55 -22
- package/dist/wasm/sangine/sangine.d.ts +10 -4
- package/dist/wasm/sangine/{sangine_bg.2f6d6a9d.wasm → sangine_bg.4ff87b52.wasm} +0 -0
- package/dist/wasm/sangine/sangine_bg.wasm.d.ts +4 -2
- package/dist/wasm-hashes/sangine.d.ts +1 -1
- package/package.json +2 -1
package/dist/gen-types.d.ts
CHANGED
|
@@ -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".
|
|
@@ -84,6 +89,14 @@ export interface Vec3 {
|
|
|
84
89
|
y: number;
|
|
85
90
|
z: number;
|
|
86
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
|
+
}
|
|
87
100
|
/**
|
|
88
101
|
* This interface was referenced by `Schema`'s JSON-Schema
|
|
89
102
|
* via the `definition` "Material".
|
|
@@ -144,6 +157,25 @@ export interface ModelPart {
|
|
|
144
157
|
};
|
|
145
158
|
materials: string[];
|
|
146
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
|
+
}
|
|
147
179
|
/**
|
|
148
180
|
* This interface was referenced by `Schema`'s JSON-Schema
|
|
149
181
|
* via the `definition` "Route".
|
package/dist/gen-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen-types.d.ts","sourceRoot":"","sources":["../src/gen-types.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB;IACE,cAAc,EAAE;QACd,EAAE,EAAE,MAAM,CAAC;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,K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EAAE,MAAM,CAAC;KACrB,CAAC;IACF,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AACD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,uBAAuB,CAAC;IACzC,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,GAAG,EAAE,aAAa,CAAC;CACpB;AACD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,uBAAuB,CAAC;CAC1C;AACD;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;CAClB;AACD;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,mBAAmB,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACtC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var y=(
|
|
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,7 +1,7 @@
|
|
|
1
1
|
var f = Object.defineProperty;
|
|
2
|
-
var y = (
|
|
3
|
-
var r = (
|
|
4
|
-
const g = "/static/sangine/wasm", _ = "
|
|
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
5
|
class R {
|
|
6
6
|
constructor(e, t) {
|
|
7
7
|
r(this, "workers");
|
|
@@ -11,19 +11,19 @@ class R {
|
|
|
11
11
|
}
|
|
12
12
|
run(e) {
|
|
13
13
|
return new Promise((t, s) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
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,
|
|
19
|
-
const
|
|
20
|
-
s(i.data),
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
e.removeEventListener("message",
|
|
18
|
+
dispatch(e, t, s, n) {
|
|
19
|
+
const w = (i) => {
|
|
20
|
+
s(i.data), a(), this.release(e);
|
|
21
|
+
}, h = (i) => {
|
|
22
|
+
n(i), a(), this.release(e);
|
|
23
|
+
}, a = () => {
|
|
24
|
+
e.removeEventListener("message", w), e.removeEventListener("error", h);
|
|
25
25
|
};
|
|
26
|
-
e.addEventListener("message",
|
|
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();
|
|
@@ -103,18 +103,18 @@ class b {
|
|
|
103
103
|
handleSangineEvent(e, t) {
|
|
104
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);
|
|
105
105
|
}
|
|
106
|
-
createWindow(e, t) {
|
|
106
|
+
createWindow(e, t, s) {
|
|
107
107
|
if (!this.wasm) throw new Error("WASM not initialized");
|
|
108
|
-
let
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
}),
|
|
112
|
-
return this.windowCreatedPromiseResolveRegistry[
|
|
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] = {
|
|
113
113
|
actionChanged: [],
|
|
114
114
|
routeUpdated: [],
|
|
115
115
|
measurementCreated: [],
|
|
116
116
|
assetsDownloading: []
|
|
117
|
-
}, this.userActionRegistry[
|
|
117
|
+
}, this.userActionRegistry[h] = "watching", this.windowCreatedPromiseRegistry[h] = w, h;
|
|
118
118
|
}
|
|
119
119
|
getAssetsDownloading(e) {
|
|
120
120
|
return this.assetsDownloadingRegistry[e] || !1;
|
|
@@ -148,17 +148,17 @@ class b {
|
|
|
148
148
|
if (!this.wasm) throw new Error("WASM not initialized");
|
|
149
149
|
this.wasm.animate_to_route(e, t);
|
|
150
150
|
}
|
|
151
|
-
setSunProperties(e, t
|
|
151
|
+
setSunProperties(e, t) {
|
|
152
152
|
if (!this.wasm) throw new Error("WASM not initialized");
|
|
153
|
-
this.wasm.set_sun_properties(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
);
|
|
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) {
|
|
160
|
+
if (!this.wasm) throw new Error("WASM not initialized");
|
|
161
|
+
this.wasm.set_lighting_mode(e, t);
|
|
162
162
|
}
|
|
163
163
|
setNorthCorrection(e, t) {
|
|
164
164
|
if (!this.wasm) throw new Error("WASM not initialized");
|
|
@@ -194,60 +194,60 @@ class b {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
const p = "fa5ceba1";
|
|
197
|
-
function E(
|
|
198
|
-
let t = !1, s = null,
|
|
199
|
-
async function
|
|
200
|
-
if (
|
|
201
|
-
const i = `https://sangine-asset-cache/${
|
|
202
|
-
if (
|
|
203
|
-
const l = await
|
|
204
|
-
return
|
|
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;
|
|
205
205
|
}
|
|
206
|
-
return fetch(await
|
|
206
|
+
return fetch(await a());
|
|
207
207
|
}
|
|
208
|
-
|
|
208
|
+
o.onmessage = async (h) => {
|
|
209
209
|
if (!t) {
|
|
210
|
-
const
|
|
210
|
+
const c = await import(new URL(
|
|
211
211
|
`${g}/sbo-decode/wasm_sbo_decode.${p}.js`,
|
|
212
|
-
|
|
212
|
+
o.location.origin
|
|
213
213
|
).href);
|
|
214
|
-
await
|
|
214
|
+
await c.default(), s = c, t = !0;
|
|
215
215
|
}
|
|
216
|
-
!
|
|
217
|
-
const { data:
|
|
218
|
-
if ("texture-file" in
|
|
216
|
+
!n && typeof caches < "u" && (n = await caches.open("sangine-assets-v1"));
|
|
217
|
+
const { data: a } = h;
|
|
218
|
+
if ("texture-file" in a)
|
|
219
219
|
try {
|
|
220
|
-
const i = await
|
|
220
|
+
const i = await w(a["texture-file"].pk, () => e(a));
|
|
221
221
|
if (!i.ok)
|
|
222
222
|
throw new Error(`HTTP error! status: ${i.status}`);
|
|
223
|
-
const
|
|
223
|
+
const c = await i.blob(), l = await createImageBitmap(c), d = new OffscreenCanvas(l.width, l.height), m = d.getContext("2d");
|
|
224
224
|
if (m === null)
|
|
225
225
|
throw new Error("Couldnt create canvas");
|
|
226
226
|
m.drawImage(l, 0, 0);
|
|
227
|
-
const u = m.getImageData(0, 0,
|
|
228
|
-
|
|
227
|
+
const u = m.getImageData(0, 0, d.width, d.height);
|
|
228
|
+
o.postMessage(
|
|
229
229
|
{
|
|
230
230
|
success: !0,
|
|
231
|
-
width:
|
|
232
|
-
height:
|
|
231
|
+
width: d.width,
|
|
232
|
+
height: d.height,
|
|
233
233
|
data: u.data.buffer
|
|
234
234
|
},
|
|
235
235
|
[u.data.buffer]
|
|
236
236
|
);
|
|
237
237
|
} catch (i) {
|
|
238
|
-
|
|
238
|
+
o.postMessage({ success: !1, error: i.message });
|
|
239
239
|
}
|
|
240
|
-
else if ("model-part-mesh" in
|
|
241
|
-
const i = await
|
|
240
|
+
else if ("model-part-mesh" in a) {
|
|
241
|
+
const i = await w(a["model-part-mesh"].pk, () => e(a));
|
|
242
242
|
if (!i.ok)
|
|
243
243
|
throw new Error(`HTTP error! status: ${i.status}`);
|
|
244
|
-
const
|
|
245
|
-
|
|
244
|
+
const c = await i.arrayBuffer(), l = new Uint8Array(c), d = s.decode_sbo(l);
|
|
245
|
+
o.postMessage(
|
|
246
246
|
{
|
|
247
247
|
success: !0,
|
|
248
|
-
data:
|
|
248
|
+
data: d.buffer
|
|
249
249
|
},
|
|
250
|
-
[
|
|
250
|
+
[d.buffer]
|
|
251
251
|
);
|
|
252
252
|
}
|
|
253
253
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
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;
|
|
@@ -33,7 +33,7 @@ export declare class RendererService {
|
|
|
33
33
|
handleRouteUpdated(windowId: number, route: Route): void;
|
|
34
34
|
handleAssetsDownloading(windowId: number, downloading: boolean): void;
|
|
35
35
|
handleSangineEvent(windowId: number, event: SangineEvent): void;
|
|
36
|
-
createWindow(containerId: string, scene: Scene): number;
|
|
36
|
+
createWindow(containerId: string, scene: Scene, settings: RenderingSettings | undefined): number;
|
|
37
37
|
getAssetsDownloading(containerId: number): boolean;
|
|
38
38
|
readUserAction(windowId: number): UserAction;
|
|
39
39
|
windowReady(windowId: number): Promise<void>;
|
|
@@ -43,7 +43,9 @@ export declare class RendererService {
|
|
|
43
43
|
setRouteHighlight(windowId: number, routeId: string, highlight: number): void;
|
|
44
44
|
setRouteVisible(windowId: number, routeId: string, visible: number): void;
|
|
45
45
|
animateToRoute(windowId: number, routeId: string): void;
|
|
46
|
-
setSunProperties(windowId: number,
|
|
46
|
+
setSunProperties(windowId: number, sunProperties: SunProperties): void;
|
|
47
|
+
setAmbientLighting(windowId: number, properties: IntensityAndTemperature): void;
|
|
48
|
+
setLightingMode(windowId: number, mode: LightingMode): void;
|
|
47
49
|
setNorthCorrection(windowId: number, northCorrection: number): void;
|
|
48
50
|
setGpuMemoryBudgetMb(windowId: number, memoryMb: number): void;
|
|
49
51
|
setRenderQuality(windowId: number, quality: RendererAssetQuality): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rendererService.d.ts","sourceRoot":"","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EAAE,UAAU;IAKpD,aAAa,CAAC,QAAQ,EAAE,MAAM;IAO9B,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKtE,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAKlE,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAKhD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa;IAK/D,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB;IAKxE,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY;IAKpD,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"}
|
|
@@ -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
|
-
|
|
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 {
|
|
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,
|
|
177
|
-
const ret = wasm.set_sun_properties(window_id,
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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.
|
|
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,
|
|
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:
|
|
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;
|
|
Binary file
|
|
@@ -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:
|
|
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 = "
|
|
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.
|
|
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",
|