@eigong/effekseer-webgpu-runtime 0.1.0 → 0.1.1
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/index.d.ts +1 -6
- package/index.js +19 -6
- package/package.json +1 -1
- package/runtime/effekseer.webgpu.src.js +4 -0
package/index.d.ts
CHANGED
|
@@ -3,9 +3,4 @@ export declare const effekseerWebgpuRuntimeJsUrl: string
|
|
|
3
3
|
export declare const effekseerWebgpuRuntimeWasmUrl: string
|
|
4
4
|
export declare const effekseerWebgpuBridgeUrl: string
|
|
5
5
|
|
|
6
|
-
export declare function
|
|
7
|
-
fflateUrl: string
|
|
8
|
-
effekseerWebgpuRuntimeJsUrl: string
|
|
9
|
-
effekseerWebgpuRuntimeWasmUrl: string
|
|
10
|
-
effekseerWebgpuBridgeUrl: string
|
|
11
|
-
}
|
|
6
|
+
export declare function loadEffekseerWebGPURuntime(): Promise<any>
|
package/index.js
CHANGED
|
@@ -3,11 +3,24 @@ export const effekseerWebgpuRuntimeJsUrl = new URL('./runtime/Effekseer_WebGPU_R
|
|
|
3
3
|
export const effekseerWebgpuRuntimeWasmUrl = new URL('./runtime/Effekseer_WebGPU_Runtime.wasm', import.meta.url).href
|
|
4
4
|
export const effekseerWebgpuBridgeUrl = new URL('./runtime/effekseer.webgpu.src.js', import.meta.url).href
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
function loadScript(src) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const script = document.createElement('script')
|
|
9
|
+
script.src = src
|
|
10
|
+
script.onload = () => resolve()
|
|
11
|
+
script.onerror = reject
|
|
12
|
+
document.head.appendChild(script)
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function loadEffekseerWebGPURuntime() {
|
|
17
|
+
await loadScript(fflateUrl)
|
|
18
|
+
await loadScript(effekseerWebgpuRuntimeJsUrl)
|
|
19
|
+
await loadScript(effekseerWebgpuBridgeUrl)
|
|
20
|
+
|
|
21
|
+
if (!globalThis.effekseer) {
|
|
22
|
+
throw new Error('Effekseer WebGPU runtime did not initialize.')
|
|
12
23
|
}
|
|
24
|
+
|
|
25
|
+
return globalThis.effekseer
|
|
13
26
|
}
|
package/package.json
CHANGED
|
@@ -2210,6 +2210,10 @@ const effekseer = (() => {
|
|
|
2210
2210
|
return new Effekseer();
|
|
2211
2211
|
})();
|
|
2212
2212
|
|
|
2213
|
+
if (typeof globalThis !== "undefined") {
|
|
2214
|
+
globalThis.effekseer = effekseer;
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2213
2217
|
if (typeof exports !== "undefined") {
|
|
2214
2218
|
exports = effekseer;
|
|
2215
2219
|
}
|