Bump dist build

This commit is contained in:
sparkjsdev[bot] committed 2025-09-29 16:18:59 +00:00
1 parent 15318d7016
commit 875072b2fd
16 files changed
+863 -734

No files matched your search

@@ -1 +1 @@
{"version":3,"file":"worker-DGqIxIk3.js","sources":["../rust/spark-internal-rs/pkg/spark_internal_rs.js","../node_modules/fflate/esm/browser.js","../node_modules/three/build/three.core.js","../src/defines.ts","../src/dyno/base.ts","../src/utils.ts","../src/antisplat.ts","../src/ksplat.ts","../src/ply.ts","../src/SplatLoader.ts","../src/pcsogs.ts","../src/spz.ts","../src/worker.ts"],"sourcesContent":["let wasm;\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * @param {number} num_splats\n * @param {Uint16Array} readback\n * @param {Uint32Array} ordering\n * @returns {number}\n */\nexport function sort_splats(num_splats, readback, ordering) {\n const ret = wasm.sort_splats(num_splats, readback, ordering);\n return ret >>> 0;\n}\n\n/**\n * @param {number} num_splats\n * @param {Uint32Array} readback\n * @param {Uint32Array} ordering\n * @returns {number}\n */\nexport function sort32_splats(num_splats, readback, ordering) {\n const ret = wasm.sort32_splats(num_splats, readback, ordering);\n return ret >>> 0;\n}\n\n/**\n * @param {number} origin_x\n * @param {number} origin_y\n * @param {number} origin_z\n * @param {number} dir_x\n * @param {number} dir_y\n * @param {number} dir_z\n * @param {number} near\n * @param {number} far\n * @param {number} num_splats\n * @param {Uint32Array} packed_splats\n * @param {boolean} raycast_ellipsoid\n * @param {number} ln_scale_min\n * @param {number} ln_scale_max\n * @returns {Float32Array}\n */\nexport function raycast_splats(origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, near, far, num_splats, packed_splats, raycast_ellipsoid, ln_scale_min, ln_scale_max) {\n const ret = wasm.raycast_splats(origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, near, far, num_splats, packed_splats, raycast_ellipsoid, ln_scale_min, ln_scale_max);\n return ret;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {\n const ret = arg0.buffer;\n return ret;\n };\n imports.wbg.__wbg_length_3b4f022188ae8db6 = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_6ca527665d89694d = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_8cfd2c6409af88ad = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_new_9fee97a409b32b68 = function(arg0) {\n const ret = new Uint16Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_new_e3b321dcfef89fc7 = function(arg0) {\n const ret = new Uint32Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354 = function(arg0, arg1, arg2) {\n const ret = new Float32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212 = function(arg0, arg1, arg2) {\n const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithlength_5a5efe313cfd59f1 = function(arg0) {\n const ret = new Float32Array(arg0 >>> 0)Line truncated
{"version":3,"file":"worker-CBtTDhW6.js","sources":["../rust/spark-internal-rs/pkg/spark_internal_rs.js","../node_modules/fflate/esm/browser.js","../node_modules/three/build/three.core.js","../src/defines.ts","../src/dyno/base.ts","../src/utils.ts","../src/antisplat.ts","../src/ksplat.ts","../src/ply.ts","../src/SplatLoader.ts","../src/pcsogs.ts","../src/spz.ts","../src/worker.ts"],"sourcesContent":["let wasm;\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * @param {number} num_splats\n * @param {Uint16Array} readback\n * @param {Uint32Array} ordering\n * @returns {number}\n */\nexport function sort_splats(num_splats, readback, ordering) {\n const ret = wasm.sort_splats(num_splats, readback, ordering);\n return ret >>> 0;\n}\n\n/**\n * @param {number} num_splats\n * @param {Uint32Array} readback\n * @param {Uint32Array} ordering\n * @returns {number}\n */\nexport function sort32_splats(num_splats, readback, ordering) {\n const ret = wasm.sort32_splats(num_splats, readback, ordering);\n return ret >>> 0;\n}\n\n/**\n * @param {number} origin_x\n * @param {number} origin_y\n * @param {number} origin_z\n * @param {number} dir_x\n * @param {number} dir_y\n * @param {number} dir_z\n * @param {number} near\n * @param {number} far\n * @param {number} num_splats\n * @param {Uint32Array} packed_splats\n * @param {boolean} raycast_ellipsoid\n * @param {number} ln_scale_min\n * @param {number} ln_scale_max\n * @returns {Float32Array}\n */\nexport function raycast_splats(origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, near, far, num_splats, packed_splats, raycast_ellipsoid, ln_scale_min, ln_scale_max) {\n const ret = wasm.raycast_splats(origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, near, far, num_splats, packed_splats, raycast_ellipsoid, ln_scale_min, ln_scale_max);\n return ret;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {\n const ret = arg0.buffer;\n return ret;\n };\n imports.wbg.__wbg_length_3b4f022188ae8db6 = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_6ca527665d89694d = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_8cfd2c6409af88ad = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_new_9fee97a409b32b68 = function(arg0) {\n const ret = new Uint16Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_new_e3b321dcfef89fc7 = function(arg0) {\n const ret = new Uint32Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354 = function(arg0, arg1, arg2) {\n const ret = new Float32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212 = function(arg0, arg1, arg2) {\n const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithlength_5a5efe313cfd59f1 = function(arg0) {\n const ret = new Float32Array(arg0 >>> 0)Line truncated
@@ -1 +1 @@
{"version":3,"file":"worker-BOgQisOd.js","sources":["../rust/spark-internal-rs/pkg/spark_internal_rs.js","../node_modules/fflate/esm/browser.js","../node_modules/three/build/three.core.js","../src/defines.ts","../src/dyno/base.ts","../src/utils.ts","../src/antisplat.ts","../src/ksplat.ts","../src/ply.ts","../src/SplatLoader.ts","../src/pcsogs.ts","../src/spz.ts","../src/worker.ts"],"sourcesContent":["let wasm;\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * @param {number} num_splats\n * @param {Uint16Array} readback\n * @param {Uint32Array} ordering\n * @returns {number}\n */\nexport function sort_splats(num_splats, readback, ordering) {\n const ret = wasm.sort_splats(num_splats, readback, ordering);\n return ret >>> 0;\n}\n\n/**\n * @param {number} num_splats\n * @param {Uint32Array} readback\n * @param {Uint32Array} ordering\n * @returns {number}\n */\nexport function sort32_splats(num_splats, readback, ordering) {\n const ret = wasm.sort32_splats(num_splats, readback, ordering);\n return ret >>> 0;\n}\n\n/**\n * @param {number} origin_x\n * @param {number} origin_y\n * @param {number} origin_z\n * @param {number} dir_x\n * @param {number} dir_y\n * @param {number} dir_z\n * @param {number} near\n * @param {number} far\n * @param {number} num_splats\n * @param {Uint32Array} packed_splats\n * @param {boolean} raycast_ellipsoid\n * @param {number} ln_scale_min\n * @param {number} ln_scale_max\n * @returns {Float32Array}\n */\nexport function raycast_splats(origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, near, far, num_splats, packed_splats, raycast_ellipsoid, ln_scale_min, ln_scale_max) {\n const ret = wasm.raycast_splats(origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, near, far, num_splats, packed_splats, raycast_ellipsoid, ln_scale_min, ln_scale_max);\n return ret;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {\n const ret = arg0.buffer;\n return ret;\n };\n imports.wbg.__wbg_length_3b4f022188ae8db6 = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_6ca527665d89694d = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_8cfd2c6409af88ad = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_new_9fee97a409b32b68 = function(arg0) {\n const ret = new Uint16Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_new_e3b321dcfef89fc7 = function(arg0) {\n const ret = new Uint32Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354 = function(arg0, arg1, arg2) {\n const ret = new Float32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212 = function(arg0, arg1, arg2) {\n const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithlength_5a5efe313cfd59f1 = function(arg0) {\n const ret = new Float32Array(arg0 >>> 0)Line truncated
{"version":3,"file":"worker-CVv1zjxY.js","sources":["../rust/spark-internal-rs/pkg/spark_internal_rs.js","../node_modules/fflate/esm/browser.js","../node_modules/three/build/three.core.js","../src/defines.ts","../src/dyno/base.ts","../src/utils.ts","../src/antisplat.ts","../src/ksplat.ts","../src/ply.ts","../src/SplatLoader.ts","../src/pcsogs.ts","../src/spz.ts","../src/worker.ts"],"sourcesContent":["let wasm;\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * @param {number} num_splats\n * @param {Uint16Array} readback\n * @param {Uint32Array} ordering\n * @returns {number}\n */\nexport function sort_splats(num_splats, readback, ordering) {\n const ret = wasm.sort_splats(num_splats, readback, ordering);\n return ret >>> 0;\n}\n\n/**\n * @param {number} num_splats\n * @param {Uint32Array} readback\n * @param {Uint32Array} ordering\n * @returns {number}\n */\nexport function sort32_splats(num_splats, readback, ordering) {\n const ret = wasm.sort32_splats(num_splats, readback, ordering);\n return ret >>> 0;\n}\n\n/**\n * @param {number} origin_x\n * @param {number} origin_y\n * @param {number} origin_z\n * @param {number} dir_x\n * @param {number} dir_y\n * @param {number} dir_z\n * @param {number} near\n * @param {number} far\n * @param {number} num_splats\n * @param {Uint32Array} packed_splats\n * @param {boolean} raycast_ellipsoid\n * @param {number} ln_scale_min\n * @param {number} ln_scale_max\n * @returns {Float32Array}\n */\nexport function raycast_splats(origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, near, far, num_splats, packed_splats, raycast_ellipsoid, ln_scale_min, ln_scale_max) {\n const ret = wasm.raycast_splats(origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, near, far, num_splats, packed_splats, raycast_ellipsoid, ln_scale_min, ln_scale_max);\n return ret;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {\n const ret = arg0.buffer;\n return ret;\n };\n imports.wbg.__wbg_length_3b4f022188ae8db6 = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_6ca527665d89694d = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_8cfd2c6409af88ad = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_new_9fee97a409b32b68 = function(arg0) {\n const ret = new Uint16Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_new_e3b321dcfef89fc7 = function(arg0) {\n const ret = new Uint32Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354 = function(arg0, arg1, arg2) {\n const ret = new Float32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212 = function(arg0, arg1, arg2) {\n const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithlength_5a5efe313cfd59f1 = function(arg0) {\n const ret = new Float32Array(arg0 >>> 0)Line truncated
-1
View File
@@ -1 +0,0 @@
1e3bfafbc3f3e603a0e2246473e55b40cbfa7e56
+66 -32
View File
@@ -3184,25 +3184,20 @@ class GunzipReader {
}) {
this.fileBytes = fileBytes;
this.chunkBytes = chunkBytes;
this.offset = 0;
this.chunks = [];
this.totalBytes = 0;
this.gunzip = new Gunzip((chunk, _final) => {
const ds = new DecompressionStream("gzip");
const decompressionStream = new Blob([fileBytes]).stream().pipeThrough(ds);
this.reader = decompressionStream.getReader();
}
async read(numBytes) {
while (this.totalBytes < numBytes) {
const { value: chunk, done: readerDone } = await this.reader.read();
if (readerDone) {
break;
}
this.chunks.push(chunk);
this.totalBytes += chunk.length;
});
}
read(numBytes) {
while (this.totalBytes < numBytes && this.offset < this.fileBytes.length) {
const end = Math.min(
this.offset + this.chunkBytes,
this.fileBytes.length
);
this.gunzip.push(this.fileBytes.subarray(this.offset, end), false);
this.offset = end;
}
if (this.totalBytes < numBytes && this.offset >= this.fileBytes.length) {
this.gunzip.push(new Uint8Array(0), true);
}
if (this.totalBytes < numBytes) {
throw new Error(
@@ -8585,7 +8580,7 @@ function getNumSh(properties) {
}
return numSh;
}
const jsContent = '(function() {\n "use strict";\n let wasm;\n const cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {\n throw Error("TextDecoder not available");\n } };\n if (typeof TextDecoder !== "undefined") {\n cachedTextDecoder.decode();\n }\n let cachedUint8ArrayMemory0 = null;\n function getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n }\n function getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n }\n function sort_splats(num_splats, readback, ordering) {\n const ret = wasm.sort_splats(num_splats, readback, ordering);\n return ret >>> 0;\n }\n function sort32_splats(num_splats, readback, ordering) {\n const ret = wasm.sort32_splats(num_splats, readback, ordering);\n return ret >>> 0;\n }\n async function __wbg_load(module, imports) {\n if (typeof Response === "function" && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === "function") {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n if (module.headers.get("Content-Type") != "application/wasm") {\n console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n", e);\n } else {\n throw e;\n }\n }\n }\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n }\n function __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {\n const ret = arg0.buffer;\n return ret;\n };\n imports.wbg.__wbg_length_3b4f022188ae8db6 = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_6ca527665d89694d = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_8cfd2c6409af88ad = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_new_9fee97a409b32b68 = function(arg0) {\n const ret = new Uint16Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_new_e3b321dcfef89fc7 = function(arg0) {\n const ret = new Uint32Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354 = function(arg0, arg1, arg2) {\n const ret = new Float32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212 = function(arg0, arg1, arg2) {\n const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithlength_5a5efe313cfd59f1 = function(arg0) {\n const ret = new Float32Array(arg0 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_set_10bad9bee0e9c58b = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_set_d23661d19148b229 = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_set_f4f1f0daa30696fc = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_subarray_3aaeec89bb2544f0 = function(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_subarray_769e1e0f81bb259b = function(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbindgen_init_externref_table = function() {\n const table = wasm.__wbindgen_export_0;\n const offset = table.grow(4);\n table.set(0, void 0);\n table.set(offset + 0, void 0);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n };\n imports.wbg.__wbindgen_memory = function() {\n const ret = wasm.memory;\n return ret;\n };\n imports.wbg.__wbindgen_throw = function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n };\n return imports;\n }\n function __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedUint8ArrayMemory0 = null;\n wasm.__wbindgen_start();\n return wasm;\n Line truncated
const jsContent = '(function() {\n "use strict";\n let wasm;\n const cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {\n throw Error("TextDecoder not available");\n } };\n if (typeof TextDecoder !== "undefined") {\n cachedTextDecoder.decode();\n }\n let cachedUint8ArrayMemory0 = null;\n function getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n }\n function getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n }\n function sort_splats(num_splats, readback, ordering) {\n const ret = wasm.sort_splats(num_splats, readback, ordering);\n return ret >>> 0;\n }\n function sort32_splats(num_splats, readback, ordering) {\n const ret = wasm.sort32_splats(num_splats, readback, ordering);\n return ret >>> 0;\n }\n async function __wbg_load(module, imports) {\n if (typeof Response === "function" && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === "function") {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n if (module.headers.get("Content-Type") != "application/wasm") {\n console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n", e);\n } else {\n throw e;\n }\n }\n }\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n }\n function __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {\n const ret = arg0.buffer;\n return ret;\n };\n imports.wbg.__wbg_length_3b4f022188ae8db6 = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_6ca527665d89694d = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_8cfd2c6409af88ad = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_new_9fee97a409b32b68 = function(arg0) {\n const ret = new Uint16Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_new_e3b321dcfef89fc7 = function(arg0) {\n const ret = new Uint32Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354 = function(arg0, arg1, arg2) {\n const ret = new Float32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212 = function(arg0, arg1, arg2) {\n const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithlength_5a5efe313cfd59f1 = function(arg0) {\n const ret = new Float32Array(arg0 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_set_10bad9bee0e9c58b = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_set_d23661d19148b229 = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_set_f4f1f0daa30696fc = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_subarray_3aaeec89bb2544f0 = function(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_subarray_769e1e0f81bb259b = function(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbindgen_init_externref_table = function() {\n const table = wasm.__wbindgen_export_0;\n const offset = table.grow(4);\n table.set(0, void 0);\n table.set(offset + 0, void 0);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n };\n imports.wbg.__wbindgen_memory = function() {\n const ret = wasm.memory;\n return ret;\n };\n imports.wbg.__wbindgen_throw = function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n };\n return imports;\n }\n function __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedUint8ArrayMemory0 = null;\n wasm.__wbindgen_start();\n return wasm;\n Line truncated
const blob = typeof self !== "undefined" && self.Blob && new Blob([jsContent], { type: "text/javascript;charset=utf-8" });
function WorkerWrapper(options) {
let objURL;
@@ -8906,6 +8901,9 @@ function getSplatFileTypeFromPath(pathOrUrl) {
if (extension === "ksplat") {
return "ksplat";
}
if (extension === "sog") {
return "pcsogszip";
}
return void 0;
}
function isPcSogs(input) {
@@ -8927,15 +8925,28 @@ function tryPcSogs(input) {
if (!json || typeof json !== "object" || Array.isArray(json)) {
return void 0;
}
const isVersion2 = json.version === 2;
for (const key of ["means", "scales", "quats", "sh0"]) {
if (!json[key] || typeof json[key] !== "object" || Array.isArray(json[key])) {
return void 0;
}
if (!json[key].shape || !json[key].files) {
return void 0;
}
if (key !== "quats" && (!json[key].mins || !json[key].maxs)) {
return void 0;
if (isVersion2) {
if (!json[key].files) {
return void 0;
}
if ((key === "scales" || key === "sh0") && !json[key].codebook) {
return void 0;
}
if (key === "means" && (!json[key].mins || !json[key].maxs)) {
return void 0;
}
} else {
if (!json[key].shape || !json[key].files) {
return void 0;
}
if (key !== "quats" && (!json[key].mins || !json[key].maxs)) {
return void 0;
}
}
}
return json;
@@ -10357,7 +10368,7 @@ class SplatAccumulator {
}
var splatDefines_default = "const float LN_SCALE_MIN = -12.0;\nconst float LN_SCALE_MAX = 9.0;\n\nconst uint SPLAT_TEX_WIDTH_BITS = 11u;\nconst uint SPLAT_TEX_HEIGHT_BITS = 11u;\nconst uint SPLAT_TEX_DEPTH_BITS = 11u;\nconst uint SPLAT_TEX_LAYER_BITS = SPLAT_TEX_WIDTH_BITS + SPLAT_TEX_HEIGHT_BITS;\n\nconst uint SPLAT_TEX_WIDTH = 1u << SPLAT_TEX_WIDTH_BITS;\nconst uint SPLAT_TEX_HEIGHT = 1u << SPLAT_TEX_HEIGHT_BITS;\nconst uint SPLAT_TEX_DEPTH = 1u << SPLAT_TEX_DEPTH_BITS;\n\nconst uint SPLAT_TEX_WIDTH_MASK = SPLAT_TEX_WIDTH - 1u;\nconst uint SPLAT_TEX_HEIGHT_MASK = SPLAT_TEX_HEIGHT - 1u;\nconst uint SPLAT_TEX_DEPTH_MASK = SPLAT_TEX_DEPTH - 1u;\n\nconst uint F16_INF = 0x7c00u;\nconst float PI = 3.1415926535897932384626433832795;\n\nconst float INFINITY = 1.0 / 0.0;\nconst float NEG_INFINITY = -INFINITY;\n\nfloat sqr(float x) {\n return x * x;\n}\n\nfloat pow4(float x) {\n float x2 = x * x;\n return x2 * x2;\n}\n\nfloat pow8(float x) {\n float x4 = pow4(x);\n return x4 * x4;\n}\n\nvec3 srgbToLinear(vec3 rgb) {\n return pow(rgb, vec3(2.2));\n}\n\nvec3 linearToSrgb(vec3 rgb) {\n return pow(rgb, vec3(1.0 / 2.2));\n}\n\nuint encodeQuatOctXy88R8(vec4 q) {\n \n if (q.w < 0.0) {\n q = -q;\n }\n \n float theta = 2.0 * acos(q.w);\n float halfTheta = theta * 0.5;\n float s = sin(halfTheta);\n \n vec3 axis = (abs(s) < 1e-6) ? vec3(1.0, 0.0, 0.0) : q.xyz / s;\n \n \n \n float sum = abs(axis.x) + abs(axis.y) + abs(axis.z);\n vec2 p = vec2(axis.x, axis.y) / sum;\n \n if (axis.z < 0.0) {\n float oldPx = p.x;\n p.x = (1.0 - abs(p.y)) * (p.x >= 0.0 ? 1.0 : -1.0);\n p.y = (1.0 - abs(oldPx)) * (p.y >= 0.0 ? 1.0 : -1.0);\n }\n \n float u_f = p.x * 0.5 + 0.5;\n float v_f = p.y * 0.5 + 0.5;\n \n uint quantU = uint(clamp(round(u_f * 255.0), 0.0, 255.0));\n uint quantV = uint(clamp(round(v_f * 255.0), 0.0, 255.0));\n \n \n \n uint angleInt = uint(clamp(round((theta / 3.14159265359) * 255.0), 0.0, 255.0));\n \n \n return (angleInt << 16u) | (quantV << 8u) | quantU;\n}\n\nvec4 decodeQuatOctXy88R8(uint encoded) {\n \n uint quantU = encoded & uint(0xFFu); \n uint quantV = (encoded >> 8u) & uint(0xFFu); \n uint angleInt = encoded >> 16u; \n\n \n float u_f = float(quantU) / 255.0;\n float v_f = float(quantV) / 255.0;\n vec2 f = vec2(u_f * 2.0 - 1.0, v_f * 2.0 - 1.0);\n\n vec3 axis = vec3(f.xy, 1.0 - abs(f.x) - abs(f.y));\n float t = max(-axis.z, 0.0);\n axis.x += (axis.x >= 0.0) ? -t : t;\n axis.y += (axis.y >= 0.0) ? -t : t;\n axis = normalize(axis);\n \n \n float theta = (float(angleInt) / 255.0) * 3.14159265359;\n float halfTheta = theta * 0.5;\n float s = sin(halfTheta);\n float w = cos(halfTheta);\n \n return vec4(axis * s, w);\n}\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\nuvec4 packSplatEncoding(\n vec3 center, vec3 scales, vec4 quaternion, vec4 rgba, vec4 rgbMinMaxLnScaleMinMax\n) {\n float rgbMin = rgbMinMaxLnScaleMinMax.x;\n float rgbMax = rgbMinMaxLnScaleMinMax.y;\n vec3 encRgb = (rgba.rgb - vec3(rgbMin)) / (rgbMax - rgbMin);\n uvec4 uRgba = uvec4(round(clamp(vec4(encRgb, rgba.a) * 255.0, 0.0, 255.0)));\n\n uint uQuat = encodeQuatOctXy88R8(quaternion);\n \n \n uvec3 uQuat3 = uvec3(uQuat & 0xffu, (uQuat >> 8u) & 0xffu, (uQuat >> 16u) & 0xffu);\n\n \n float lnScaleMin = rgbMinMaxLnScaleMinMax.z;\n float lnScaleMax = rgbMinMaxLnScaleMinMax.w;\n float lnScaleScale = 254.0 / (lnScaleMax - lnScaleMin);\n uvec3 uScales = uvec3(\n (scales.x == 0.0) ? 0u : uint(round(clamp((log(scales.x) - lnScaleMin) * lnScaleScale, 0.0, 254.0))) + 1u,\n (scales.y == 0.0) ? 0u : uint(round(clamp((log(scales.y) - lnScaleMin) * lnScaleScale, 0.0, 254.0))) + 1u,\n (scales.z == 0.0) ? 0u : uint(round(clamp((log(scales.z) - lnScaleMin) * lnScaleScale, 0.0, 254.0))) + 1u\n );\n\n \n uint word0 = uRgba.r | (uRgba.g << 8u) | (uRgba.b << 16u) | (uRgba.a << 24u);\n uint word1 = packHalf2x16(center.xy);\n uint word2 = packHalf2x16(vec2(center.z, 0.0)) | (uQuat3.x << 16u) | (uQuat3.y << 24u);\n uint word3 = uScales.x | (uScales.y << 8u) | (uScales.z << 16u) | (uQuat3.z << 24u);\n return uvec4(word0, word1, word2, word3);\n}\n\nuvec4 packSplat(vec3 center, vec3 scales, vec4 quaternion, vec4 rgba) {\n return packSplatEncoding(center, scales, quaternion, rgba, vec4(0.0, 1.0, LN_SCALE_MIN, LN_SCALE_MAX));\n}\n\nvoid unpackSplatEncoding(uvec4 packed, out vec3 center, out vec3 scales, out vec4 quaternion, out vec4 rgba, vec4 rgbMinMaxLnScaleMinMax) {\n uint word0 = packed.x, word1 = packed.y, word2 = packed.z, word3 = packed.w;\n\n uvec4 uRgba = uvec4(word0 & 0xffu, (word0 >> 8u) & 0xffu, (word0 >> 16u) & 0xffu, (word0 >> 24u) & 0xffu);\n float rgbMin = rgbMinMaxLnScaleMinMax.x;\n float rgbMaxLine truncated
var splatFragment_default = "precision highp float;\nprecision highp int;\n\n#include <splatDefines>\n\nuniform float near;\nuniform float far;\nuniform bool encodeLinear;\nuniform float time;\nuniform bool debugFlag;\nuniform float maxStdDev;\nuniform float minAlpha;\nuniform bool stochastic;\nuniform bool disableFalloff;\nuniform float falloff;\n\nuniform bool splatTexEnable;\nuniform sampler3D splatTexture;\nuniform mat2 splatTexMul;\nuniform vec2 splatTexAdd;\nuniform float splatTexNear;\nuniform float splatTexFar;\nuniform float splatTexMid;\n\nout vec4 fragColor;\n\nin vec4 vRgba;\nin vec2 vSplatUv;\nin vec3 vNdc;\nflat in uint vSplatIndex;\n\nvoid main() {\n vec4 rgba = vRgba;\n\n float z = dot(vSplatUv, vSplatUv);\n if (!splatTexEnable) {\n if (z > (maxStdDev * maxStdDev)) {\n discard;\n }\n } else {\n vec2 uv = splatTexMul * vSplatUv + splatTexAdd;\n float ndcZ = vNdc.z;\n float depth = (2.0 * near * far) / (far + near - ndcZ * (far - near));\n float clampedFar = max(splatTexFar, splatTexNear);\n float clampedDepth = clamp(depth, splatTexNear, clampedFar);\n float logDepth = log2(clampedDepth + 1.0);\n float logNear = log2(splatTexNear + 1.0);\n float logFar = log2(clampedFar + 1.0);\n\n float texZ;\n if (splatTexMid > 0.0) {\n float clampedMid = clamp(splatTexMid, splatTexNear, clampedFar);\n float logMid = log2(clampedMid + 1.0);\n texZ = (clampedDepth <= clampedMid) ?\n (0.5 * ((logDepth - logNear) / (logMid - logNear))) :\n (0.5 * ((logDepth - logMid) / (logFar - logMid)) + 0.5);\n } else {\n texZ = (logDepth - logNear) / (logFar - logNear);\n }\n\n vec4 modulate = texture(splatTexture, vec3(uv, 1.0 - texZ));\n rgba *= modulate;\n }\n\n rgba.a *= mix(1.0, exp(-0.5 * z), falloff);\n\n if (rgba.a < minAlpha) {\n discard;\n }\n if (encodeLinear) {\n rgba.rgb = srgbToLinear(rgba.rgb);\n }\n\n if (stochastic) {\n const bool STEADY = false;\n uint uTime = STEADY ? 0u : floatBitsToUint(time);\n uvec2 coord = uvec2(gl_FragCoord.xy);\n uint state = uTime + 0x9e3779b9u * coord.x + 0x85ebca6bu * coord.y + 0xc2b2ae35u * uint(vSplatIndex);\n state = state * 747796405u + 2891336453u;\n uint hash = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;\n hash = (hash >> 22u) ^ hash;\n float rand = float(hash) / 4294967296.0;\n if (rand < rgba.a) {\n fragColor = vec4(rgba.rgb, 1.0);\n } else {\n discard;\n }\n } else {\n #ifdef PREMULTIPLIED_ALPHA\n fragColor = vec4(rgba.rgb * rgba.a, rgba.a);\n #else\n fragColor = rgba;\n #endif\n }\n}";
var splatVertex_default = "precision highp float;\nprecision highp int;\nprecision highp usampler2DArray;\n\n#include <splatDefines>\n\nattribute uint splatIndex;\n\nout vec4 vRgba;\nout vec2 vSplatUv;\nout vec3 vNdc;\nflat out uint vSplatIndex;\n\nuniform vec2 renderSize;\nuniform uint numSplats;\nuniform vec4 renderToViewQuat;\nuniform vec3 renderToViewPos;\nuniform float maxStdDev;\nuniform float maxPixelRadius;\nuniform float time;\nuniform float deltaTime;\nuniform bool debugFlag;\nuniform float minAlpha;\nuniform bool stochastic;\nuniform bool enable2DGS;\nuniform float blurAmount;\nuniform float preBlurAmount;\nuniform float focalDistance;\nuniform float apertureAngle;\nuniform float clipXY;\nuniform float focalAdjustment;\n\nuniform usampler2DArray packedSplats;\nuniform vec4 rgbMinMaxLnScaleMinMax;\n\nvoid main() {\n \n gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n\n if (uint(gl_InstanceID) >= numSplats) {\n return;\n }\n\n ivec3 texCoord;\n if (stochastic) {\n texCoord = ivec3(\n uint(gl_InstanceID) & SPLAT_TEX_WIDTH_MASK,\n (uint(gl_InstanceID) >> SPLAT_TEX_WIDTH_BITS) & SPLAT_TEX_HEIGHT_MASK,\n (uint(gl_InstanceID) >> SPLAT_TEX_LAYER_BITS)\n );\n } else {\n if (splatIndex == 0xffffffffu) {\n \n return;\n }\n texCoord = ivec3(\n splatIndex & SPLAT_TEX_WIDTH_MASK,\n (splatIndex >> SPLAT_TEX_WIDTH_BITS) & SPLAT_TEX_HEIGHT_MASK,\n splatIndex >> SPLAT_TEX_LAYER_BITS\n );\n }\n uvec4 packed = texelFetch(packedSplats, texCoord, 0);\n\n vec3 center, scales;\n vec4 quaternion, rgba;\n unpackSplatEncoding(packed, center, scales, quaternion, rgba, rgbMinMaxLnScaleMinMax);\n\n if (rgba.a < minAlpha) {\n return;\n }\n bvec3 zeroScales = equal(scales, vec3(0.0));\n if (all(zeroScales)) {\n return;\n }\n\n \n vec3 viewCenter = quatVec(renderToViewQuat, center) + renderToViewPos;\n\n \n if (viewCenter.z >= 0.0) {\n return;\n }\n\n \n vec4 clipCenter = projectionMatrix * vec4(viewCenter, 1.0);\n\n \n if (abs(clipCenter.z) >= clipCenter.w) {\n return;\n }\n\n \n float clip = clipXY * clipCenter.w;\n if (abs(clipCenter.x) > clip || abs(clipCenter.y) > clip) {\n return;\n }\n\n \n vSplatIndex = splatIndex;\n\n \n vec4 viewQuaternion = quatQuat(renderToViewQuat, quaternion);\n\n if (enable2DGS && any(zeroScales)) {\n vRgba = rgba;\n vSplatUv = position.xy * maxStdDev;\n\n vec3 offset;\n if (zeroScales.z) {\n offset = vec3(vSplatUv.xy * scales.xy, 0.0);\n } else if (zeroScales.y) {\n offset = vec3(vSplatUv.x * scales.x, 0.0, vSplatUv.y * scales.z);\n } else {\n offset = vec3(0.0, vSplatUv.xy * scales.yz);\n }\n\n vec3 viewPos = viewCenter + quatVec(viewQuaternion, offset);\n gl_Position = projectionMatrix * vec4(viewPos, 1.0);\n vNdc = gl_Position.xyz / gl_Position.w;\n return;\n }\n\n \n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n \n mat3 RS = scaleQuaternionToMatrix(scales, viewQuaternion);\n mat3 cov3D = RS * transpose(RS);\n\n \n vec2 scaledRenderSize = renderSize * focalAdjustment;\n vec2 focal = 0.5 * scaledRenderSize * vec2(projectionMatrix[0][0], projectionMatrix[1][1]);\n\n mat3 J;\n if(isOrthographic) {\n J = mat3(\n focal.x, 0.0, 0.0,\n 0.0, focal.y, 0.0,\n 0.0, 0.0, 0.0\n );\n } else {\n float invZ = 1.0 / viewCenter.z;\n vec2 J1 = focal * invZ;\n vec2 J2 = -(J1 * viewCenter.xy) * invZ;\n J = mat3(\n J1.x, 0.0, J2.x,\n 0.0, J1.y, J2.y,\n 0.0, 0.0, 0.0\n );\n }\n\n \n \n \n \n \n \n \n mat3 cov2D = transpose(J) * cov3D * J;\n float a = cov2D[0][0];\n float d = cov2D[1][1];\n float b = cov2D[0][1];\n\n \n a += preBlurAmount;\n d += preBlurAmount;\n\n float fullBlurAmount = blurAmount;\n if ((focalDistance > 0.0) && (apertureAngle > 0.0)) {\n float focusRadius = maxPixelRadius;\n if (viewCenter.z < 0.0) {\n float focusBlur = abs((-viewCenter.z - focalDistance) / viewCenter.z);\n float apertureRadius = focal.x * tan(0.5 * apertureAngle);\n focusRadius = focusBlur * apertureRadius;\n }\n fullBlurAmount = clamp(sqr(focusRadius), blurAmount, sqr(maxPixelRadius));\n }\n\n \n float detOrig = a * d - b * b;\n a += fullBlurAmount;\n d += fullBlurAmount;\n float det = a * d - b * b;\n\n \n float blurAdjust = sqrt(max(0.0, detOrig / det));\n rgba.a *= blurAdjust;\n if (rgba.a < minAlpha) {\n return;\n }\n\n \n float eigenAvg = 0.5 * (a + d);\n float eigenDelta = sqrt(max(0.0, eigenAvg * eigenAvg - det));\n float eigen1 = Line truncated
var splatVertex_default = "precision highp float;\nprecision highp int;\nprecision highp usampler2DArray;\n\n#include <splatDefines>\n\nattribute uint splatIndex;\n\nout vec4 vRgba;\nout vec2 vSplatUv;\nout vec3 vNdc;\nflat out uint vSplatIndex;\n\nuniform vec2 renderSize;\nuniform uint numSplats;\nuniform vec4 renderToViewQuat;\nuniform vec3 renderToViewPos;\nuniform float maxStdDev;\nuniform float minPixelRadius;\nuniform float maxPixelRadius;\nuniform float time;\nuniform float deltaTime;\nuniform bool debugFlag;\nuniform float minAlpha;\nuniform bool stochastic;\nuniform bool enable2DGS;\nuniform float blurAmount;\nuniform float preBlurAmount;\nuniform float focalDistance;\nuniform float apertureAngle;\nuniform float clipXY;\nuniform float focalAdjustment;\n\nuniform usampler2DArray packedSplats;\nuniform vec4 rgbMinMaxLnScaleMinMax;\n\nvoid main() {\n \n gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n\n if (uint(gl_InstanceID) >= numSplats) {\n return;\n }\n\n ivec3 texCoord;\n if (stochastic) {\n texCoord = ivec3(\n uint(gl_InstanceID) & SPLAT_TEX_WIDTH_MASK,\n (uint(gl_InstanceID) >> SPLAT_TEX_WIDTH_BITS) & SPLAT_TEX_HEIGHT_MASK,\n (uint(gl_InstanceID) >> SPLAT_TEX_LAYER_BITS)\n );\n } else {\n if (splatIndex == 0xffffffffu) {\n \n return;\n }\n texCoord = ivec3(\n splatIndex & SPLAT_TEX_WIDTH_MASK,\n (splatIndex >> SPLAT_TEX_WIDTH_BITS) & SPLAT_TEX_HEIGHT_MASK,\n splatIndex >> SPLAT_TEX_LAYER_BITS\n );\n }\n uvec4 packed = texelFetch(packedSplats, texCoord, 0);\n\n vec3 center, scales;\n vec4 quaternion, rgba;\n unpackSplatEncoding(packed, center, scales, quaternion, rgba, rgbMinMaxLnScaleMinMax);\n\n if (rgba.a < minAlpha) {\n return;\n }\n bvec3 zeroScales = equal(scales, vec3(0.0));\n if (all(zeroScales)) {\n return;\n }\n\n \n vec3 viewCenter = quatVec(renderToViewQuat, center) + renderToViewPos;\n\n \n if (viewCenter.z >= 0.0) {\n return;\n }\n\n \n vec4 clipCenter = projectionMatrix * vec4(viewCenter, 1.0);\n\n \n if (abs(clipCenter.z) >= clipCenter.w) {\n return;\n }\n\n \n float clip = clipXY * clipCenter.w;\n if (abs(clipCenter.x) > clip || abs(clipCenter.y) > clip) {\n return;\n }\n\n \n vSplatIndex = splatIndex;\n\n \n vec4 viewQuaternion = quatQuat(renderToViewQuat, quaternion);\n\n if (enable2DGS && any(zeroScales)) {\n vRgba = rgba;\n vSplatUv = position.xy * maxStdDev;\n\n vec3 offset;\n if (zeroScales.z) {\n offset = vec3(vSplatUv.xy * scales.xy, 0.0);\n } else if (zeroScales.y) {\n offset = vec3(vSplatUv.x * scales.x, 0.0, vSplatUv.y * scales.z);\n } else {\n offset = vec3(0.0, vSplatUv.xy * scales.yz);\n }\n\n vec3 viewPos = viewCenter + quatVec(viewQuaternion, offset);\n gl_Position = projectionMatrix * vec4(viewPos, 1.0);\n vNdc = gl_Position.xyz / gl_Position.w;\n return;\n }\n\n \n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n \n mat3 RS = scaleQuaternionToMatrix(scales, viewQuaternion);\n mat3 cov3D = RS * transpose(RS);\n\n \n vec2 scaledRenderSize = renderSize * focalAdjustment;\n vec2 focal = 0.5 * scaledRenderSize * vec2(projectionMatrix[0][0], projectionMatrix[1][1]);\n\n mat3 J;\n if(isOrthographic) {\n J = mat3(\n focal.x, 0.0, 0.0,\n 0.0, focal.y, 0.0,\n 0.0, 0.0, 0.0\n );\n } else {\n float invZ = 1.0 / viewCenter.z;\n vec2 J1 = focal * invZ;\n vec2 J2 = -(J1 * viewCenter.xy) * invZ;\n J = mat3(\n J1.x, 0.0, J2.x,\n 0.0, J1.y, J2.y,\n 0.0, 0.0, 0.0\n );\n }\n\n \n \n \n \n \n \n \n mat3 cov2D = transpose(J) * cov3D * J;\n float a = cov2D[0][0];\n float d = cov2D[1][1];\n float b = cov2D[0][1];\n\n \n a += preBlurAmount;\n d += preBlurAmount;\n\n float fullBlurAmount = blurAmount;\n if ((focalDistance > 0.0) && (apertureAngle > 0.0)) {\n float focusRadius = maxPixelRadius;\n if (viewCenter.z < 0.0) {\n float focusBlur = abs((-viewCenter.z - focalDistance) / viewCenter.z);\n float apertureRadius = focal.x * tan(0.5 * apertureAngle);\n focusRadius = focusBlur * apertureRadius;\n }\n fullBlurAmount = clamp(sqr(focusRadius), blurAmount, sqr(maxPixelRadius));\n }\n\n \n float detOrig = a * d - b * b;\n a += fullBlurAmount;\n d += fullBlurAmount;\n float det = a * d - b * b;\n\n \n float blurAdjust = sqrt(max(0.0, detOrig / det));\n rgba.a *= blurAdjust;\n if (rgba.a < minAlpha) {\n return;\n }\n\n \n float eigenAvg = 0.5 * (a + d);\n float eigenDelta = sqrt(max(0.0, eigenAvg * eigenAvLine truncated
let shaders = null;
function getShaders() {
if (!shaders) {
@@ -10426,6 +10437,7 @@ const _SparkRenderer = class _SparkRenderer extends THREE__namespace.Mesh {
this.needsUpdate = false;
this.originDistance = options.originDistance ?? 1;
this.maxStdDev = options.maxStdDev ?? Math.sqrt(8);
this.minPixelRadius = options.minPixelRadius ?? 0;
this.maxPixelRadius = options.maxPixelRadius ?? 512;
this.minAlpha = options.minAlpha ?? 0.5 * (1 / 255);
this.enable2DGS = options.enable2DGS ?? false;
@@ -10468,6 +10480,8 @@ const _SparkRenderer = class _SparkRenderer extends THREE__namespace.Mesh {
renderToViewPos: { value: new THREE__namespace.Vector3() },
// Maximum distance (in stddevs) from Gsplat center to render
maxStdDev: { value: 1 },
// Minimum pixel radius for splat rendering
minPixelRadius: { value: 0 },
// Maximum pixel radius for splat rendering
maxPixelRadius: { value: 512 },
// Minimum alpha value for splat rendering
@@ -10602,6 +10616,7 @@ const _SparkRenderer = class _SparkRenderer extends THREE__namespace.Mesh {
this.uniforms.far.value = typedCamera.far;
this.uniforms.encodeLinear.value = viewpoint.encodeLinear;
this.uniforms.maxStdDev.value = this.maxStdDev;
this.uniforms.minPixelRadius.value = this.minPixelRadius;
this.uniforms.maxPixelRadius.value = this.maxPixelRadius;
this.uniforms.minAlpha.value = this.minAlpha;
this.uniforms.stochastic.value = viewpoint.stochastic;
@@ -11298,9 +11313,23 @@ function decodeKsplat(fileBytes, initNumSplats, splatCallback, shCallback) {
}
class SpzReader {
constructor({ fileBytes }) {
this.version = -1;
this.numSplats = 0;
this.shDegree = 0;
this.fractionalBits = 0;
this.flags = 0;
this.flagAntiAlias = false;
this.reserved = 0;
this.headerParsed = false;
this.parsed = false;
this.fileBytes = fileBytes instanceof ArrayBuffer ? new Uint8Array(fileBytes) : fileBytes;
this.reader = new GunzipReader({ fileBytes: this.fileBytes });
const header = new DataView(this.reader.read(16).buffer);
}
async parseHeader() {
if (this.headerParsed) {
throw new Error("SPZ file header already parsed");
}
const header = new DataView((await this.reader.read(16)).buffer);
if (header.getUint32(0, true) !== 1347635022) {
throw new Error("Invalid SPZ file");
}
@@ -11314,15 +11343,19 @@ class SpzReader {
this.flags = header.getUint8(14);
this.flagAntiAlias = (this.flags & 1) !== 0;
this.reserved = header.getUint8(15);
this.headerParsed = true;
this.parsed = false;
}
parseSplats(centerCallback, alphaCallback, rgbCallback, scalesCallback, quatCallback, shCallback) {
async parseSplats(centerCallback, alphaCallback, rgbCallback, scalesCallback, quatCallback, shCallback) {
if (!this.headerParsed) {
throw new Error("SPZ file header must be parsed first");
}
if (this.parsed) {
throw new Error("SPZ file already parsed");
}
this.parsed = true;
if (this.version === 1) {
const centerBytes = this.reader.read(this.numSplats * 3 * 2);
const centerBytes = await this.reader.read(this.numSplats * 3 * 2);
const centerUint16 = new Uint16Array(centerBytes.buffer);
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 3;
@@ -11333,7 +11366,7 @@ class SpzReader {
}
} else if (this.version === 2 || this.version === 3) {
const fixed = 1 << this.fractionalBits;
const centerBytes = this.reader.read(this.numSplats * 3 * 3);
const centerBytes = await this.reader.read(this.numSplats * 3 * 3);
for (let i = 0; i < this.numSplats; i++) {
const i9 = i * 9;
const x = ((centerBytes[i9 + 2] << 24 | centerBytes[i9 + 1] << 16 | centerBytes[i9] << 8) >> 8) / fixed;
@@ -11345,13 +11378,13 @@ class SpzReader {
throw new Error("Unreachable");
}
{
const bytes = this.reader.read(this.numSplats);
const bytes = await this.reader.read(this.numSplats);
for (let i = 0; i < this.numSplats; i++) {
alphaCallback == null ? void 0 : alphaCallback(i, bytes[i] / 255);
}
}
{
const rgbBytes = this.reader.read(this.numSplats * 3);
const rgbBytes = await this.reader.read(this.numSplats * 3);
const scale = SH_C0 / 0.15;
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 3;
@@ -11362,7 +11395,7 @@ class SpzReader {
}
}
{
const scalesBytes = this.reader.read(this.numSplats * 3);
const scalesBytes = await this.reader.read(this.numSplats * 3);
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 3;
const scaleX = Math.exp(scalesBytes[i3] / 16 - 10);
@@ -11373,7 +11406,7 @@ class SpzReader {
}
if (this.version === 3) {
const maxValue = 1 / Math.sqrt(2);
const quatBytes = this.reader.read(this.numSplats * 4);
const quatBytes = await this.reader.read(this.numSplats * 4);
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 4;
const quaternion = [0, 0, 0, 0];
@@ -11409,7 +11442,7 @@ class SpzReader {
);
}
} else {
const quatBytes = this.reader.read(this.numSplats * 3);
const quatBytes = await this.reader.read(this.numSplats * 3);
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 3;
const quatX = quatBytes[i3] / 127.5 - 1;
@@ -11425,7 +11458,7 @@ class SpzReader {
const sh1 = new Float32Array(3 * 3);
const sh2 = this.shDegree >= 2 ? new Float32Array(5 * 3) : void 0;
const sh3 = this.shDegree >= 3 ? new Float32Array(7 * 3) : void 0;
const shBytes = this.reader.read(
const shBytes = await this.reader.read(
this.numSplats * SH_DEGREE_TO_VECS[this.shDegree] * 3
);
let offset = 0;
@@ -11704,6 +11737,7 @@ async function transcodeSpz(input) {
}
case SplatFileType.SPZ: {
const spz2 = new SpzReader({ fileBytes: input2.fileBytes });
await spz2.parseHeader();
const mapping = new Int32Array(spz2.numSplats);
mapping.fill(-1);
const centers = new Float32Array(spz2.numSplats * 3);
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"spark.cjs.js","sources":["../node_modules/three/examples/jsm/postprocessing/Pass.js","../node_modules/fflate/esm/browser.js","../rust/spark-internal-rs/pkg/spark_internal_rs.js","../src/defines.ts","../src/dyno/types.ts","../src/dyno/value.ts","../src/dyno/base.ts","../src/dyno/splats.ts","../src/dyno/output.ts","../src/dyno/uniforms.ts","../src/utils.ts","../src/dyno/program.ts","../src/dyno/mathTypes.ts","../src/dyno/math.ts","../src/dyno/logic.ts","../src/dyno/convert.ts","../src/dyno/vecmat.ts","../src/dyno/util.ts","../src/dyno/transform.ts","../src/dyno/control.ts","../src/dyno/texture.ts","../src/dyno/trig.ts","../src/shaders/computeVec4.glsl","../src/Readback.ts","../src/RgbaArray.ts","../src/SplatEdit.ts","../src/SplatGenerator.ts","../src/SplatMesh.ts","../src/ply.ts","../src/splatWorker.ts","../src/SplatLoader.ts","../src/shaders/computeUvec4.glsl","../src/PackedSplats.ts","../src/SplatGeometry.ts","../src/SparkViewpoint.ts","../src/SplatAccumulator.ts","../src/shaders/splatDefines.glsl","../src/shaders/splatFragment.glsl","../src/shaders/splatVertex.glsl","../src/shaders.ts","../src/SparkRenderer.ts","../src/antisplat.ts","../src/ksplat.ts","../src/spz.ts","../src/SplatSkinning.ts","../src/splatConstructors.ts","../src/generators/static.ts","../src/generators/snow.ts","../src/modifiers/normalColor.ts","../src/modifiers/depthColor.ts","../src/vrButton.ts","../src/hands.ts","../src/controls.ts"],"sourcesContent":["import {\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tOrthographicCamera,\n\tMesh\n} from 'three';\n\n/**\n * Abstract base class for all post processing passes.\n *\n * This module is only relevant for post processing with {@link WebGLRenderer}.\n *\n * @abstract\n * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js';\n */\nclass Pass {\n\n\t/**\n\t * Constructs a new pass.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPass = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass is processed by the composer.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass indicates to swap read and write buffer after rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.needsSwap = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass clears its buffer before rendering\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clear = false;\n\n\t\t/**\n\t\t * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers\n\t\t * pass chain gets automatically rendered to screen, no matter how this property is configured.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.renderToScreen = false;\n\n\t}\n\n\t/**\n\t * Sets the size of the pass.\n\t *\n\t * @abstract\n\t * @param {number} width - The width to set.\n\t * @param {number} height - The height to set.\n\t */\n\tsetSize( /* width, height */ ) {}\n\n\t/**\n\t * This method holds the render logic of a pass. It must be implemented in all derived classes.\n\t *\n\t * @abstract\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering\n\t * destination for the pass.\n\t * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the\n\t * previous pass from this buffer.\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @param {boolean} maskActive - Whether masking is active or not.\n\t */\n\trender( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n\t\tconsole.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the pass is no longer used in your app.\n\t *\n\t * @abstract\n\t */\n\tdispose() {}\n\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass FullscreenTriangleGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new FullscreenTriangleGeometry();\n\n\n/**\n * This module is a helper for passes which need to render a full\n * screen effect which is quite common in context of post processing.\n *\n * The intended usage is to reuse a single full screen quad for rendering\n * subsequent passes by just reassigning the `material` reference.\n *\n * This module can only be used with {@link WebGLRendeLine truncated
{"version":3,"file":"spark.cjs.js","sources":["../node_modules/three/examples/jsm/postprocessing/Pass.js","../node_modules/fflate/esm/browser.js","../rust/spark-internal-rs/pkg/spark_internal_rs.js","../src/defines.ts","../src/dyno/types.ts","../src/dyno/value.ts","../src/dyno/base.ts","../src/dyno/splats.ts","../src/dyno/output.ts","../src/dyno/uniforms.ts","../src/utils.ts","../src/dyno/program.ts","../src/dyno/mathTypes.ts","../src/dyno/math.ts","../src/dyno/logic.ts","../src/dyno/convert.ts","../src/dyno/vecmat.ts","../src/dyno/util.ts","../src/dyno/transform.ts","../src/dyno/control.ts","../src/dyno/texture.ts","../src/dyno/trig.ts","../src/shaders/computeVec4.glsl","../src/Readback.ts","../src/RgbaArray.ts","../src/SplatEdit.ts","../src/SplatGenerator.ts","../src/SplatMesh.ts","../src/ply.ts","../src/splatWorker.ts","../src/SplatLoader.ts","../src/shaders/computeUvec4.glsl","../src/PackedSplats.ts","../src/SplatGeometry.ts","../src/SparkViewpoint.ts","../src/SplatAccumulator.ts","../src/shaders/splatDefines.glsl","../src/shaders/splatFragment.glsl","../src/shaders/splatVertex.glsl","../src/shaders.ts","../src/SparkRenderer.ts","../src/antisplat.ts","../src/ksplat.ts","../src/spz.ts","../src/SplatSkinning.ts","../src/splatConstructors.ts","../src/generators/static.ts","../src/generators/snow.ts","../src/modifiers/normalColor.ts","../src/modifiers/depthColor.ts","../src/vrButton.ts","../src/hands.ts","../src/controls.ts"],"sourcesContent":["import {\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tOrthographicCamera,\n\tMesh\n} from 'three';\n\n/**\n * Abstract base class for all post processing passes.\n *\n * This module is only relevant for post processing with {@link WebGLRenderer}.\n *\n * @abstract\n * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js';\n */\nclass Pass {\n\n\t/**\n\t * Constructs a new pass.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPass = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass is processed by the composer.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass indicates to swap read and write buffer after rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.needsSwap = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass clears its buffer before rendering\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clear = false;\n\n\t\t/**\n\t\t * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers\n\t\t * pass chain gets automatically rendered to screen, no matter how this property is configured.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.renderToScreen = false;\n\n\t}\n\n\t/**\n\t * Sets the size of the pass.\n\t *\n\t * @abstract\n\t * @param {number} width - The width to set.\n\t * @param {number} height - The height to set.\n\t */\n\tsetSize( /* width, height */ ) {}\n\n\t/**\n\t * This method holds the render logic of a pass. It must be implemented in all derived classes.\n\t *\n\t * @abstract\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering\n\t * destination for the pass.\n\t * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the\n\t * previous pass from this buffer.\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @param {boolean} maskActive - Whether masking is active or not.\n\t */\n\trender( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n\t\tconsole.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the pass is no longer used in your app.\n\t *\n\t * @abstract\n\t */\n\tdispose() {}\n\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass FullscreenTriangleGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new FullscreenTriangleGeometry();\n\n\n/**\n * This module is a helper for passes which need to render a full\n * screen effect which is quite common in context of post processing.\n *\n * The intended usage is to reuse a single full screen quad for rendering\n * subsequent passes by just reassigning the `material` reference.\n *\n * This module can only be used with {@link WebGLRendeLine truncated
+30 -26
View File
@@ -1,6 +1,6 @@
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const sA=require("three");var Te=typeof document<"u"?document.currentScript:null;function Uo(t){const A=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(A,e,s.get?s:{enumerable:!0,get:()=>t[e]})}}return A.default=t,Object.freeze(A)}const u=Uo(sA),Go=new sA.OrthographicCamera(-1,1,1,-1,0,1);class Ro extends sA.BufferGeometry{constructor(){super(),this.setAttribute("position",new sA.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new sA.Float32BufferAttribute([0,2,0,0,2,0],2))}}const Yo=new Ro;class Ss{constructor(A){this._mesh=new sA.Mesh(Yo,A)}dispose(){this._mesh.geometry.dispose()}render(A){A.render(this._mesh,Go)}get material(){return this._mesh.material}set material(A){this._mesh.material=A}}var hA=Uint8Array,xt=Uint16Array,Jo=Int32Array,Ds=new hA([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ms=new hA([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),_o=new hA([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vs=function(t,A){for(var e=new xt(31),s=0;s<31;++s)e[s]=A+=1<<t[s-1];for(var n=new Jo(e[30]),s=1;s<30;++s)for(var i=e[s];i<e[s+1];++i)n[i]=i-e[s]<<5|s;return{b:e,r:n}},bs=vs(Ds,2),Fs=bs.b,Lo=bs.r;Fs[28]=258,Lo[258]=28;var zo=vs(Ms,0),Ho=zo.b,Le=new xt(32768);for(var nA=0;nA<32768;++nA){var tt=(nA&43690)>>1|(nA&21845)<<1;tt=(tt&52428)>>2|(tt&13107)<<2,tt=(tt&61680)>>4|(tt&3855)<<4,Le[nA]=((tt&65280)>>8|(tt&255)<<8)>>1}var Ht=function(t,A,e){for(var s=t.length,n=0,i=new xt(A);n<s;++n)t[n]&&++i[t[n]-1];var r=new xt(A);for(n=1;n<A;++n)r[n]=r[n-1]+i[n-1]<<1;var a;if(e){a=new xt(1<<A);var o=15-A;for(n=0;n<s;++n)if(t[n])for(var g=n<<4|t[n],l=A-t[n],c=r[t[n]-1]++<<l,I=c|(1<<l)-1;c<=I;++c)a[Le[c]>>o]=g}else for(a=new xt(s),n=0;n<s;++n)t[n]&&(a[n]=Le[r[t[n]-1]++]>>15-t[n]);return a},te=new hA(288);for(var nA=0;nA<144;++nA)te[nA]=8;for(var nA=144;nA<256;++nA)te[nA]=9;for(var nA=256;nA<280;++nA)te[nA]=7;for(var nA=280;nA<288;++nA)te[nA]=8;var Ns=new hA(32);for(var nA=0;nA<32;++nA)Ns[nA]=5;var qo=Ht(te,9,1),Ko=Ht(Ns,5,1),Ue=function(t){for(var A=t[0],e=1;e<t.length;++e)t[e]>A&&(A=t[e]);return A},_A=function(t,A,e){var s=A/8|0;return(t[s]|t[s+1]<<8)>>(A&7)&e},Ge=function(t,A){var e=A/8|0;return(t[e]|t[e+1]<<8|t[e+2]<<16)>>(A&7)},ks=function(t){return(t+7)/8|0},vt=function(t,A,e){return(A==null||A<0)&&(A=0),(e==null||e>t.length)&&(e=t.length),new hA(t.subarray(A,e))},$o=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],mA=function(t,A,e){var s=new Error(A||$o[t]);if(s.code=t,Error.captureStackTrace&&Error.captureStackTrace(s,mA),!e)throw s;return s},Ts=function(t,A,e,s){var n=t.length,i=s?s.length:0;if(!n||A.f&&!A.l)return e||new hA(0);var r=!e,a=r||A.i!=2,o=A.i;r&&(e=new hA(n*3));var g=function(wA){var SA=e.length;if(wA>SA){var BA=new hA(Math.max(SA*2,wA));BA.set(e),e=BA}},l=A.f||0,c=A.p||0,I=A.b||0,h=A.l,E=A.d,C=A.m,B=A.n,Q=n*8;do{if(!h){l=_A(t,c,1);var f=_A(t,c+1,3);if(c+=3,f)if(f==1)h=qo,E=Ko,C=9,B=5;else if(f==2){var D=_A(t,c,31)+257,x=_A(t,c+10,15)+4,w=D+_A(t,c+5,31)+1;c+=14;for(var m=new hA(w),k=new hA(19),M=0;M<x;++M)k[_o[M]]=_A(t,c+M*3,7);c+=x*3;for(var S=Ue(k),U=(1<<S)-1,F=Ht(k,S,1),M=0;M<w;){var b=F[_A(t,c,U)];c+=b&15;var p=b>>4;if(p<16)m[M++]=p;else{var T=0,R=0;for(p==16?(R=3+_A(t,c,3),c+=2,T=m[M-1]):p==17?(R=3+_A(t,c,7),c+=3):p==18&&(R=11+_A(t,c,127),c+=7);R--;)m[M++]=T}}var X=m.subarray(0,D),_=m.subarray(D);C=Ue(X),B=Ue(_),h=Ht(X,C,1),E=Ht(_,B,1)}else mA(1);else{var p=ks(c)+4,d=t[p-4]|t[p-3]<<8,y=p+d;if(y>n){o&&mA(0);break}a&&g(I+d),e.set(t.subarray(p,y),I),A.b=I+=d,A.p=c=y*8,A.f=l;continue}if(c>Q){o&&mA(0);break}}a&&g(I+131072);for(var eA=(1<<C)-1,q=(1<<B)-1,O=c;;O=c){var T=h[Ge(t,c)&eA],L=T>>4;if(c+=T&15,c>Q){o&&mA(0);break}if(T||mA(2),L<256)e[I++]=L;else if(L==256){O=c,h=null;break}else{var j=L-254;if(L>264){var M=L-257,P=Ds[M];j=_A(t,c,(1<<P)-1)+Fs[M],c+=P}var W=E[Ge(t,c)&q],G=W>>4;W||mA(3),c+=W&15;var _=Ho[G];if(G>3){var P=Ms[G];_+=Ge(t,c)&(1<<P)-1,c+=P}if(c>Q){o&&mA(0);break}a&&g(I+131072);var dA=I+j;if(I<_){var lA=i-_,yA=Math.min(_,dA);for(lA+I<0&&mA(3);I<yA;++I)e[I]=s[lA+I]}for(;I<dA;++I)e[I]=e[I-_]}}A.l=h,A.p=O,A.b=I,A.f=l,h&&(l=1,A.m=C,A.d=E,A.n=B)}while(!l);return I!=e.length&&r?vt(e,0,I):e.subarray(0,I)},Vo=new hA(0),KA=function(t,A){return t[A]|t[A+1]<<8},LA=function(t,A){return(t[A]|t[A+1]<<8|t[A+2]<<16|t[A+3]<<24)>>>0},Re=function(t,A){return LA(t,A)+LA(t,A+4)*4294967296},Po=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&mA(6,"invalid gzip data");var A=t[3],e=10;A&4&&(e+=(t[10]|t[11]<<8)+2);for(var s=(A>>3&1)+(A>>4&1);s>0;s-=!t[e++]);return e+(A&2)},Ye=function(){function t(A,e){typeof A=="function"&&(e=ALine truncated
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const sA=require("three");var Te=typeof document<"u"?document.currentScript:null;function To(t){const A=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(A,e,s.get?s:{enumerable:!0,get:()=>t[e]})}}return A.default=t,Object.freeze(A)}const u=To(sA),Uo=new sA.OrthographicCamera(-1,1,1,-1,0,1);class Go extends sA.BufferGeometry{constructor(){super(),this.setAttribute("position",new sA.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new sA.Float32BufferAttribute([0,2,0,0,2,0],2))}}const Ro=new Go;class Ss{constructor(A){this._mesh=new sA.Mesh(Ro,A)}dispose(){this._mesh.geometry.dispose()}render(A){A.render(this._mesh,Uo)}get material(){return this._mesh.material}set material(A){this._mesh.material=A}}var hA=Uint8Array,xt=Uint16Array,Yo=Int32Array,Ds=new hA([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ms=new hA([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Jo=new hA([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),vs=function(t,A){for(var e=new xt(31),s=0;s<31;++s)e[s]=A+=1<<t[s-1];for(var n=new Yo(e[30]),s=1;s<30;++s)for(var i=e[s];i<e[s+1];++i)n[i]=i-e[s]<<5|s;return{b:e,r:n}},bs=vs(Ds,2),Fs=bs.b,_o=bs.r;Fs[28]=258,_o[258]=28;var Lo=vs(Ms,0),zo=Lo.b,Le=new xt(32768);for(var nA=0;nA<32768;++nA){var tt=(nA&43690)>>1|(nA&21845)<<1;tt=(tt&52428)>>2|(tt&13107)<<2,tt=(tt&61680)>>4|(tt&3855)<<4,Le[nA]=((tt&65280)>>8|(tt&255)<<8)>>1}var Ht=function(t,A,e){for(var s=t.length,n=0,i=new xt(A);n<s;++n)t[n]&&++i[t[n]-1];var r=new xt(A);for(n=1;n<A;++n)r[n]=r[n-1]+i[n-1]<<1;var a;if(e){a=new xt(1<<A);var o=15-A;for(n=0;n<s;++n)if(t[n])for(var g=n<<4|t[n],l=A-t[n],c=r[t[n]-1]++<<l,I=c|(1<<l)-1;c<=I;++c)a[Le[c]>>o]=g}else for(a=new xt(s),n=0;n<s;++n)t[n]&&(a[n]=Le[r[t[n]-1]++]>>15-t[n]);return a},te=new hA(288);for(var nA=0;nA<144;++nA)te[nA]=8;for(var nA=144;nA<256;++nA)te[nA]=9;for(var nA=256;nA<280;++nA)te[nA]=7;for(var nA=280;nA<288;++nA)te[nA]=8;var Ns=new hA(32);for(var nA=0;nA<32;++nA)Ns[nA]=5;var Ho=Ht(te,9,1),qo=Ht(Ns,5,1),Ue=function(t){for(var A=t[0],e=1;e<t.length;++e)t[e]>A&&(A=t[e]);return A},_A=function(t,A,e){var s=A/8|0;return(t[s]|t[s+1]<<8)>>(A&7)&e},Ge=function(t,A){var e=A/8|0;return(t[e]|t[e+1]<<8|t[e+2]<<16)>>(A&7)},ks=function(t){return(t+7)/8|0},vt=function(t,A,e){return(A==null||A<0)&&(A=0),(e==null||e>t.length)&&(e=t.length),new hA(t.subarray(A,e))},Ko=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],mA=function(t,A,e){var s=new Error(A||Ko[t]);if(s.code=t,Error.captureStackTrace&&Error.captureStackTrace(s,mA),!e)throw s;return s},Ts=function(t,A,e,s){var n=t.length,i=s?s.length:0;if(!n||A.f&&!A.l)return e||new hA(0);var r=!e,a=r||A.i!=2,o=A.i;r&&(e=new hA(n*3));var g=function(wA){var SA=e.length;if(wA>SA){var BA=new hA(Math.max(SA*2,wA));BA.set(e),e=BA}},l=A.f||0,c=A.p||0,I=A.b||0,h=A.l,E=A.d,C=A.m,B=A.n,Q=n*8;do{if(!h){l=_A(t,c,1);var f=_A(t,c+1,3);if(c+=3,f)if(f==1)h=Ho,E=qo,C=9,B=5;else if(f==2){var D=_A(t,c,31)+257,x=_A(t,c+10,15)+4,w=D+_A(t,c+5,31)+1;c+=14;for(var m=new hA(w),k=new hA(19),M=0;M<x;++M)k[Jo[M]]=_A(t,c+M*3,7);c+=x*3;for(var S=Ue(k),U=(1<<S)-1,F=Ht(k,S,1),M=0;M<w;){var b=F[_A(t,c,U)];c+=b&15;var p=b>>4;if(p<16)m[M++]=p;else{var T=0,R=0;for(p==16?(R=3+_A(t,c,3),c+=2,T=m[M-1]):p==17?(R=3+_A(t,c,7),c+=3):p==18&&(R=11+_A(t,c,127),c+=7);R--;)m[M++]=T}}var X=m.subarray(0,D),_=m.subarray(D);C=Ue(X),B=Ue(_),h=Ht(X,C,1),E=Ht(_,B,1)}else mA(1);else{var p=ks(c)+4,d=t[p-4]|t[p-3]<<8,y=p+d;if(y>n){o&&mA(0);break}a&&g(I+d),e.set(t.subarray(p,y),I),A.b=I+=d,A.p=c=y*8,A.f=l;continue}if(c>Q){o&&mA(0);break}}a&&g(I+131072);for(var eA=(1<<C)-1,q=(1<<B)-1,O=c;;O=c){var T=h[Ge(t,c)&eA],L=T>>4;if(c+=T&15,c>Q){o&&mA(0);break}if(T||mA(2),L<256)e[I++]=L;else if(L==256){O=c,h=null;break}else{var j=L-254;if(L>264){var M=L-257,P=Ds[M];j=_A(t,c,(1<<P)-1)+Fs[M],c+=P}var W=E[Ge(t,c)&q],G=W>>4;W||mA(3),c+=W&15;var _=zo[G];if(G>3){var P=Ms[G];_+=Ge(t,c)&(1<<P)-1,c+=P}if(c>Q){o&&mA(0);break}a&&g(I+131072);var dA=I+j;if(I<_){var lA=i-_,yA=Math.min(_,dA);for(lA+I<0&&mA(3);I<yA;++I)e[I]=s[lA+I]}for(;I<dA;++I)e[I]=e[I-_]}}A.l=h,A.p=O,A.b=I,A.f=l,h&&(l=1,A.m=C,A.d=E,A.n=B)}while(!l);return I!=e.length&&r?vt(e,0,I):e.subarray(0,I)},$o=new hA(0),KA=function(t,A){return t[A]|t[A+1]<<8},LA=function(t,A){return(t[A]|t[A+1]<<8|t[A+2]<<16|t[A+3]<<24)>>>0},Re=function(t,A){return LA(t,A)+LA(t,A+4)*4294967296},Vo=function(t){(t[0]!=31||t[1]!=139||t[2]!=8)&&mA(6,"invalid gzip data");var A=t[3],e=10;A&4&&(e+=(t[10]|t[11]<<8)+2);for(var s=(A>>3&1)+(A>>4&1);s>0;s-=!t[e++]);return e+(A&2)},Ye=function(){function t(A,e){typeof A=="function"&&(e=ALine truncated
`).map(r=>{const a=r.trimEnd();return A?a:a.length>0?(A=!0,a):null}).filter(r=>r!=null);for(;e.length>0&&e[e.length-1].length===0;)e.pop();if(e.length===0)return[];const s=(i=e[0].match(/^\s*/))==null?void 0:i[0];if(!s)return e;const n=new RegExp(`^${s}`);return e.map(r=>r.replace(n,""))}function CA(t){return YA(t).join(`
`)}class v extends V{constructor({a:A,outKey:e,outTypeFunc:s}){const n={a:$(A)},i=s($(A)),r={[e]:i};super({inTypes:n,outTypes:r,inputs:{a:A}}),this.outKey=e}dynoOut(){return new K(this,this.outKey)}}class tA extends V{constructor({a:A,b:e,outKey:s,outTypeFunc:n}){const i={a:$(A),b:$(e)},r=n($(A),$(e)),a={[s]:r};super({inTypes:i,outTypes:a,inputs:{a:A,b:e}}),this.outKey=s}dynoOut(){return new K(this,this.outKey)}}class wt extends V{constructor({a:A,b:e,c:s,outKey:n,outTypeFunc:i}){const r={a:$(A),b:$(e),c:$(s)},a=i($(A),$(e),$(s)),o={[n]:a};super({inTypes:r,outTypes:o,inputs:{a:A,b:e,c:s}}),this.outKey=n}dynoOut(){return new K(this,this.outKey)}}const AA={type:"Gsplat"},ie={type:"PackedSplats"},wc=t=>new Zs({packedSplats:t}),Ft=(t,A)=>new Os({packedSplats:t,index:A}),Ps=(t,A,e,s)=>new js({packedSplats:t,index:A,base:e,count:s}),Bt=t=>new Ws({gsplat:t}),rt=({gsplat:t,flags:A,index:e,center:s,scales:n,quaternion:i,rgba:r,rgb:a,opacity:o,x:g,y:l,z:c,r:I,g:h,b:E})=>new An({gsplat:t,flags:A,index:e,center:s,scales:n,quaternion:i,rgba:r,rgb:a,opacity:o,x:g,y:l,z:c,r:I,g:h,b:E}),He=t=>new en({gsplat:t}),ts=(t,{scale:A,rotate:e,translate:s,recolor:n})=>new sn({gsplat:t,scale:A,rotate:e,translate:s,recolor:n}),NA=CA(`
`)}class v extends V{constructor({a:A,outKey:e,outTypeFunc:s}){const n={a:$(A)},i=s($(A)),r={[e]:i};super({inTypes:n,outTypes:r,inputs:{a:A}}),this.outKey=e}dynoOut(){return new K(this,this.outKey)}}class tA extends V{constructor({a:A,b:e,outKey:s,outTypeFunc:n}){const i={a:$(A),b:$(e)},r=n($(A),$(e)),a={[s]:r};super({inTypes:i,outTypes:a,inputs:{a:A,b:e}}),this.outKey=s}dynoOut(){return new K(this,this.outKey)}}class wt extends V{constructor({a:A,b:e,c:s,outKey:n,outTypeFunc:i}){const r={a:$(A),b:$(e),c:$(s)},a=i($(A),$(e),$(s)),o={[n]:a};super({inTypes:r,outTypes:o,inputs:{a:A,b:e,c:s}}),this.outKey=n}dynoOut(){return new K(this,this.outKey)}}const AA={type:"Gsplat"},ie={type:"PackedSplats"},wc=t=>new Ps({packedSplats:t}),Ft=(t,A)=>new Xs({packedSplats:t,index:A}),Vs=(t,A,e,s)=>new Os({packedSplats:t,index:A,base:e,count:s}),Bt=t=>new js({gsplat:t}),rt=({gsplat:t,flags:A,index:e,center:s,scales:n,quaternion:i,rgba:r,rgb:a,opacity:o,x:g,y:l,z:c,r:I,g:h,b:E})=>new Ws({gsplat:t,flags:A,index:e,center:s,scales:n,quaternion:i,rgba:r,rgb:a,opacity:o,x:g,y:l,z:c,r:I,g:h,b:E}),He=t=>new tn({gsplat:t}),ts=(t,{scale:A,rotate:e,translate:s,recolor:n})=>new en({gsplat:t,scale:A,rotate:e,translate:s,recolor:n}),NA=CA(`
struct Gsplat {
vec3 center;
uint flags;
@@ -20,7 +20,7 @@
int numSplats;
vec4 rgbMinMaxLnScaleMinMax;
};
`);class Zs extends v{constructor({packedSplats:A}){super({a:A,outKey:"numSplats",outTypeFunc:()=>"int"}),this.statements=({inputs:e,outputs:s})=>[`${s.numSplats} = ${e.a}.numSplats;`]}}const Xs=CA(`
`);class Ps extends v{constructor({packedSplats:A}){super({a:A,outKey:"numSplats",outTypeFunc:()=>"int"}),this.statements=({inputs:e,outputs:s})=>[`${s.numSplats} = ${e.a}.numSplats;`]}}const Zs=CA(`
bool readPackedSplat(usampler2DArray texture, int numSplats, vec4 rgbMinMaxLnScaleMinMax, int index, out Gsplat gsplat) {
if ((index >= 0) && (index < numSplats)) {
uvec4 packed = texelFetch(texture, splatTexCoord(index), 0);
@@ -30,14 +30,14 @@
return false;
}
}
`);class Os extends V{constructor({packedSplats:A,index:e}){super({inTypes:{packedSplats:ie,index:"int"},outTypes:{gsplat:AA},inputs:{packedSplats:A,index:e},globals:()=>[NA,me,Xs],statements:({inputs:s,outputs:n})=>{const{gsplat:i}=n;if(!i)return[];const{packedSplats:r,index:a}=s;let o;return r&&a?o=YA(`
`);class Xs extends V{constructor({packedSplats:A,index:e}){super({inTypes:{packedSplats:ie,index:"int"},outTypes:{gsplat:AA},inputs:{packedSplats:A,index:e},globals:()=>[NA,me,Zs],statements:({inputs:s,outputs:n})=>{const{gsplat:i}=n;if(!i)return[];const{packedSplats:r,index:a}=s;let o;return r&&a?o=YA(`
if (readPackedSplat(${r}.texture, ${r}.numSplats, ${r}.rgbMinMaxLnScaleMinMax, ${a}, ${i})) {
bool zeroSize = all(equal(${i}.scales, vec3(0.0, 0.0, 0.0)));
${i}.flags = zeroSize ? 0u : GSPLAT_FLAG_ACTIVE;
} else {
${i}.flags = 0u;
}
`):o=[`${i}.flags = 0u;`],o.push(`${i}.index = ${a??"0"};`),o}})}dynoOut(){return new K(this,"gsplat")}}class js extends V{constructor({packedSplats:A,index:e,base:s,count:n}){super({inTypes:{packedSplats:ie,index:"int",base:"int",count:"int"},outTypes:{gsplat:AA},inputs:{packedSplats:A,index:e,base:s,count:n},globals:()=>[NA,me,Xs],statements:({inputs:i,outputs:r})=>{const{gsplat:a}=r;if(!a)return[];const{packedSplats:o,index:g,base:l,count:c}=i;let I;return o&&g&&l&&c?I=YA(`
`):o=[`${i}.flags = 0u;`],o.push(`${i}.index = ${a??"0"};`),o}})}dynoOut(){return new K(this,"gsplat")}}class Os extends V{constructor({packedSplats:A,index:e,base:s,count:n}){super({inTypes:{packedSplats:ie,index:"int",base:"int",count:"int"},outTypes:{gsplat:AA},inputs:{packedSplats:A,index:e,base:s,count:n},globals:()=>[NA,me,Zs],statements:({inputs:i,outputs:r})=>{const{gsplat:a}=r;if(!a)return[];const{packedSplats:o,index:g,base:l,count:c}=i;let I;return o&&g&&l&&c?I=YA(`
${a}.flags = 0u;
if ((${g} >= ${l}) && (${g} < (${l} + ${c}))) {
if (readPackedSplat(${o}.texture, ${o}.numSplats, ${o}.rgbMinMaxLnScaleMinMax, ${g}, ${a})) {
@@ -45,7 +45,7 @@
${a}.flags = zeroSize ? 0u : GSPLAT_FLAG_ACTIVE;
}
}
`):I=[`${a}.flags = 0u;`],I.push(`${a}.index = ${g??"0"};`),I}})}dynoOut(){return new K(this,"gsplat")}}class Ws extends V{constructor({gsplat:A}){super({inTypes:{gsplat:AA},outTypes:{flags:"uint",active:"bool",index:"int",center:"vec3",scales:"vec3",quaternion:"vec4",rgba:"vec4",rgb:"vec3",opacity:"float",x:"float",y:"float",z:"float",r:"float",g:"float",b:"float"},inputs:{gsplat:A},globals:()=>[NA],statements:({inputs:e,outputs:s})=>{const{gsplat:n}=e,{flags:i,active:r,index:a,center:o,scales:g,quaternion:l,rgba:c,rgb:I,opacity:h,x:E,y:C,z:B,r:Q,g:f,b:p}=s;return[i?`${i} = ${n?`${n}.flags`:"0u"};`:null,r?`${r} = isGsplatActive(${n?`${n}.flags`:"0u"});`:null,a?`${a} = ${n?`${n}.index`:"0"};`:null,o?`${o} = ${n?`${n}.center`:"vec3(0.0, 0.0, 0.0)"};`:null,g?`${g} = ${n?`${n}.scales`:"vec3(0.0, 0.0, 0.0)"};`:null,l?`${l} = ${n?`${n}.quaternion`:"vec4(0.0, 0.0, 0.0, 1.0)"};`:null,c?`${c} = ${n?`${n}.rgba`:"vec4(0.0, 0.0, 0.0, 0.0)"};`:null,I?`${I} = ${n?`${n}.rgba.rgb`:"vec3(0.0, 0.0, 0.0)"};`:null,h?`${h} = ${n?`${n}.rgba.a`:"0.0"};`:null,E?`${E} = ${n?`${n}.center.x`:"0.0"};`:null,C?`${C} = ${n?`${n}.center.y`:"0.0"};`:null,B?`${B} = ${n?`${n}.center.z`:"0.0"};`:null,Q?`${Q} = ${n?`${n}.rgba.r`:"0.0"};`:null,f?`${f} = ${n?`${n}.rgba.g`:"0.0"};`:null,p?`${p} = ${n?`${n}.rgba.b`:"0.0"};`:null].filter(Boolean)}})}}class An extends V{constructor({gsplat:A,flags:e,index:s,center:n,scales:i,quaternion:r,rgba:a,rgb:o,opacity:g,x:l,y:c,z:I,r:h,g:E,b:C}){super({inTypes:{gsplat:AA,flags:"uint",index:"int",center:"vec3",scales:"vec3",quaternion:"vec4",rgba:"vec4",rgb:"vec3",opacity:"float",x:"float",y:"float",z:"float",r:"float",g:"float",b:"float"},outTypes:{gsplat:AA},inputs:{gsplat:A,flags:e,index:s,center:n,scales:i,quaternion:r,rgba:a,rgb:o,opacity:g,x:l,y:c,z:I,r:h,g:E,b:C},globals:()=>[NA],statements:({inputs:B,outputs:Q})=>{const{gsplat:f}=Q;if(!f)return[];const{gsplat:p,flags:d,index:y,center:D,scales:x,quaternion:w,rgba:m,rgb:k,opacity:M,x:S,y:U,z:F,r:b,g:T,b:R}=B;return[`${f}.flags = ${d??(p?`${p}.flags`:"0u")};`,`${f}.index = ${y??(p?`${p}.index`:"0")};`,`${f}.center = ${D??(p?`${p}.center`:"vec3(0.0, 0.0, 0.0)")};`,`${f}.scales = ${x??(p?`${p}.scales`:"vec3(0.0, 0.0, 0.0)")};`,`${f}.quaternion = ${w??(p?`${p}.quaternion`:"vec4(0.0, 0.0, 0.0, 1.0)")};`,`${f}.rgba = ${m??(p?`${p}.rgba`:"vec4(0.0, 0.0, 0.0, 0.0)")};`,k?`${f}.rgba.rgb = ${k};`:null,M?`${f}.rgba.a = ${M};`:null,S?`${f}.center.x = ${S};`:null,U?`${f}.center.y = ${U};`:null,F?`${f}.center.z = ${F};`:null,b?`${f}.rgba.r = ${b};`:null,T?`${f}.rgba.g = ${T};`:null,R?`${f}.rgba.b = ${R};`:null].filter(Boolean)}})}dynoOut(){return new K(this,"gsplat")}}const tn=CA(`
`):I=[`${a}.flags = 0u;`],I.push(`${a}.index = ${g??"0"};`),I}})}dynoOut(){return new K(this,"gsplat")}}class js extends V{constructor({gsplat:A}){super({inTypes:{gsplat:AA},outTypes:{flags:"uint",active:"bool",index:"int",center:"vec3",scales:"vec3",quaternion:"vec4",rgba:"vec4",rgb:"vec3",opacity:"float",x:"float",y:"float",z:"float",r:"float",g:"float",b:"float"},inputs:{gsplat:A},globals:()=>[NA],statements:({inputs:e,outputs:s})=>{const{gsplat:n}=e,{flags:i,active:r,index:a,center:o,scales:g,quaternion:l,rgba:c,rgb:I,opacity:h,x:E,y:C,z:B,r:Q,g:f,b:p}=s;return[i?`${i} = ${n?`${n}.flags`:"0u"};`:null,r?`${r} = isGsplatActive(${n?`${n}.flags`:"0u"});`:null,a?`${a} = ${n?`${n}.index`:"0"};`:null,o?`${o} = ${n?`${n}.center`:"vec3(0.0, 0.0, 0.0)"};`:null,g?`${g} = ${n?`${n}.scales`:"vec3(0.0, 0.0, 0.0)"};`:null,l?`${l} = ${n?`${n}.quaternion`:"vec4(0.0, 0.0, 0.0, 1.0)"};`:null,c?`${c} = ${n?`${n}.rgba`:"vec4(0.0, 0.0, 0.0, 0.0)"};`:null,I?`${I} = ${n?`${n}.rgba.rgb`:"vec3(0.0, 0.0, 0.0)"};`:null,h?`${h} = ${n?`${n}.rgba.a`:"0.0"};`:null,E?`${E} = ${n?`${n}.center.x`:"0.0"};`:null,C?`${C} = ${n?`${n}.center.y`:"0.0"};`:null,B?`${B} = ${n?`${n}.center.z`:"0.0"};`:null,Q?`${Q} = ${n?`${n}.rgba.r`:"0.0"};`:null,f?`${f} = ${n?`${n}.rgba.g`:"0.0"};`:null,p?`${p} = ${n?`${n}.rgba.b`:"0.0"};`:null].filter(Boolean)}})}}class Ws extends V{constructor({gsplat:A,flags:e,index:s,center:n,scales:i,quaternion:r,rgba:a,rgb:o,opacity:g,x:l,y:c,z:I,r:h,g:E,b:C}){super({inTypes:{gsplat:AA,flags:"uint",index:"int",center:"vec3",scales:"vec3",quaternion:"vec4",rgba:"vec4",rgb:"vec3",opacity:"float",x:"float",y:"float",z:"float",r:"float",g:"float",b:"float"},outTypes:{gsplat:AA},inputs:{gsplat:A,flags:e,index:s,center:n,scales:i,quaternion:r,rgba:a,rgb:o,opacity:g,x:l,y:c,z:I,r:h,g:E,b:C},globals:()=>[NA],statements:({inputs:B,outputs:Q})=>{const{gsplat:f}=Q;if(!f)return[];const{gsplat:p,flags:d,index:y,center:D,scales:x,quaternion:w,rgba:m,rgb:k,opacity:M,x:S,y:U,z:F,r:b,g:T,b:R}=B;return[`${f}.flags = ${d??(p?`${p}.flags`:"0u")};`,`${f}.index = ${y??(p?`${p}.index`:"0")};`,`${f}.center = ${D??(p?`${p}.center`:"vec3(0.0, 0.0, 0.0)")};`,`${f}.scales = ${x??(p?`${p}.scales`:"vec3(0.0, 0.0, 0.0)")};`,`${f}.quaternion = ${w??(p?`${p}.quaternion`:"vec4(0.0, 0.0, 0.0, 1.0)")};`,`${f}.rgba = ${m??(p?`${p}.rgba`:"vec4(0.0, 0.0, 0.0, 0.0)")};`,k?`${f}.rgba.rgb = ${k};`:null,M?`${f}.rgba.a = ${M};`:null,S?`${f}.center.x = ${S};`:null,U?`${f}.center.y = ${U};`:null,F?`${f}.center.z = ${F};`:null,b?`${f}.rgba.r = ${b};`:null,T?`${f}.rgba.g = ${T};`:null,R?`${f}.rgba.b = ${R};`:null].filter(Boolean)}})}dynoOut(){return new K(this,"gsplat")}}const An=CA(`
vec3 gsplatNormal(vec3 scales, vec4 quaternion) {
float minScale = min(scales.x, min(scales.y, scales.z));
vec3 normal;
@@ -58,13 +58,13 @@
}
return quatVec(quaternion, normal);
}
`);class en extends v{constructor({gsplat:A}){super({a:A,outKey:"normal",outTypeFunc:()=>"vec3"}),this.globals=()=>[NA,tn],this.statements=({inputs:e,outputs:s})=>[`${s.normal} = gsplatNormal(${e.a}.scales, ${e.a}.quaternion);`]}}class sn extends V{constructor({gsplat:A,scale:e,rotate:s,translate:n,recolor:i}){super({inTypes:{gsplat:AA,scale:"float",rotate:"vec4",translate:"vec3",recolor:"vec4"},outTypes:{gsplat:AA},inputs:{gsplat:A,scale:e,rotate:s,translate:n,recolor:i},globals:()=>[NA],statements:({inputs:r,outputs:a,compile:o})=>{const{gsplat:g}=a;if(!g||!r.gsplat)return[];const{scale:l,rotate:c,translate:I,recolor:h}=r,E=o.indent;return[`${g} = ${r.gsplat};`,`if (isGsplatActive(${g}.flags)) {`,l?`${E}${g}.center *= ${l};`:null,c?`${E}${g}.center = quatVec(${c}, ${g}.center);`:null,I?`${E}${g}.center += ${I};`:null,l?`${E}${g}.scales *= ${l};`:null,c?`${E}${g}.quaternion = quatQuat(${c}, ${g}.quaternion);`:null,h?`${E}${g}.rgba *= ${h};`:null,"}"].filter(Boolean)}})}dynoOut(){return new K(this,"gsplat")}}const nn=(t,A)=>new rn({gsplat:t,rgbMinMaxLnScaleMinMax:A}),mc=t=>new es({rgba8:t});class rn extends V{constructor({gsplat:A,rgbMinMaxLnScaleMinMax:e}){super({inTypes:{gsplat:AA,rgbMinMaxLnScaleMinMax:"vec4"},inputs:{gsplat:A,rgbMinMaxLnScaleMinMax:e},globals:()=>[NA],statements:({inputs:s,outputs:n})=>{const{output:i}=n;if(!i)return[];const{gsplat:r,rgbMinMaxLnScaleMinMax:a}=s;return r?YA(`
`);class tn extends v{constructor({gsplat:A}){super({a:A,outKey:"normal",outTypeFunc:()=>"vec3"}),this.globals=()=>[NA,An],this.statements=({inputs:e,outputs:s})=>[`${s.normal} = gsplatNormal(${e.a}.scales, ${e.a}.quaternion);`]}}class en extends V{constructor({gsplat:A,scale:e,rotate:s,translate:n,recolor:i}){super({inTypes:{gsplat:AA,scale:"float",rotate:"vec4",translate:"vec3",recolor:"vec4"},outTypes:{gsplat:AA},inputs:{gsplat:A,scale:e,rotate:s,translate:n,recolor:i},globals:()=>[NA],statements:({inputs:r,outputs:a,compile:o})=>{const{gsplat:g}=a;if(!g||!r.gsplat)return[];const{scale:l,rotate:c,translate:I,recolor:h}=r,E=o.indent;return[`${g} = ${r.gsplat};`,`if (isGsplatActive(${g}.flags)) {`,l?`${E}${g}.center *= ${l};`:null,c?`${E}${g}.center = quatVec(${c}, ${g}.center);`:null,I?`${E}${g}.center += ${I};`:null,l?`${E}${g}.scales *= ${l};`:null,c?`${E}${g}.quaternion = quatQuat(${c}, ${g}.quaternion);`:null,h?`${E}${g}.rgba *= ${h};`:null,"}"].filter(Boolean)}})}dynoOut(){return new K(this,"gsplat")}}const sn=(t,A)=>new nn({gsplat:t,rgbMinMaxLnScaleMinMax:A}),mc=t=>new es({rgba8:t});class nn extends V{constructor({gsplat:A,rgbMinMaxLnScaleMinMax:e}){super({inTypes:{gsplat:AA,rgbMinMaxLnScaleMinMax:"vec4"},inputs:{gsplat:A,rgbMinMaxLnScaleMinMax:e},globals:()=>[NA],statements:({inputs:s,outputs:n})=>{const{output:i}=n;if(!i)return[];const{gsplat:r,rgbMinMaxLnScaleMinMax:a}=s;return r?YA(`
if (isGsplatActive(${r}.flags)) {
${i} = packSplatEncoding(${r}.center, ${r}.scales, ${r}.quaternion, ${r}.rgba, ${a});
} else {
${i} = uvec4(0u, 0u, 0u, 0u);
}
`):[`${i} = uvec4(0u, 0u, 0u, 0u);`]}})}dynoOut(){return new K(this,"output")}}class es extends V{constructor({rgba8:A}){super({inTypes:{rgba8:"vec4"},inputs:{rgba8:A},statements:({inputs:e,outputs:s})=>[`target = ${e.rgba8??"vec4(0.0, 0.0, 0.0, 0.0)"};`]})}dynoOut(){return new K(this,"rgba8")}}const xc=(t,A,e)=>new N({key:t,type:A,value:e}),Sc=(t=!1,A)=>new Ce({key:A,value:t}),Dc=(t=0,A)=>new an({key:A,value:t}),Mc=(t=0,A)=>new Zt({key:A,value:t}),qA=(t=0,A)=>new Et({key:A,value:t}),vc=(t,A)=>new on({key:A,value:t}),bc=(t,A)=>new cn({key:A,value:t}),Fc=(t,A)=>new gn({key:A,value:t}),Nc=(t,A)=>new qt({key:A,value:t}),kc=(t,A)=>new ln({key:A,value:t}),Tc=(t,A)=>new In({key:A,value:t}),Uc=(t,A)=>new un({key:A,value:t}),et=(t,A)=>new Nt({key:A,value:t}),Gc=(t,A)=>new hn({key:A,value:t}),Rc=(t,A)=>new Cn({key:A,value:t}),Yc=(t,A)=>new Bn({key:A,value:t}),Jc=(t,A)=>new Gt({key:A,value:t}),_c=(t,A)=>new En({key:A,value:t}),Lc=(t,A)=>new Qn({key:A,value:t}),zc=(t,A)=>new pn({key:A,value:t}),Hc=(t,A)=>new fn({key:A,value:t}),qc=(t,A)=>new dn({key:A,value:t}),Kc=(t,A)=>new yn({key:A,value:t}),$c=(t,A)=>new wn({key:A,value:t}),Vc=(t,A)=>new mn({key:A,value:t}),Pc=(t,A)=>new xn({key:A,value:t}),Zc=(t,A)=>new Sn({key:A,value:t}),Xc=(t,A)=>new Dn({key:A,value:t}),Oc=(t,A)=>new Mn({key:A,value:t}),jc=(t,A)=>new vn({key:A,value:t}),Wc=(t,A)=>new bn({key:A,value:t}),Ag=(t,A)=>new Fn({key:A,value:t}),tg=(t,A)=>new Kt({key:A,value:t}),eg=(t,A)=>new Nn({key:t,value:A}),sg=(t,A)=>new kn({key:A,value:t}),ng=(t,A)=>new Tn({key:A,value:t}),ig=(t,A)=>new Un({key:A,value:t}),rg=(t,A)=>new Gn({key:A,value:t}),ag=(t,A)=>new Rn({key:A,value:t}),og=(t,A)=>new Yn({key:A,value:t}),cg=(t,A)=>new Jn({key:A,value:t}),gg=(t,A)=>new _n({key:A,value:t}),lg=(t,A)=>new Ln({key:A,value:t}),Ig=(t,A)=>new zn({key:A,value:t});class N extends V{constructor({key:A,type:e,count:s,value:n,update:i,globals:r}){A=A??"value",super({outTypes:{[A]:e},update:()=>{if(i){const a=i(this.value);a!==void 0&&(this.value=a)}this.uniform.value=this.value},generate:({inputs:a,outputs:o})=>{const g=(r==null?void 0:r({inputs:a,outputs:o}))??[],l={},c=o[A];return c&&(g.push(`uniform ${As(c,e,s)};`),l[c]=this.uniform),{globals:g,uniforms:l}}}),this.type=e,this.count=s,this.value=n,this.uniform={value:n},this.outKey=A}dynoOut(){return new K(this,this.outKey)}}class Ce extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"bool",value:e,update:s})}}class an extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"uint",value:e,update:s})}}class Zt extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"int",value:e,update:s})}}class Et extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"float",value:e,update:s})}}class on extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"bvec2",value:e,update:s})}}class cn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"uvec2",value:e,update:s})}}class gn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"ivec2",value:e,update:s})}}class qt extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"vec2",value:e,update:s})}}class ln extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"bvec3",value:e,update:s})}}class In extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"uvec3",value:e,update:s})}}class un extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"ivec3",value:e,update:s})}}class Nt extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"vec3",value:e,update:s})}}class hn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"bvec4",value:e,update:s})}}class Cn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"uvec4",value:e,update:s})}}class Bn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"ivec4",value:e,update:s})}}class Gt extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"vec4",value:e,update:s})}}class En extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat2",value:e,update:s})}}class Qn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat2x2",value:e,update:s})}}class pn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat2x3",value:e,update:s})}}class fn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat2x4",value:e,update:s})}}class dn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat3",value:e,update:s})}}class yn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat3x2",value:e,update:s})}}class wn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat3x3",value:e,update:s})}}class mn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat3x4",value:e,update:s})}}class xn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat4",value:e,update:s})}}class Sn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat4x2" Line truncated
`):[`${i} = uvec4(0u, 0u, 0u, 0u);`]}})}dynoOut(){return new K(this,"output")}}class es extends V{constructor({rgba8:A}){super({inTypes:{rgba8:"vec4"},inputs:{rgba8:A},statements:({inputs:e,outputs:s})=>[`target = ${e.rgba8??"vec4(0.0, 0.0, 0.0, 0.0)"};`]})}dynoOut(){return new K(this,"rgba8")}}const xc=(t,A,e)=>new N({key:t,type:A,value:e}),Sc=(t=!1,A)=>new Ce({key:A,value:t}),Dc=(t=0,A)=>new rn({key:A,value:t}),Mc=(t=0,A)=>new Zt({key:A,value:t}),qA=(t=0,A)=>new Et({key:A,value:t}),vc=(t,A)=>new an({key:A,value:t}),bc=(t,A)=>new on({key:A,value:t}),Fc=(t,A)=>new cn({key:A,value:t}),Nc=(t,A)=>new qt({key:A,value:t}),kc=(t,A)=>new gn({key:A,value:t}),Tc=(t,A)=>new ln({key:A,value:t}),Uc=(t,A)=>new In({key:A,value:t}),et=(t,A)=>new Nt({key:A,value:t}),Gc=(t,A)=>new un({key:A,value:t}),Rc=(t,A)=>new hn({key:A,value:t}),Yc=(t,A)=>new Cn({key:A,value:t}),Jc=(t,A)=>new Gt({key:A,value:t}),_c=(t,A)=>new Bn({key:A,value:t}),Lc=(t,A)=>new En({key:A,value:t}),zc=(t,A)=>new Qn({key:A,value:t}),Hc=(t,A)=>new pn({key:A,value:t}),qc=(t,A)=>new fn({key:A,value:t}),Kc=(t,A)=>new dn({key:A,value:t}),$c=(t,A)=>new yn({key:A,value:t}),Vc=(t,A)=>new wn({key:A,value:t}),Pc=(t,A)=>new mn({key:A,value:t}),Zc=(t,A)=>new xn({key:A,value:t}),Xc=(t,A)=>new Sn({key:A,value:t}),Oc=(t,A)=>new Dn({key:A,value:t}),jc=(t,A)=>new Mn({key:A,value:t}),Wc=(t,A)=>new vn({key:A,value:t}),Ag=(t,A)=>new bn({key:A,value:t}),tg=(t,A)=>new Kt({key:A,value:t}),eg=(t,A)=>new Fn({key:t,value:A}),sg=(t,A)=>new Nn({key:A,value:t}),ng=(t,A)=>new kn({key:A,value:t}),ig=(t,A)=>new Tn({key:A,value:t}),rg=(t,A)=>new Un({key:A,value:t}),ag=(t,A)=>new Gn({key:A,value:t}),og=(t,A)=>new Rn({key:A,value:t}),cg=(t,A)=>new Yn({key:A,value:t}),gg=(t,A)=>new Jn({key:A,value:t}),lg=(t,A)=>new _n({key:A,value:t}),Ig=(t,A)=>new Ln({key:A,value:t});class N extends V{constructor({key:A,type:e,count:s,value:n,update:i,globals:r}){A=A??"value",super({outTypes:{[A]:e},update:()=>{if(i){const a=i(this.value);a!==void 0&&(this.value=a)}this.uniform.value=this.value},generate:({inputs:a,outputs:o})=>{const g=(r==null?void 0:r({inputs:a,outputs:o}))??[],l={},c=o[A];return c&&(g.push(`uniform ${As(c,e,s)};`),l[c]=this.uniform),{globals:g,uniforms:l}}}),this.type=e,this.count=s,this.value=n,this.uniform={value:n},this.outKey=A}dynoOut(){return new K(this,this.outKey)}}class Ce extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"bool",value:e,update:s})}}class rn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"uint",value:e,update:s})}}class Zt extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"int",value:e,update:s})}}class Et extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"float",value:e,update:s})}}class an extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"bvec2",value:e,update:s})}}class on extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"uvec2",value:e,update:s})}}class cn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"ivec2",value:e,update:s})}}class qt extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"vec2",value:e,update:s})}}class gn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"bvec3",value:e,update:s})}}class ln extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"uvec3",value:e,update:s})}}class In extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"ivec3",value:e,update:s})}}class Nt extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"vec3",value:e,update:s})}}class un extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"bvec4",value:e,update:s})}}class hn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"uvec4",value:e,update:s})}}class Cn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"ivec4",value:e,update:s})}}class Gt extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"vec4",value:e,update:s})}}class Bn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat2",value:e,update:s})}}class En extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat2x2",value:e,update:s})}}class Qn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat2x3",value:e,update:s})}}class pn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat2x4",value:e,update:s})}}class fn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat3",value:e,update:s})}}class dn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat3x2",value:e,update:s})}}class yn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat3x3",value:e,update:s})}}class wn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat3x4",value:e,update:s})}}class mn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat4",value:e,update:s})}}class xn extends N{constructor({key:A,value:e,update:s}){super({key:A,type:"mat4x2" Line truncated
precision highp float;
in vec3 position;
@@ -72,10 +72,10 @@
void main() {
gl_Position = vec4(position.xy, 0.0, 1.0);
}
`);function si(t){const A=new u.Vector3;for(const e of t)A.add(e);return A.divideScalar(t.length)}function ni(t){if(t.length===0)return new u.Quaternion;const A=t[0].clone();for(let e=1;e<t.length;e++)t[e].dot(t[0])<0?(A.x-=t[e].x,A.y-=t[e].y,A.z-=t[e].z,A.w-=t[e].w):(A.x+=t[e].x,A.y+=t[e].y,A.z+=t[e].z,A.w+=t[e].w);return A.normalize()}function ii(t,A){const e=new u.Vector3(0,0,0).applyMatrix4(t),s=new u.Vector3(0,0,0).applyMatrix4(A),n=new u.Vector3(0,0,-1).applyMatrix4(t).sub(e).normalize(),i=new u.Vector3(0,0,-1).applyMatrix4(A).sub(s).normalize(),r=e.distanceTo(s),a=n.dot(i);return{distance:r,coincidence:a}}function Gg({matrix1:t,matrix2:A,maxDistance:e}){const s=new u.Vector3(0,0,0).applyMatrix4(t),n=new u.Vector3(0,0,0).applyMatrix4(A);return s.distanceTo(n)<=e}function Rg({matrix1:t,matrix2:A,maxDistance:e,minCoincidence:s}){const{distance:n,coincidence:i}=ii(t,A);return n<=e&&(s==null||i>=s)}function ri(t,A){const[e,s]=[new u.Vector3,new u.Quaternion],[n,i]=[new u.Vector3,new u.Quaternion];t.decompose(e,s,new u.Vector3),A.decompose(n,i,new u.Vector3);const r=e.distanceTo(n),a=Math.abs(s.dot(i));return{distance:r,coorient:a}}function Qe({matrix1:t,matrix2:A,maxDistance:e,minCoorient:s}){const{distance:n,coorient:i}=ri(t,A);return n<=e&&(s==null||i>=s)}function Yg(t,A=.001){return Math.abs(t)<A?0:Math.sign(t)}function Jg(t){const A=t.w<0,e=Vt(A?-t.x:t.x),s=Vt(A?-t.y:t.y),n=Vt(A?-t.z:t.z),i=e&255,r=s&255,a=n&255;return i|r<<8|a<<16}function _g(t,A){const e=t<<24>>24,s=t<<16>>24,n=t<<8>>24;A.set(e/127,s/127,n/127,0);const i=A.x*A.x+A.y*A.y+A.z*A.z;return A.w=Math.sqrt(Math.max(0,1-i)),A}const Lg=new u.Quaternion,qe=new u.Vector3;function ns(t){const A=Lg.copy(t).normalize();A.w<0&&A.set(-A.x,-A.y,-A.z,-A.w);const e=2*Math.acos(A.w),s=Math.sqrt(A.x*A.x+A.y*A.y+A.z*A.z),n=s<1e-6?qe.set(1,0,0):qe.set(A.x,A.y,A.z).divideScalar(s),i=Math.abs(n.x)+Math.abs(n.y)+Math.abs(n.z);let r=n.x/i,a=n.y/i;if(n.z<0){const h=r;r=(1-Math.abs(a))*(r>=0?1:-1),a=(1-Math.abs(h))*(a>=0?1:-1)}const o=r*.5+.5,g=a*.5+.5,l=Math.round(o*255),c=Math.round(g*255);return Math.round(e*(255/Math.PI))<<16|c<<8|l}function ai(t,A){const e=t&255,s=t>>>8&255,n=t>>>16&255,i=e/255,r=s/255;let a=(i-.5)*2,o=(r-.5)*2;const g=1-(Math.abs(a)+Math.abs(o)),l=Math.max(-g,0);a+=a>=0?-l:l,o+=o>=0?-l:l;const c=qe.set(a,o,g).normalize(),h=n/255*Math.PI*.5,E=Math.sin(h),C=Math.cos(h);return A.set(c.x*E,c.y*E,c.z*E,C),A}function zg(t){const A=t.clone().normalize(),e=2*(A.w*A.x+A.y*A.z),s=1-2*(A.x*A.x+A.y*A.y),n=Math.atan2(e,s),i=2*(A.w*A.y-A.z*A.x),r=Math.abs(i)>=1?Math.sign(i)*(Math.PI/2):Math.asin(i),a=2*(A.w*A.z+A.x*A.y),o=1-2*(A.y*A.y+A.z*A.z),g=Math.atan2(a,o),l=(n+Math.PI)/(2*Math.PI),c=(r+Math.PI)/(2*Math.PI),I=(g+Math.PI)/(2*Math.PI),h=Math.round(l*255),E=Math.round(c*255);return Math.round(I*255)<<16|E<<8|h}function Hg(t,A){const e=t&255,s=t>>>8&255,n=t>>>16&255,i=e/255,r=s/255,a=n/255,o=i*(2*Math.PI)-Math.PI,g=r*(2*Math.PI)-Math.PI,l=a*(2*Math.PI)-Math.PI,c=Math.cos(o*.5),I=Math.sin(o*.5),h=Math.cos(g*.5),E=Math.sin(g*.5),C=Math.cos(l*.5),B=Math.sin(l*.5);return A.w=c*h*C+I*E*B,A.x=I*h*C-c*E*B,A.y=c*E*C+I*h*B,A.z=c*h*B-I*E*C,A.normalize(),A}function oe(t,A,e,s){const n=Math.max(-127,Math.min(127,t*127)),i=Math.max(-127,Math.min(127,A*127)),r=Math.max(-127,Math.min(127,e*127)),a=Math.max(-127,Math.min(127,s*127));return n&255|(i&255)<<8|(r&255)<<16|(a&255)<<24}function qg(t,A,e,s){const n=(s==null?void 0:s.sh1Min)??-1,i=(s==null?void 0:s.sh1Max)??1,r=.5*(n+i),a=126/(i-n),o=A*2;for(let g=0;g<9;++g){const l=(e[g]-r)*a,c=Math.round(Math.max(-63,Math.min(63,l)))&127,I=g*7,h=I+7,E=Math.floor(I/32),C=I-E*32,B=c<<C&4294967295;if(t[o+E]|=B,h>E*32+32){const Q=c>>>32-C&4294967295;t[o+E+1]|=Q}}}function Kg(t,A,e,s){const n=(s==null?void 0:s.sh2Min)??-1,i=(s==null?void 0:s.sh2Max)??1,r=.5*(n+i),a=2/(i-n);t[A*4+0]=oe((e[0]-r)*a,(e[1]-r)*a,(e[2]-r)*a,(e[3]-r)*a),t[A*4+1]=oe((e[4]-r)*a,(e[5]-r)*a,(e[6]-r)*a,(e[7]-r)*a),t[A*4+2]=oe((e[8]-r)*a,(e[9]-r)*a,(e[10]-r)*a,(e[11]-r)*a),t[A*4+3]=oe((e[12]-r)*a,(e[13]-r)*a,(e[14]-r)*a,0)}function $g(t,A,e,s){const n=(s==null?void 0:s.sh3Min)??-1,i=(s==null?void 0:s.sh3Max)??1,r=.5*(n+i),a=62/(i-n),o=A*4;for(let g=0;g<21;++g){const l=(e[g]-r)*a,c=Math.round(Math.max(-31,Math.min(31,l)))&63,I=g*6,h=I+6,E=Math.floor(I/32),C=I-E*32,B=c<<C&4294967295;if(t[o+E]|=B,h>E*32+32){const Q=c>>>32-C&4294967295;t[o+E+1]|=Q}}}function oi(t,A){const e=[];let s=0,n=null;const i=new Us((o,g)=>{if(e.push(o),s+=o.length,g||s>=A){const l=new Uint8Array(s);let c=0;for(const I of e)l.set(I,c),c+=I.length;n=l.slice(0,A)}}),r=1024;let a=0;for(;n==null&&a<t.length;){const o=t.slice(a,a+r);i.push(o,!1),a+=r}if(n==null&&(i.push(new Uint8Array,!0),n==null))throw new Error("Failed to decompress partial gzip");return n}class ci{constructor({fileBytes:A,chunkBytes:e=64*1024}){this.fileBytes=A,this.chunkBytes=e,this.offset=0,this.chunks=[],this.totalBytes=0,this.gunzip=new Us((s,n)=>{this.chunks.push(s),this.totalBytes+=s.length})}read(A){for(;this.totalBy Line truncated
`);function ei(t){const A=new u.Vector3;for(const e of t)A.add(e);return A.divideScalar(t.length)}function si(t){if(t.length===0)return new u.Quaternion;const A=t[0].clone();for(let e=1;e<t.length;e++)t[e].dot(t[0])<0?(A.x-=t[e].x,A.y-=t[e].y,A.z-=t[e].z,A.w-=t[e].w):(A.x+=t[e].x,A.y+=t[e].y,A.z+=t[e].z,A.w+=t[e].w);return A.normalize()}function ni(t,A){const e=new u.Vector3(0,0,0).applyMatrix4(t),s=new u.Vector3(0,0,0).applyMatrix4(A),n=new u.Vector3(0,0,-1).applyMatrix4(t).sub(e).normalize(),i=new u.Vector3(0,0,-1).applyMatrix4(A).sub(s).normalize(),r=e.distanceTo(s),a=n.dot(i);return{distance:r,coincidence:a}}function Gg({matrix1:t,matrix2:A,maxDistance:e}){const s=new u.Vector3(0,0,0).applyMatrix4(t),n=new u.Vector3(0,0,0).applyMatrix4(A);return s.distanceTo(n)<=e}function Rg({matrix1:t,matrix2:A,maxDistance:e,minCoincidence:s}){const{distance:n,coincidence:i}=ni(t,A);return n<=e&&(s==null||i>=s)}function ii(t,A){const[e,s]=[new u.Vector3,new u.Quaternion],[n,i]=[new u.Vector3,new u.Quaternion];t.decompose(e,s,new u.Vector3),A.decompose(n,i,new u.Vector3);const r=e.distanceTo(n),a=Math.abs(s.dot(i));return{distance:r,coorient:a}}function Qe({matrix1:t,matrix2:A,maxDistance:e,minCoorient:s}){const{distance:n,coorient:i}=ii(t,A);return n<=e&&(s==null||i>=s)}function Yg(t,A=.001){return Math.abs(t)<A?0:Math.sign(t)}function Jg(t){const A=t.w<0,e=Vt(A?-t.x:t.x),s=Vt(A?-t.y:t.y),n=Vt(A?-t.z:t.z),i=e&255,r=s&255,a=n&255;return i|r<<8|a<<16}function _g(t,A){const e=t<<24>>24,s=t<<16>>24,n=t<<8>>24;A.set(e/127,s/127,n/127,0);const i=A.x*A.x+A.y*A.y+A.z*A.z;return A.w=Math.sqrt(Math.max(0,1-i)),A}const Lg=new u.Quaternion,qe=new u.Vector3;function ns(t){const A=Lg.copy(t).normalize();A.w<0&&A.set(-A.x,-A.y,-A.z,-A.w);const e=2*Math.acos(A.w),s=Math.sqrt(A.x*A.x+A.y*A.y+A.z*A.z),n=s<1e-6?qe.set(1,0,0):qe.set(A.x,A.y,A.z).divideScalar(s),i=Math.abs(n.x)+Math.abs(n.y)+Math.abs(n.z);let r=n.x/i,a=n.y/i;if(n.z<0){const h=r;r=(1-Math.abs(a))*(r>=0?1:-1),a=(1-Math.abs(h))*(a>=0?1:-1)}const o=r*.5+.5,g=a*.5+.5,l=Math.round(o*255),c=Math.round(g*255);return Math.round(e*(255/Math.PI))<<16|c<<8|l}function ri(t,A){const e=t&255,s=t>>>8&255,n=t>>>16&255,i=e/255,r=s/255;let a=(i-.5)*2,o=(r-.5)*2;const g=1-(Math.abs(a)+Math.abs(o)),l=Math.max(-g,0);a+=a>=0?-l:l,o+=o>=0?-l:l;const c=qe.set(a,o,g).normalize(),h=n/255*Math.PI*.5,E=Math.sin(h),C=Math.cos(h);return A.set(c.x*E,c.y*E,c.z*E,C),A}function zg(t){const A=t.clone().normalize(),e=2*(A.w*A.x+A.y*A.z),s=1-2*(A.x*A.x+A.y*A.y),n=Math.atan2(e,s),i=2*(A.w*A.y-A.z*A.x),r=Math.abs(i)>=1?Math.sign(i)*(Math.PI/2):Math.asin(i),a=2*(A.w*A.z+A.x*A.y),o=1-2*(A.y*A.y+A.z*A.z),g=Math.atan2(a,o),l=(n+Math.PI)/(2*Math.PI),c=(r+Math.PI)/(2*Math.PI),I=(g+Math.PI)/(2*Math.PI),h=Math.round(l*255),E=Math.round(c*255);return Math.round(I*255)<<16|E<<8|h}function Hg(t,A){const e=t&255,s=t>>>8&255,n=t>>>16&255,i=e/255,r=s/255,a=n/255,o=i*(2*Math.PI)-Math.PI,g=r*(2*Math.PI)-Math.PI,l=a*(2*Math.PI)-Math.PI,c=Math.cos(o*.5),I=Math.sin(o*.5),h=Math.cos(g*.5),E=Math.sin(g*.5),C=Math.cos(l*.5),B=Math.sin(l*.5);return A.w=c*h*C+I*E*B,A.x=I*h*C-c*E*B,A.y=c*E*C+I*h*B,A.z=c*h*B-I*E*C,A.normalize(),A}function oe(t,A,e,s){const n=Math.max(-127,Math.min(127,t*127)),i=Math.max(-127,Math.min(127,A*127)),r=Math.max(-127,Math.min(127,e*127)),a=Math.max(-127,Math.min(127,s*127));return n&255|(i&255)<<8|(r&255)<<16|(a&255)<<24}function qg(t,A,e,s){const n=(s==null?void 0:s.sh1Min)??-1,i=(s==null?void 0:s.sh1Max)??1,r=.5*(n+i),a=126/(i-n),o=A*2;for(let g=0;g<9;++g){const l=(e[g]-r)*a,c=Math.round(Math.max(-63,Math.min(63,l)))&127,I=g*7,h=I+7,E=Math.floor(I/32),C=I-E*32,B=c<<C&4294967295;if(t[o+E]|=B,h>E*32+32){const Q=c>>>32-C&4294967295;t[o+E+1]|=Q}}}function Kg(t,A,e,s){const n=(s==null?void 0:s.sh2Min)??-1,i=(s==null?void 0:s.sh2Max)??1,r=.5*(n+i),a=2/(i-n);t[A*4+0]=oe((e[0]-r)*a,(e[1]-r)*a,(e[2]-r)*a,(e[3]-r)*a),t[A*4+1]=oe((e[4]-r)*a,(e[5]-r)*a,(e[6]-r)*a,(e[7]-r)*a),t[A*4+2]=oe((e[8]-r)*a,(e[9]-r)*a,(e[10]-r)*a,(e[11]-r)*a),t[A*4+3]=oe((e[12]-r)*a,(e[13]-r)*a,(e[14]-r)*a,0)}function $g(t,A,e,s){const n=(s==null?void 0:s.sh3Min)??-1,i=(s==null?void 0:s.sh3Max)??1,r=.5*(n+i),a=62/(i-n),o=A*4;for(let g=0;g<21;++g){const l=(e[g]-r)*a,c=Math.round(Math.max(-31,Math.min(31,l)))&63,I=g*6,h=I+6,E=Math.floor(I/32),C=I-E*32,B=c<<C&4294967295;if(t[o+E]|=B,h>E*32+32){const Q=c>>>32-C&4294967295;t[o+E+1]|=Q}}}function ai(t,A){const e=[];let s=0,n=null;const i=new Zo((o,g)=>{if(e.push(o),s+=o.length,g||s>=A){const l=new Uint8Array(s);let c=0;for(const I of e)l.set(I,c),c+=I.length;n=l.slice(0,A)}}),r=1024;let a=0;for(;n==null&&a<t.length;){const o=t.slice(a,a+r);i.push(o,!1),a+=r}if(n==null&&(i.push(new Uint8Array,!0),n==null))throw new Error("Failed to decompress partial gzip");return n}class oi{constructor({fileBytes:A,chunkBytes:e=64*1024}){this.fileBytes=A,this.chunkBytes=e,this.chunks=[],this.totalBytes=0;const s=new DecompressionStream("gzip"),n=new Blob([A]).stream().pipeThrough(s);this.reader=n.getReader()}async re Line truncated
`)+this.between+e.map(s=>this.indent+s).join(`
`)+this.after}}const Qs=new Map;function Pg(t){let A=Qs.get(t);return A||(A=new u.RawShaderMaterial({glslVersion:u.GLSL3,vertexShader:ei,fragmentShader:t.shader,uniforms:t.uniforms}),Qs.set(t,A),A)}function as(t,A,e="add"){const s=()=>{throw new Error(`Invalid ${e} types: ${t}, ${A}`)};if(t===A)return t;if(t==="int"){if(QA(A))return A;s()}if(A==="int"){if(QA(t))return t;s()}if(t==="uint"){if(pA(A))return A;s()}if(A==="uint"){if(pA(t))return t;s()}if(t==="float"){if(ot(A))return A;s()}if(A==="float"){if(ot(t))return t;s()}throw new Error(`Invalid ${e} types: ${t}, ${A}`)}function Zg(t,A){return as(t,A,"sub")}function Xg(t,A){const e=()=>{throw new Error(`Invalid mul types: ${t}, ${A}`)},s=n=>n;if(t==="int"){if(QA(A))return s(A);e()}if(A==="int"){if(QA(t))return s(t);e()}if(t==="uint"){if(pA(A))return s(A);e()}if(A==="uint"){if(pA(t))return s(t);e()}if(t==="float"){if(ot(A))return s(A);e()}if(A==="float"){if(ot(t))return s(t);e()}if(QA(t)||pA(t)||QA(A)||pA(A)){if(t===A)return s(t);e()}if(t==="vec2"){if(A==="vec2"||gt(A))return s("vec2");if(A==="mat3x2")return s("vec3");if(A==="mat4x2")return s("vec4");e()}if(t==="vec3"){if(A==="mat2x3")return s("vec2");if(A==="vec3"||lt(A))return s("vec3");if(A==="mat4x3")return s("vec4");e()}if(t==="vec4"){if(A==="mat2x4")return s("vec2");if(A==="mat3x4")return s("vec3");if(A==="vec4"||It(A))return s("vec4");e()}if(A==="vec2"){if(gt(t))return s("vec2");if(t==="mat2x3")return s("vec3");if(t==="mat2x4")return s("vec4");e()}if(A==="vec3"){if(t==="mat3x2")return s("vec2");if(lt(t))return s("vec3");if(t==="mat3x4")return s("vec4");e()}if(A==="vec4"){if(t==="mat4x2")return s("vec2");if(t==="mat4x3")return s("vec3");if(It(t))return s("vec4");e()}if(gt(t)){if(gt(A))return s("mat2");if(A==="mat3x2")return s("mat3x2");if(A==="mat4x2")return s("mat4x2");e()}if(t==="mat2x3"){if(gt(A))return s("mat2x3");if(A==="mat3x2")return s("mat3");if(A==="mat4x2")return s("mat4x3");e()}if(t==="mat2x4"){if(gt(A))return s("mat2x4");if(A==="mat3x2")return s("mat3x4");if(A==="mat4x2")return s("mat4");e()}if(t==="mat3x2"){if(A==="mat2x3")return s("mat2");if(lt(A))return s("mat3x2");if(A==="mat4x3")return s("mat4x2");e()}if(lt(t)){if(A==="mat2x3")return s("mat2x3");if(lt(A))return s("mat3");if(A==="mat4x3")return s("mat4x3");e()}if(t==="mat3x4"){if(A==="mat2x3")return s("mat2x4");if(lt(A))return s("mat3x4");if(A==="mat4x3")return s("mat4");e()}if(t==="mat4x2"){if(A==="mat2x4")return s("mat2");if(A==="mat3x4")return s("mat3x2");if(It(A))return s("mat4x2");e()}if(t==="mat4x3"){if(A==="mat2x4")return s("mat2x3");if(A==="mat3x4")return s("mat3");if(It(A))return s("mat4x3");e()}if(It(t)){if(A==="mat2x4")return s("mat2x4");if(A==="mat3x4")return s("mat3x4");if(It(A))return s("mat4");e()}throw new Error(`Invalid mul types: ${t}, ${A}`)}function Og(t,A){return as(t,A,"div")}function jg(t,A){if(t===A)return t;if(t==="int"){if(QA(A))return A}else if(A==="int"){if(QA(t))return t}else if(t==="uint"){if(pA(A))return A}else if(A==="uint"&&pA(t))return t;throw new Error(`Invalid imod types: ${t}, ${A}`)}function Wg(t,A){if(t===A||A==="float")return t;throw new Error(`Invalid mod types: ${t}, ${A}`)}function Al(t){return t}function tl(t){return t}function el(t){return t}function sl(t){return t}function nl(t){return t}function il(t){return t}function rl(t){return t}function al(t){return t}function ol(t){return t}function cl(t){return t}function gl(t){return t}function ll(t){return t}function Il(t){return t}function ul(t){return t}function hl(t){return t}function Cl(t){return t}function gi(t,A,e="min"){if(t===A)return t;if(A==="float"){if(ee(t))return t}else if(A==="int"){if(QA(t))return t}else if(A==="uint"&&pA(t))return t;throw new Error(`Invalid ${e} types: ${t}, ${A}`)}function Bl(t,A){return gi(t,A,"max")}function El(t,A,e){if(A==="float"){if(ee(t))return t}else if(A==="int"){if(QA(t))return t}else if(A==="uint"&&pA(t))return t;throw new Error(`Invalid clamp types: ${t}, ${A}`)}function Ql(t,A,e){if(e===t||e==="float"||e==="bool"&&t==="float"||e==="bvec2"&&t==="vec2"||e==="bvec3"&&t==="vec3"||e==="bvec4"&&t==="vec4")return t;throw new Error(`Invalid mix types: ${t}, ${A}, ${e}`)}function pl(t,A){if(t===A||A==="float")return A;throw new Error(`Invalid step types: ${t}, ${A}`)}function fl(t,A,e){if(t===A&&(t===e||t==="float"))return e;throw new Error(`Invalid smoothstep types: ${t}, ${A}, ${e}`)}function li(t,A="isNan"){if(t==="float")return"bool";if(t==="vec2")return"bvec2";if(t==="vec3")return"bvec3";if(t==="vec4")return"bvec4";throw new Error(`Invalid ${A} types: ${t}`)}function dl(t){return li(t,"isInf")}const EA=(t,A)=>new Ci({a:t,b:A}),ft=(t,A)=>new Bi({a:t,b:A}),rA=(t,A)=>new Ei({a:t,b:A}),le=(t,A)=>new Qi({a:t,b:A}),Ke=(t,A)=>new pi({a:t,b:A}),Ii=(t,A)=>new fi({a:t,b:A}),yl=t=>new di({a:t}).outputs,os=t=>new yi({a:t}),wl=t=>new wi({a:t}),ml=t=>new mi({a:t}),xl=t=>new xi({a:t}),Sl=t=>new Si({a:t}),Dl=t=>new Di({a:t}),Ml=t=>new Mi({a:t}),Ie=t=>new vi({a:t}),vl=(t,A)=>new bi({a:t,b:A}),bl=t=>new Fi({a:t}),Fl=t=>ne Line truncated
`)+this.after}}const Qs=new Map;function Pg(t){let A=Qs.get(t);return A||(A=new u.RawShaderMaterial({glslVersion:u.GLSL3,vertexShader:ti,fragmentShader:t.shader,uniforms:t.uniforms}),Qs.set(t,A),A)}function as(t,A,e="add"){const s=()=>{throw new Error(`Invalid ${e} types: ${t}, ${A}`)};if(t===A)return t;if(t==="int"){if(QA(A))return A;s()}if(A==="int"){if(QA(t))return t;s()}if(t==="uint"){if(pA(A))return A;s()}if(A==="uint"){if(pA(t))return t;s()}if(t==="float"){if(ot(A))return A;s()}if(A==="float"){if(ot(t))return t;s()}throw new Error(`Invalid ${e} types: ${t}, ${A}`)}function Zg(t,A){return as(t,A,"sub")}function Xg(t,A){const e=()=>{throw new Error(`Invalid mul types: ${t}, ${A}`)},s=n=>n;if(t==="int"){if(QA(A))return s(A);e()}if(A==="int"){if(QA(t))return s(t);e()}if(t==="uint"){if(pA(A))return s(A);e()}if(A==="uint"){if(pA(t))return s(t);e()}if(t==="float"){if(ot(A))return s(A);e()}if(A==="float"){if(ot(t))return s(t);e()}if(QA(t)||pA(t)||QA(A)||pA(A)){if(t===A)return s(t);e()}if(t==="vec2"){if(A==="vec2"||gt(A))return s("vec2");if(A==="mat3x2")return s("vec3");if(A==="mat4x2")return s("vec4");e()}if(t==="vec3"){if(A==="mat2x3")return s("vec2");if(A==="vec3"||lt(A))return s("vec3");if(A==="mat4x3")return s("vec4");e()}if(t==="vec4"){if(A==="mat2x4")return s("vec2");if(A==="mat3x4")return s("vec3");if(A==="vec4"||It(A))return s("vec4");e()}if(A==="vec2"){if(gt(t))return s("vec2");if(t==="mat2x3")return s("vec3");if(t==="mat2x4")return s("vec4");e()}if(A==="vec3"){if(t==="mat3x2")return s("vec2");if(lt(t))return s("vec3");if(t==="mat3x4")return s("vec4");e()}if(A==="vec4"){if(t==="mat4x2")return s("vec2");if(t==="mat4x3")return s("vec3");if(It(t))return s("vec4");e()}if(gt(t)){if(gt(A))return s("mat2");if(A==="mat3x2")return s("mat3x2");if(A==="mat4x2")return s("mat4x2");e()}if(t==="mat2x3"){if(gt(A))return s("mat2x3");if(A==="mat3x2")return s("mat3");if(A==="mat4x2")return s("mat4x3");e()}if(t==="mat2x4"){if(gt(A))return s("mat2x4");if(A==="mat3x2")return s("mat3x4");if(A==="mat4x2")return s("mat4");e()}if(t==="mat3x2"){if(A==="mat2x3")return s("mat2");if(lt(A))return s("mat3x2");if(A==="mat4x3")return s("mat4x2");e()}if(lt(t)){if(A==="mat2x3")return s("mat2x3");if(lt(A))return s("mat3");if(A==="mat4x3")return s("mat4x3");e()}if(t==="mat3x4"){if(A==="mat2x3")return s("mat2x4");if(lt(A))return s("mat3x4");if(A==="mat4x3")return s("mat4");e()}if(t==="mat4x2"){if(A==="mat2x4")return s("mat2");if(A==="mat3x4")return s("mat3x2");if(It(A))return s("mat4x2");e()}if(t==="mat4x3"){if(A==="mat2x4")return s("mat2x3");if(A==="mat3x4")return s("mat3");if(It(A))return s("mat4x3");e()}if(It(t)){if(A==="mat2x4")return s("mat2x4");if(A==="mat3x4")return s("mat3x4");if(It(A))return s("mat4");e()}throw new Error(`Invalid mul types: ${t}, ${A}`)}function Og(t,A){return as(t,A,"div")}function jg(t,A){if(t===A)return t;if(t==="int"){if(QA(A))return A}else if(A==="int"){if(QA(t))return t}else if(t==="uint"){if(pA(A))return A}else if(A==="uint"&&pA(t))return t;throw new Error(`Invalid imod types: ${t}, ${A}`)}function Wg(t,A){if(t===A||A==="float")return t;throw new Error(`Invalid mod types: ${t}, ${A}`)}function Al(t){return t}function tl(t){return t}function el(t){return t}function sl(t){return t}function nl(t){return t}function il(t){return t}function rl(t){return t}function al(t){return t}function ol(t){return t}function cl(t){return t}function gl(t){return t}function ll(t){return t}function Il(t){return t}function ul(t){return t}function hl(t){return t}function Cl(t){return t}function ci(t,A,e="min"){if(t===A)return t;if(A==="float"){if(ee(t))return t}else if(A==="int"){if(QA(t))return t}else if(A==="uint"&&pA(t))return t;throw new Error(`Invalid ${e} types: ${t}, ${A}`)}function Bl(t,A){return ci(t,A,"max")}function El(t,A,e){if(A==="float"){if(ee(t))return t}else if(A==="int"){if(QA(t))return t}else if(A==="uint"&&pA(t))return t;throw new Error(`Invalid clamp types: ${t}, ${A}`)}function Ql(t,A,e){if(e===t||e==="float"||e==="bool"&&t==="float"||e==="bvec2"&&t==="vec2"||e==="bvec3"&&t==="vec3"||e==="bvec4"&&t==="vec4")return t;throw new Error(`Invalid mix types: ${t}, ${A}, ${e}`)}function pl(t,A){if(t===A||A==="float")return A;throw new Error(`Invalid step types: ${t}, ${A}`)}function fl(t,A,e){if(t===A&&(t===e||t==="float"))return e;throw new Error(`Invalid smoothstep types: ${t}, ${A}, ${e}`)}function gi(t,A="isNan"){if(t==="float")return"bool";if(t==="vec2")return"bvec2";if(t==="vec3")return"bvec3";if(t==="vec4")return"bvec4";throw new Error(`Invalid ${A} types: ${t}`)}function dl(t){return gi(t,"isInf")}const EA=(t,A)=>new hi({a:t,b:A}),ft=(t,A)=>new Ci({a:t,b:A}),rA=(t,A)=>new Bi({a:t,b:A}),le=(t,A)=>new Ei({a:t,b:A}),Ke=(t,A)=>new Qi({a:t,b:A}),li=(t,A)=>new pi({a:t,b:A}),yl=t=>new fi({a:t}).outputs,os=t=>new di({a:t}),wl=t=>new yi({a:t}),ml=t=>new wi({a:t}),xl=t=>new mi({a:t}),Sl=t=>new xi({a:t}),Dl=t=>new Si({a:t}),Ml=t=>new Di({a:t}),Ie=t=>new Mi({a:t}),vl=(t,A)=>new vi({a:t,b:A}),bl=t=>new bi({a:t}),Fl=t=>ne Line truncated
uint pcg_next(uint state) {
return state * 747796405u + 2891336453u;
}
@@ -84,7 +84,7 @@
uint hash = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
return (hash >> 22u) ^ hash;
}
`)],statements:({inputs:e,outputs:s})=>[`${s.hash} = pcg_hash(${e.state});`]})}dynoOut(){return new K(this,"hash")}}class Rt extends V{constructor({value:A}){const e=$(A),s=qs(e);super({inTypes:{value:e},outTypes:{state:"uint"},inputs:{value:A},globals:()=>[CA(`
`)],statements:({inputs:e,outputs:s})=>[`${s.hash} = pcg_hash(${e.state});`]})}dynoOut(){return new K(this,"hash")}}class Rt extends V{constructor({value:A}){const e=$(A),s=Hs(e);super({inTypes:{value:e},outTypes:{state:"uint"},inputs:{value:A},globals:()=>[CA(`
uint pcg_mix(uint value) {
return value;
}
@@ -97,7 +97,7 @@
uint pcg_mix(uvec4 value) {
return value.x + 0x9e3779b9u * value.y + 0x85ebca6bu * value.z + 0xc2b2ae35u * value.w;
}
`)],statements:({inputs:n,outputs:i})=>{const r=pA(e)?`${n.value}`:QA(e)?`${s}(${n.value})`:`floatBitsToUint(${n.value})`;return[`${s} bits = ${r};`,`${i.state} = pcg_mix(bits);`]}})}dynoOut(){return new K(this,"state")}}class Qa extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"uint"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");let s=new Rt({value:e}).outputs.state;return s=new GA({state:s}).outputs.state,new RA({state:s}).outputs}})}dynoOut(){return new K(this,"hash")}}class pa extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"uvec2"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");let s=new Rt({value:e}).outputs.state;s=new GA({state:s}).outputs.state;const n=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const i=new RA({state:s}).outputs.hash;return{hash:VA({vectorType:"uvec2",x:n,y:i})}}})}dynoOut(){return new K(this,"hash")}}class fa extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"uvec3"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");let s=new Rt({value:e}).outputs.state;s=new GA({state:s}).outputs.state;const n=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const i=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const r=new RA({state:s}).outputs.hash;return{hash:VA({vectorType:"uvec3",x:n,y:i,z:r})}}})}dynoOut(){return new K(this,"hash")}}class da extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"uvec4"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");let s=new Rt({value:e}).outputs.state;s=new GA({state:s}).outputs.state;const n=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const i=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const r=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const a=new RA({state:s}).outputs.hash;return{hash:VA({vectorType:"uvec4",x:n,y:i,z:r,w:a})}}})}dynoOut(){return new K(this,"hash")}}class ya extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"float"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");const s=la(e);return{hash:rA(or(s),J("float",1/2**32))}}})}dynoOut(){return new K(this,"hash")}}class wa extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"vec2"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");const s=Ia(e);return{hash:rA(cr(s),J("float",1/2**32))}}})}dynoOut(){return new K(this,"hash")}}class ma extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"vec3"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");const s=ua(e);return{hash:rA(Qt(s),J("float",1/2**32))}}})}dynoOut(){return new K(this,"hash")}}class xa extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"vec4"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");const s=ha(e);return{hash:rA(gr(s),J("float",1/2**32))}}})}dynoOut(){return new K(this,"hash")}}class Sa extends V{constructor({z:A,zNear:e,zFar:s}){super({inTypes:{z:"float",zNear:"float",zFar:"float"},outTypes:{depth:"float"},inputs:{z:A,zNear:e,zFar:s},statements:({inputs:n,outputs:i})=>[`float clamped = clamp(${n.z}, ${n.zNear}, ${n.zFar});`,`${i.depth} = (log2(clamped + 1.0) - log2(${n.zNear} + 1.0)) / (log2(${n.zFar} + 1.0) - log2(${n.zNear} + 1.0));`]})}dynoOut(){return new K(this,"depth")}}const Da=(t,{scale:A,scales:e,rotate:s,translate:n})=>new va({position:t,scale:A,scales:e,rotate:s,translate:n}).outputs.position,Ma=(t,{scale:A,scales:e,rotate:s})=>new ba({dir:t,scale:A,scales:e,rotate:s}).outputs.dir,XI=(t,{rotate:A})=>new Fa({quaternion:t,rotate:A}).outputs.quaternion;class va extends V{constructor({position:A,scale:e,scales:s,rotate:n,translate:i}){super({inTypes:{position:"vec3",scale:"float",scales:"vec3",rotate:"vec4",translate:"vec3"},outTypes:{position:"vec3"},inputs:{position:A,scale:e,scales:s,rotate:n,translate:i},statements:({inputs:r,outputs:a})=>{const{position:o}=a;if(!o)return[];const{scale:g,scales:l,rotate:c,translate:I}=r;return[`${o} = ${r.position??"vec3(0.0, 0.0, 0.0)"};`,g?`${o} *= ${g};`:null,l?`${o} *= ${l};`:null,c?`${o} = quatVec(${c}, ${o});`:null,I?`${o} += ${I};`:null].filter(Boolean)}})}}class ba extends V{constructor({dir:A,scale:e,scales:s,rotate:n}){super({inTypes:{dir:"vec3",scale:"float",scales:"vec3",rotate:"vec4"},outTypes:{dir:"vec3"},inputs:{dir:A,scale:e,scales:s,rotate:n},statements:({inputs:i,outputs:r})=>{const{dir:a}=r;if(!a)return[];const{scale:o,scales:g,rotate:l}=i;return[`${a} = ${i.dir??"vec3(0.0, 0.0, 0.0)"};`,o?`${a} *= ${o};`:null,g?`${a} *= ${g};`:null,l?`${a} = quatVec(${l}, ${a});`:null].filter(Boolean)}})}}class Fa extends V{constructor({quaternion:A,rotate:e}){super({ Line truncated
`)],statements:({inputs:n,outputs:i})=>{const r=pA(e)?`${n.value}`:QA(e)?`${s}(${n.value})`:`floatBitsToUint(${n.value})`;return[`${s} bits = ${r};`,`${i.state} = pcg_mix(bits);`]}})}dynoOut(){return new K(this,"state")}}class Ea extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"uint"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");let s=new Rt({value:e}).outputs.state;return s=new GA({state:s}).outputs.state,new RA({state:s}).outputs}})}dynoOut(){return new K(this,"hash")}}class Qa extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"uvec2"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");let s=new Rt({value:e}).outputs.state;s=new GA({state:s}).outputs.state;const n=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const i=new RA({state:s}).outputs.hash;return{hash:VA({vectorType:"uvec2",x:n,y:i})}}})}dynoOut(){return new K(this,"hash")}}class pa extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"uvec3"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");let s=new Rt({value:e}).outputs.state;s=new GA({state:s}).outputs.state;const n=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const i=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const r=new RA({state:s}).outputs.hash;return{hash:VA({vectorType:"uvec3",x:n,y:i,z:r})}}})}dynoOut(){return new K(this,"hash")}}class fa extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"uvec4"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");let s=new Rt({value:e}).outputs.state;s=new GA({state:s}).outputs.state;const n=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const i=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const r=new RA({state:s}).outputs.hash;s=new GA({state:s}).outputs.state;const a=new RA({state:s}).outputs.hash;return{hash:VA({vectorType:"uvec4",x:n,y:i,z:r,w:a})}}})}dynoOut(){return new K(this,"hash")}}class da extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"float"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");const s=ga(e);return{hash:rA(ar(s),J("float",1/2**32))}}})}dynoOut(){return new K(this,"hash")}}class ya extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"vec2"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");const s=la(e);return{hash:rA(or(s),J("float",1/2**32))}}})}dynoOut(){return new K(this,"hash")}}class wa extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"vec3"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");const s=Ia(e);return{hash:rA(Qt(s),J("float",1/2**32))}}})}dynoOut(){return new K(this,"hash")}}class ma extends PA{constructor({value:A}){super({inTypes:{value:$(A)},outTypes:{hash:"vec4"},inputs:{value:A},construct:({value:e})=>{if(!e)throw new Error("value is required");const s=ua(e);return{hash:rA(cr(s),J("float",1/2**32))}}})}dynoOut(){return new K(this,"hash")}}class xa extends V{constructor({z:A,zNear:e,zFar:s}){super({inTypes:{z:"float",zNear:"float",zFar:"float"},outTypes:{depth:"float"},inputs:{z:A,zNear:e,zFar:s},statements:({inputs:n,outputs:i})=>[`float clamped = clamp(${n.z}, ${n.zNear}, ${n.zFar});`,`${i.depth} = (log2(clamped + 1.0) - log2(${n.zNear} + 1.0)) / (log2(${n.zFar} + 1.0) - log2(${n.zNear} + 1.0));`]})}dynoOut(){return new K(this,"depth")}}const Sa=(t,{scale:A,scales:e,rotate:s,translate:n})=>new Ma({position:t,scale:A,scales:e,rotate:s,translate:n}).outputs.position,Da=(t,{scale:A,scales:e,rotate:s})=>new va({dir:t,scale:A,scales:e,rotate:s}).outputs.dir,XI=(t,{rotate:A})=>new ba({quaternion:t,rotate:A}).outputs.quaternion;class Ma extends V{constructor({position:A,scale:e,scales:s,rotate:n,translate:i}){super({inTypes:{position:"vec3",scale:"float",scales:"vec3",rotate:"vec4",translate:"vec3"},outTypes:{position:"vec3"},inputs:{position:A,scale:e,scales:s,rotate:n,translate:i},statements:({inputs:r,outputs:a})=>{const{position:o}=a;if(!o)return[];const{scale:g,scales:l,rotate:c,translate:I}=r;return[`${o} = ${r.position??"vec3(0.0, 0.0, 0.0)"};`,g?`${o} *= ${g};`:null,l?`${o} *= ${l};`:null,c?`${o} = quatVec(${c}, ${o});`:null,I?`${o} += ${I};`:null].filter(Boolean)}})}}class va extends V{constructor({dir:A,scale:e,scales:s,rotate:n}){super({inTypes:{dir:"vec3",scale:"float",scales:"vec3",rotate:"vec4"},outTypes:{dir:"vec3"},inputs:{dir:A,scale:e,scales:s,rotate:n},statements:({inputs:i,outputs:r})=>{const{dir:a}=r;if(!a)return[];const{scale:o,scales:g,rotate:l}=i;return[`${a} = ${i.dir??"vec3(0.0, 0.0, 0.0)"};`,o?`${a} *= ${o};`:null,g?`${a} *= ${g};`:null,l?`${a} = quatVec(${l}, ${a});`:null].filter(Boolean)}})}}class ba extends V{constructor({quaternion:A,rotate:e}){super({ Line truncated
precision highp int;
precision highp sampler2D;
precision highp usampler2D;
@@ -132,18 +132,18 @@ void main() {
} else {
target = vec4(0.0, 0.0, 0.0, 0.0);
}
}`;const UA=class UA{constructor({renderer:A}={}){this.renderer=A,this.capacity=0,this.count=0}dispose(){this.target&&(this.target.dispose(),this.target=void 0)}ensureBuffer(A,e){const n=Math.ceil(Math.max(1,A)/Z)*Z*4;if(e.byteLength>=n)return e;const i=new ArrayBuffer(n);if(e instanceof ArrayBuffer)return i;const r=e.constructor;return new r(i)}ensureCapacity(A){const{width:e,height:s,depth:n,maxSplats:i}=xA(A);(!this.target||i>this.capacity)&&(this.dispose(),this.capacity=i,this.target=new u.WebGLArrayRenderTarget(e,s,n,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:u.NearestFilter,minFilter:u.NearestFilter}),this.target.texture.format=u.RGBAFormat,this.target.texture.type=u.UnsignedByteType,this.target.texture.internalFormat="RGBA8",this.target.scissorTest=!0)}prepareProgramMaterial(A){let e=UA.readbackProgram.get(A);if(!e){const n=FA({index:"int"},{rgba8:"vec4"},({index:i})=>(A.inputs.index=i,{rgba8:new es({rgba8:A.outputs.rgba8})}));UA.programTemplate||(UA.programTemplate=new rs(yu)),e=new is({graph:n,inputs:{index:"index"},outputs:{rgba8:"target"},template:UA.programTemplate}),Object.assign(e.uniforms,{targetLayer:{value:0},targetBase:{value:0},targetCount:{value:0}}),UA.readbackProgram.set(A,e)}const s=e.prepareMaterial();return UA.fullScreenQuad.material=s,{program:e,material:s}}saveRenderState(A){return{xrEnabled:A.xr.enabled,autoClear:A.autoClear}}resetRenderState(A,e){A.setRenderTarget(null),A.xr.enabled=e.xrEnabled,A.autoClear=e.autoClear}process({count:A,material:e}){const s=this.renderer;if(!s)throw new Error("No renderer");if(!this.target)throw new Error("No target");const n=Z*$A;e.uniforms.targetBase.value=0,e.uniforms.targetCount.value=A;let i=0;for(;i<A;){const r=Math.floor(i/n),a=r*n,o=Math.min($A,Math.ceil((A-a)/Z));e.uniforms.targetLayer.value=r,this.target.scissor.set(0,0,Z,o),s.setRenderTarget(this.target,r),s.xr.enabled=!1,s.autoClear=!1,UA.fullScreenQuad.render(s),i+=Z*o}this.count=A}async read({readback:A}){const e=this.renderer;if(!e)throw new Error("No renderer");if(!this.target)throw new Error("No target");const s=Math.ceil(this.count/Z)*Z;if(A.byteLength<s*4)throw new Error(`Readback buffer too small: ${A.byteLength} < ${s*4}`);const n=new Uint8Array(A instanceof ArrayBuffer?A:A.buffer),i=Z*$A;let r=0;const a=[];for(;r<this.count;){const o=Math.floor(r/i),g=o*i,l=Math.min($A,Math.ceil((this.count-g)/Z));e.setRenderTarget(this.target,o);const c=Z*l*4,I=n.subarray(g*4,g*4+c),h=e==null?void 0:e.readRenderTargetPixelsAsync(this.target,0,0,Z,l,I);a.push(h),r+=Z*l}return Promise.all(a).then(()=>A)}render({reader:A,count:e,renderer:s}){if(this.renderer=s||this.renderer,!this.renderer)throw new Error("No renderer");this.ensureCapacity(e);const{program:n,material:i}=this.prepareProgramMaterial(A);n.update();const r=this.saveRenderState(this.renderer);this.process({count:e,material:i}),this.resetRenderState(this.renderer,r)}async readback({readback:A}){if(!this.renderer)throw new Error("No renderer");const e=this.saveRenderState(this.renderer),s=this.read({readback:A});return this.resetRenderState(this.renderer,e),s}async renderReadback({reader:A,count:e,renderer:s,readback:n}){if(this.renderer=s||this.renderer,!this.renderer)throw new Error("No renderer");this.ensureCapacity(e);const{program:i,material:r}=this.prepareProgramMaterial(A);i.update();const a=this.saveRenderState(this.renderer);this.process({count:e,material:r});const o=this.read({readback:n});return this.resetRenderState(this.renderer,a),o}getTexture(){var A;return(A=this.target)==null?void 0:A.texture}};UA.programTemplate=null,UA.readbackProgram=new Map,UA.fullScreenQuad=new Ss(new u.RawShaderMaterial({visible:!1}));let Xt=UA;const uA=class uA{constructor(A={}){this.capacity=0,this.count=0,this.array=null,this.readback=null,this.source=null,this.needsUpdate=!0,this.dyno=new N({key:"rgbaArray",type:ja,globals:()=>[Wa],value:{texture:uA.getEmpty(),count:0},update:e=>{var s;return e.texture=((s=this.readback)==null?void 0:s.getTexture())??this.source??uA.getEmpty(),e.count=this.count,e}}),A.array?(this.array=A.array,this.capacity=Math.floor(this.array.length/4),this.capacity=Math.floor(this.capacity/Z)*Z,this.count=Math.min(this.capacity,A.count??Number.POSITIVE_INFINITY)):(this.capacity=A.capacity??0,this.count=0)}dispose(){this.readback&&(this.readback.dispose(),this.readback=null),this.source&&(this.source.dispose(),this.source=null)}ensureCapacity(A){var e;if(!this.array||A>(((e=this.array)==null?void 0:e.length)??0)/4){this.capacity=xA(A).maxSplats;const s=new Uint8Array(this.capacity*4);this.array&&s.set(this.array),this.array=s}return this.array}getTexture(){var e;let A=(e=this.readback)==null?void 0:e.getTexture();return(this.source||this.array)&&(A=this.maybeUpdateSource()),A??uA.getEmpty()}maybeUpdateSource(){if(!this.array)throw new Error("No array");if(this.needsUpdate||!this.source){if(this.needsUpdate=!1,this.source){const{width:A,height:e,depth:s}=this.source.image;this.capacity!==A*e*s&&(this.s Line truncated
}`;const UA=class UA{constructor({renderer:A}={}){this.renderer=A,this.capacity=0,this.count=0}dispose(){this.target&&(this.target.dispose(),this.target=void 0)}ensureBuffer(A,e){const n=Math.ceil(Math.max(1,A)/Z)*Z*4;if(e.byteLength>=n)return e;const i=new ArrayBuffer(n);if(e instanceof ArrayBuffer)return i;const r=e.constructor;return new r(i)}ensureCapacity(A){const{width:e,height:s,depth:n,maxSplats:i}=xA(A);(!this.target||i>this.capacity)&&(this.dispose(),this.capacity=i,this.target=new u.WebGLArrayRenderTarget(e,s,n,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:u.NearestFilter,minFilter:u.NearestFilter}),this.target.texture.format=u.RGBAFormat,this.target.texture.type=u.UnsignedByteType,this.target.texture.internalFormat="RGBA8",this.target.scissorTest=!0)}prepareProgramMaterial(A){let e=UA.readbackProgram.get(A);if(!e){const n=FA({index:"int"},{rgba8:"vec4"},({index:i})=>(A.inputs.index=i,{rgba8:new es({rgba8:A.outputs.rgba8})}));UA.programTemplate||(UA.programTemplate=new rs(yu)),e=new is({graph:n,inputs:{index:"index"},outputs:{rgba8:"target"},template:UA.programTemplate}),Object.assign(e.uniforms,{targetLayer:{value:0},targetBase:{value:0},targetCount:{value:0}}),UA.readbackProgram.set(A,e)}const s=e.prepareMaterial();return UA.fullScreenQuad.material=s,{program:e,material:s}}saveRenderState(A){return{xrEnabled:A.xr.enabled,autoClear:A.autoClear}}resetRenderState(A,e){A.setRenderTarget(null),A.xr.enabled=e.xrEnabled,A.autoClear=e.autoClear}process({count:A,material:e}){const s=this.renderer;if(!s)throw new Error("No renderer");if(!this.target)throw new Error("No target");const n=Z*$A;e.uniforms.targetBase.value=0,e.uniforms.targetCount.value=A;let i=0;for(;i<A;){const r=Math.floor(i/n),a=r*n,o=Math.min($A,Math.ceil((A-a)/Z));e.uniforms.targetLayer.value=r,this.target.scissor.set(0,0,Z,o),s.setRenderTarget(this.target,r),s.xr.enabled=!1,s.autoClear=!1,UA.fullScreenQuad.render(s),i+=Z*o}this.count=A}async read({readback:A}){const e=this.renderer;if(!e)throw new Error("No renderer");if(!this.target)throw new Error("No target");const s=Math.ceil(this.count/Z)*Z;if(A.byteLength<s*4)throw new Error(`Readback buffer too small: ${A.byteLength} < ${s*4}`);const n=new Uint8Array(A instanceof ArrayBuffer?A:A.buffer),i=Z*$A;let r=0;const a=[];for(;r<this.count;){const o=Math.floor(r/i),g=o*i,l=Math.min($A,Math.ceil((this.count-g)/Z));e.setRenderTarget(this.target,o);const c=Z*l*4,I=n.subarray(g*4,g*4+c),h=e==null?void 0:e.readRenderTargetPixelsAsync(this.target,0,0,Z,l,I);a.push(h),r+=Z*l}return Promise.all(a).then(()=>A)}render({reader:A,count:e,renderer:s}){if(this.renderer=s||this.renderer,!this.renderer)throw new Error("No renderer");this.ensureCapacity(e);const{program:n,material:i}=this.prepareProgramMaterial(A);n.update();const r=this.saveRenderState(this.renderer);this.process({count:e,material:i}),this.resetRenderState(this.renderer,r)}async readback({readback:A}){if(!this.renderer)throw new Error("No renderer");const e=this.saveRenderState(this.renderer),s=this.read({readback:A});return this.resetRenderState(this.renderer,e),s}async renderReadback({reader:A,count:e,renderer:s,readback:n}){if(this.renderer=s||this.renderer,!this.renderer)throw new Error("No renderer");this.ensureCapacity(e);const{program:i,material:r}=this.prepareProgramMaterial(A);i.update();const a=this.saveRenderState(this.renderer);this.process({count:e,material:r});const o=this.read({readback:n});return this.resetRenderState(this.renderer,a),o}getTexture(){var A;return(A=this.target)==null?void 0:A.texture}};UA.programTemplate=null,UA.readbackProgram=new Map,UA.fullScreenQuad=new Ss(new u.RawShaderMaterial({visible:!1}));let Xt=UA;const uA=class uA{constructor(A={}){this.capacity=0,this.count=0,this.array=null,this.readback=null,this.source=null,this.needsUpdate=!0,this.dyno=new N({key:"rgbaArray",type:Oa,globals:()=>[ja],value:{texture:uA.getEmpty(),count:0},update:e=>{var s;return e.texture=((s=this.readback)==null?void 0:s.getTexture())??this.source??uA.getEmpty(),e.count=this.count,e}}),A.array?(this.array=A.array,this.capacity=Math.floor(this.array.length/4),this.capacity=Math.floor(this.capacity/Z)*Z,this.count=Math.min(this.capacity,A.count??Number.POSITIVE_INFINITY)):(this.capacity=A.capacity??0,this.count=0)}dispose(){this.readback&&(this.readback.dispose(),this.readback=null),this.source&&(this.source.dispose(),this.source=null)}ensureCapacity(A){var e;if(!this.array||A>(((e=this.array)==null?void 0:e.length)??0)/4){this.capacity=xA(A).maxSplats;const s=new Uint8Array(this.capacity*4);this.array&&s.set(this.array),this.array=s}return this.array}getTexture(){var e;let A=(e=this.readback)==null?void 0:e.getTexture();return(this.source||this.array)&&(A=this.maybeUpdateSource()),A??uA.getEmpty()}maybeUpdateSource(){if(!this.array)throw new Error("No array");if(this.needsUpdate||!this.source){if(this.needsUpdate=!1,this.source){const{width:A,height:e,depth:s}=this.source.image;this.capacity!==A*e*s&&(this.s Line truncated
struct RgbaArray {
sampler2DArray texture;
int count;
};
`);function wu(t,A){return new V({inTypes:{rgba:ja,index:"int"},outTypes:{rgba:"vec4"},inputs:{rgba:t,index:A},globals:()=>[Wa],statements:({inputs:s,outputs:n})=>YA(`
`);function wu(t,A){return new V({inTypes:{rgba:Oa,index:"int"},outTypes:{rgba:"vec4"},inputs:{rgba:t,index:A},globals:()=>[ja],statements:({inputs:s,outputs:n})=>YA(`
if ((index >= 0) && (index < ${s.rgba}.count)) {
${n.rgba} = texelFetch(${s.rgba}.texture, splatTexCoord(index), 0);
} else {
${n.rgba} = vec4(0.0, 0.0, 0.0, 0.0);
}
`)}).outputs.rgba}var Ao=(t=>(t.ALL="all",t.PLANE="plane",t.SPHERE="sphere",t.BOX="box",t.ELLIPSOID="ellipsoid",t.CYLINDER="cylinder",t.CAPSULE="capsule",t.INFINITE_CONE="infinite_cone",t))(Ao||{});function mu(t){switch(t){case"all":return 0;case"plane":return 1;case"sphere":return 2;case"box":return 3;case"ellipsoid":return 4;case"cylinder":return 5;case"capsule":return 6;case"infinite_cone":return 7;default:throw new Error(`Unknown SDF type: ${t}`)}}var to=(t=>(t.MULTIPLY="multiply",t.SET_RGB="set_rgb",t.ADD_RGBA="add_rgba",t))(to||{});function xu(t){switch(t){case"multiply":return 0;case"set_rgb":return 1;case"add_rgba":return 2;default:throw new Error(`Unknown blend mode: ${t}`)}}class eo extends u.Object3D{constructor(A={}){super();const{type:e,invert:s,opacity:n,color:i,displace:r,radius:a}=A;this.type=e??"sphere",this.invert=s??!1,this.opacity=n??1,this.color=i??new u.Color(1,1,1),this.displace=r??new u.Vector3(0,0,0),this.radius=a??0}}const we=class we extends u.Object3D{constructor(A={}){const{name:e,rgbaBlendMode:s="multiply",sdfSmooth:n=0,softEdge:i=0,invert:r=!1,sdfs:a=null}=A;super(),this.rgbaBlendMode=s,this.sdfSmooth=n,this.softEdge=i,this.invert=r,this.sdfs=a,this.ordering=we.nextOrdering++,this.name=e??`Edit ${this.ordering}`}addSdf(A){this.sdfs==null&&(this.sdfs=[]),this.sdfs.includes(A)||this.sdfs.push(A)}removeSdf(A){this.sdfs!=null&&(this.sdfs=this.sdfs.filter(e=>e!==A))}};we.nextOrdering=1;let Ot=we;class so{constructor({maxSdfs:A,maxEdits:e}){this.maxSdfs=Math.max(16,A??0),this.numSdfs=0,this.sdfData=new Uint32Array(this.maxSdfs*8*4),this.sdfFloatData=new Float32Array(this.sdfData.buffer),this.sdfTexture=this.newSdfTexture(this.sdfData,this.maxSdfs),this.dynoSdfArray=new N({key:"sdfArray",type:no,globals:()=>[io],value:{numSdfs:0,sdfTexture:this.sdfTexture},update:s=>(s.numSdfs=this.numSdfs,s.sdfTexture=this.sdfTexture,s)}),this.maxEdits=Math.max(16,e??0),this.numEdits=0,this.editData=new Uint32Array(this.maxEdits*4),this.editFloatData=new Float32Array(this.editData.buffer),this.dynoNumEdits=new Zt({value:0}),this.dynoEdits=this.newEdits(this.editData,this.maxEdits)}newSdfTexture(A,e){const s=new u.DataTexture(A,8,e,u.RGBAIntegerFormat,u.UnsignedIntType);return s.internalFormat="RGBA32UI",s.needsUpdate=!0,s}newEdits(A,e){return new N({key:"edits",type:"uvec4",count:e,globals:()=>[ro],value:A})}ensureCapacity({maxSdfs:A,maxEdits:e}){let s=!1;return A>this.sdfTexture.image.height&&(this.sdfTexture.dispose(),this.maxSdfs=Math.max(this.maxSdfs*2,A),this.sdfData=new Uint32Array(this.maxSdfs*8*4),this.sdfFloatData=new Float32Array(this.sdfData.buffer),this.sdfTexture=this.newSdfTexture(this.sdfData,this.maxSdfs)),e>(this.dynoEdits.count??0)&&(this.maxEdits=Math.max(this.maxEdits*2,e),this.editData=new Uint32Array(this.maxEdits*4),this.editFloatData=new Float32Array(this.editData.buffer),this.dynoEdits=this.newEdits(this.editData,this.maxEdits),s=!0),s}updateEditData(A,e){const s=this.editData[A]!==e;return this.editData[A]=e,s}updateEditFloatData(A,e){mt[0]=e;const s=this.editFloatData[A]!==mt[0];return s&&(this.editFloatData[A]=mt[0]),s}encodeEdit(A,{sdfFirst:e,sdfCount:s,invert:n,rgbaBlendMode:i,softEdge:r,sdfSmooth:a}){const o=A*4;let g=!1;return g=this.updateEditData(o+0,i|(n?256:0))||g,g=this.updateEditData(o+1,e|s<<16)||g,g=this.updateEditFloatData(o+2,r)||g,g=this.updateEditFloatData(o+3,a)||g,g}updateSdfData(A,e){const s=this.sdfData[A]!==e;return this.sdfData[A]=e,s}updateSdfFloatData(A,e){mt[0]=e;const s=this.sdfFloatData[A]!==mt[0];return s&&(this.sdfFloatData[A]=mt[0]),s}encodeSdf(A,{sdfType:e,invert:s,center:n,quaternion:i,scale:r,sizes:a},o){const g=A*32,l=e|(s?256:0);let c=!1;c=this.updateSdfFloatData(g+0,(n==null?void 0:n.x)??0)||c,c=this.updateSdfFloatData(g+1,(n==null?void 0:n.y)??0)||c,c=this.updateSdfFloatData(g+2,(n==null?void 0:n.z)??0)||c,c=this.updateSdfData(g+3,l)||c,c=this.updateSdfFloatData(g+4,(i==null?void 0:i.x)??0)||c,c=this.updateSdfFloatData(g+5,(i==null?void 0:i.y)??0)||c,c=this.updateSdfFloatData(g+6,(i==null?void 0:i.z)??0)||c,c=this.updateSdfFloatData(g+7,(i==null?void 0:i.w)??0)||c,c=this.updateSdfFloatData(g+8,(r==null?void 0:r.x)??0)||c,c=this.updateSdfFloatData(g+9,(r==null?void 0:r.y)??0)||c,c=this.updateSdfFloatData(g+10,(r==null?void 0:r.z)??0)||c,c=this.updateSdfData(g+11,0)||c,c=this.updateSdfFloatData(g+12,(a==null?void 0:a.x)??0)||c,c=this.updateSdfFloatData(g+13,(a==null?void 0:a.y)??0)||c,c=this.updateSdfFloatData(g+14,(a==null?void 0:a.z)??0)||c,c=this.updateSdfFloatData(g+15,(a==null?void 0:a.w)??0)||c;const I=Math.min(4,o.length);for(let h=0;h<I;++h){const E=g+16+h*4;c=this.updateSdfFloatData(E+0,o[h].x)||c,c=this.updateSdfFloatData(E+1,o[h].y)||c,c=this.updateSdfFloatData(E+2,o[h].z)||c,c=this.updateSdfFloatData(E+3,o[h].w)||c}return c}update(A){const e=A.reduce((c,{sdfs:I})=>c+I.length,0),s=this.ensureCapacity({maxEdits:A.length,maxSdfs:e}),n=[new u.Vector4,new u.Vector4],i=new u.Vector3,r=new u.Quaternion,a=new u.Vector3,o=new u Line truncated
`)}).outputs.rgba}var Wa=(t=>(t.ALL="all",t.PLANE="plane",t.SPHERE="sphere",t.BOX="box",t.ELLIPSOID="ellipsoid",t.CYLINDER="cylinder",t.CAPSULE="capsule",t.INFINITE_CONE="infinite_cone",t))(Wa||{});function mu(t){switch(t){case"all":return 0;case"plane":return 1;case"sphere":return 2;case"box":return 3;case"ellipsoid":return 4;case"cylinder":return 5;case"capsule":return 6;case"infinite_cone":return 7;default:throw new Error(`Unknown SDF type: ${t}`)}}var Ao=(t=>(t.MULTIPLY="multiply",t.SET_RGB="set_rgb",t.ADD_RGBA="add_rgba",t))(Ao||{});function xu(t){switch(t){case"multiply":return 0;case"set_rgb":return 1;case"add_rgba":return 2;default:throw new Error(`Unknown blend mode: ${t}`)}}class to extends u.Object3D{constructor(A={}){super();const{type:e,invert:s,opacity:n,color:i,displace:r,radius:a}=A;this.type=e??"sphere",this.invert=s??!1,this.opacity=n??1,this.color=i??new u.Color(1,1,1),this.displace=r??new u.Vector3(0,0,0),this.radius=a??0}}const we=class we extends u.Object3D{constructor(A={}){const{name:e,rgbaBlendMode:s="multiply",sdfSmooth:n=0,softEdge:i=0,invert:r=!1,sdfs:a=null}=A;super(),this.rgbaBlendMode=s,this.sdfSmooth=n,this.softEdge=i,this.invert=r,this.sdfs=a,this.ordering=we.nextOrdering++,this.name=e??`Edit ${this.ordering}`}addSdf(A){this.sdfs==null&&(this.sdfs=[]),this.sdfs.includes(A)||this.sdfs.push(A)}removeSdf(A){this.sdfs!=null&&(this.sdfs=this.sdfs.filter(e=>e!==A))}};we.nextOrdering=1;let Ot=we;class eo{constructor({maxSdfs:A,maxEdits:e}){this.maxSdfs=Math.max(16,A??0),this.numSdfs=0,this.sdfData=new Uint32Array(this.maxSdfs*8*4),this.sdfFloatData=new Float32Array(this.sdfData.buffer),this.sdfTexture=this.newSdfTexture(this.sdfData,this.maxSdfs),this.dynoSdfArray=new N({key:"sdfArray",type:so,globals:()=>[no],value:{numSdfs:0,sdfTexture:this.sdfTexture},update:s=>(s.numSdfs=this.numSdfs,s.sdfTexture=this.sdfTexture,s)}),this.maxEdits=Math.max(16,e??0),this.numEdits=0,this.editData=new Uint32Array(this.maxEdits*4),this.editFloatData=new Float32Array(this.editData.buffer),this.dynoNumEdits=new Zt({value:0}),this.dynoEdits=this.newEdits(this.editData,this.maxEdits)}newSdfTexture(A,e){const s=new u.DataTexture(A,8,e,u.RGBAIntegerFormat,u.UnsignedIntType);return s.internalFormat="RGBA32UI",s.needsUpdate=!0,s}newEdits(A,e){return new N({key:"edits",type:"uvec4",count:e,globals:()=>[io],value:A})}ensureCapacity({maxSdfs:A,maxEdits:e}){let s=!1;return A>this.sdfTexture.image.height&&(this.sdfTexture.dispose(),this.maxSdfs=Math.max(this.maxSdfs*2,A),this.sdfData=new Uint32Array(this.maxSdfs*8*4),this.sdfFloatData=new Float32Array(this.sdfData.buffer),this.sdfTexture=this.newSdfTexture(this.sdfData,this.maxSdfs)),e>(this.dynoEdits.count??0)&&(this.maxEdits=Math.max(this.maxEdits*2,e),this.editData=new Uint32Array(this.maxEdits*4),this.editFloatData=new Float32Array(this.editData.buffer),this.dynoEdits=this.newEdits(this.editData,this.maxEdits),s=!0),s}updateEditData(A,e){const s=this.editData[A]!==e;return this.editData[A]=e,s}updateEditFloatData(A,e){mt[0]=e;const s=this.editFloatData[A]!==mt[0];return s&&(this.editFloatData[A]=mt[0]),s}encodeEdit(A,{sdfFirst:e,sdfCount:s,invert:n,rgbaBlendMode:i,softEdge:r,sdfSmooth:a}){const o=A*4;let g=!1;return g=this.updateEditData(o+0,i|(n?256:0))||g,g=this.updateEditData(o+1,e|s<<16)||g,g=this.updateEditFloatData(o+2,r)||g,g=this.updateEditFloatData(o+3,a)||g,g}updateSdfData(A,e){const s=this.sdfData[A]!==e;return this.sdfData[A]=e,s}updateSdfFloatData(A,e){mt[0]=e;const s=this.sdfFloatData[A]!==mt[0];return s&&(this.sdfFloatData[A]=mt[0]),s}encodeSdf(A,{sdfType:e,invert:s,center:n,quaternion:i,scale:r,sizes:a},o){const g=A*32,l=e|(s?256:0);let c=!1;c=this.updateSdfFloatData(g+0,(n==null?void 0:n.x)??0)||c,c=this.updateSdfFloatData(g+1,(n==null?void 0:n.y)??0)||c,c=this.updateSdfFloatData(g+2,(n==null?void 0:n.z)??0)||c,c=this.updateSdfData(g+3,l)||c,c=this.updateSdfFloatData(g+4,(i==null?void 0:i.x)??0)||c,c=this.updateSdfFloatData(g+5,(i==null?void 0:i.y)??0)||c,c=this.updateSdfFloatData(g+6,(i==null?void 0:i.z)??0)||c,c=this.updateSdfFloatData(g+7,(i==null?void 0:i.w)??0)||c,c=this.updateSdfFloatData(g+8,(r==null?void 0:r.x)??0)||c,c=this.updateSdfFloatData(g+9,(r==null?void 0:r.y)??0)||c,c=this.updateSdfFloatData(g+10,(r==null?void 0:r.z)??0)||c,c=this.updateSdfData(g+11,0)||c,c=this.updateSdfFloatData(g+12,(a==null?void 0:a.x)??0)||c,c=this.updateSdfFloatData(g+13,(a==null?void 0:a.y)??0)||c,c=this.updateSdfFloatData(g+14,(a==null?void 0:a.z)??0)||c,c=this.updateSdfFloatData(g+15,(a==null?void 0:a.w)??0)||c;const I=Math.min(4,o.length);for(let h=0;h<I;++h){const E=g+16+h*4;c=this.updateSdfFloatData(E+0,o[h].x)||c,c=this.updateSdfFloatData(E+1,o[h].y)||c,c=this.updateSdfFloatData(E+2,o[h].z)||c,c=this.updateSdfFloatData(E+3,o[h].w)||c}return c}update(A){const e=A.reduce((c,{sdfs:I})=>c+I.length,0),s=this.ensureCapacity({maxEdits:A.length,maxSdfs:e}),n=[new u.Vector4,new u.Vector4],i=new u.Vector3,r=new u.Quaternion,a=new u.Vector3,o=new u Line truncated
struct SdfArray {
int numSdfs;
usampler2D sdfTexture;
@@ -308,7 +308,7 @@ void main() {
return (softEdge == 0.0) ? ((distance < 0.0) ? 1.0 : 0.0)
: clamp(-distance / softEdge + 0.5, 0.0, 1.0);
}
`),ro=CA(`
`),io=CA(`
const uint EDIT_FLAG_BLEND = 0xFFu;
const uint EDIT_BLEND_MULTIPLY = 0u;
const uint EDIT_BLEND_SET_RGB = 1u;
@@ -366,7 +366,7 @@ void main() {
decodeEdit(packedEdit, sdfFirst, sdfCount, invert, rgbaBlendMode, softEdge, sdfSmooth);
applyRgbaDisplaceEdit(sdfTexture, numSdfs, sdfFirst, sdfCount, pos, sdfSmooth, softEdge, invert, rgbaBlendMode, rgba);
}
`);function Su(t,A,e,s){return new V({inTypes:{gsplat:AA,sdfArray:no,numEdits:"int",rgbaDisplaceEdits:"uvec4"},outTypes:{gsplat:AA},globals:()=>[io,ro],inputs:{gsplat:t,sdfArray:A,numEdits:e,rgbaDisplaceEdits:s},statements:({inputs:i,outputs:r})=>{const{sdfArray:a,numEdits:o,rgbaDisplaceEdits:g}=i,{gsplat:l}=r;return YA(`
`);function Su(t,A,e,s){return new V({inTypes:{gsplat:AA,sdfArray:so,numEdits:"int",rgbaDisplaceEdits:"uvec4"},outTypes:{gsplat:AA},globals:()=>[no,io],inputs:{gsplat:t,sdfArray:A,numEdits:e,rgbaDisplaceEdits:s},statements:({inputs:i,outputs:r})=>{const{sdfArray:a,numEdits:o,rgbaDisplaceEdits:g}=i,{gsplat:l}=r;return YA(`
${l} = ${i.gsplat};
if (isGsplatActive(${l}.flags)) {
for (int editIndex = 0; editIndex < ${o}; ++editIndex) {
@@ -376,7 +376,7 @@ void main() {
);
}
}
`)}}).outputs.gsplat}const mt=new Float32Array(1);class ao{constructor(A){this.modifier=A,this.cache=new Map}apply(A){let e=this.cache.get(A);return e||(e=FA({index:"int"},{gsplat:AA},({index:s})=>{const{gsplat:n}=A.apply({index:s});return this.modifier.apply({gsplat:n})}),this.cache.set(A,e)),e}}class ht{constructor(){this.scale=new Et({value:Number.NEGATIVE_INFINITY}),this.rotate=new Gt({value:new u.Quaternion(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}),this.translate=new Nt({value:new u.Vector3(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)})}apply(A){return Da(A,{scale:this.scale,rotate:this.rotate,translate:this.translate})}applyDir(A){return Ma(A,{rotate:this.rotate})}applyGsplat(A){return ts(A,{scale:this.scale,rotate:this.rotate,translate:this.translate})}updateFromMatrix(A){const e=new u.Vector3,s=new u.Quaternion,n=new u.Vector3;A.decompose(n,s,e);const i=(e.x+e.y+e.z)/3;let r=!1;return i!==this.scale.value&&(this.scale.value=i,r=!0),n.equals(this.translate.value)||(this.translate.value.copy(n),r=!0),s.equals(this.rotate.value)||(this.rotate.value.copy(s),r=!0),r}update(A){return A.updateMatrixWorld(),this.updateFromMatrix(A.matrixWorld)}}class kt extends u.Object3D{constructor({numSplats:A,generator:e,construct:s,update:n}){if(super(),this.numSplats=A??0,this.generator=e,this.frameUpdate=n,this.version=0,s){const i=s(this);Object.assign(this,i)}}updateVersion(){this.version+=1}set needsUpdate(A){A&&this.updateVersion()}}const st=class st extends kt{constructor(A={}){const e=new ht,s=new ht,n=new ht,i=new ht,r=new Gt({value:new u.Vector4(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY)}),a=new Et({value:0}),o=new Et({value:0}),g={transform:e,viewToWorld:s,worldToView:n,viewToObject:i,recolor:r,time:a,deltaTime:o};if(super({update:({time:l,deltaTime:c,viewToWorld:I,globalEdits:h})=>this.update({time:l,deltaTime:c,viewToWorld:I,globalEdits:h})}),this.isInitialized=!1,this.recolor=new u.Color(1,1,1),this.opacity=1,this.enableViewToObject=!1,this.enableViewToWorld=!1,this.enableWorldToView=!1,this.skinning=null,this.edits=null,this.rgbaDisplaceEdits=null,this.splatRgba=null,this.maxSh=3,this.packedSplats=A.packedSplats??new HA,this.packedSplats.splatEncoding=A.splatEncoding??{...De},this.numSplats=this.packedSplats.numSplats,this.editable=A.editable??!0,this.onFrame=A.onFrame,this.context=g,this.objectModifier=A.objectModifier,this.worldModifier=A.worldModifier,this.updateGenerator(),A.url||A.fileBytes||A.constructSplats||A.packedSplats&&!A.packedSplats.isInitialized)this.initialized=this.asyncInitialize(A).then(async()=>{if(this.updateGenerator(),this.isInitialized=!0,A.onLoad){const l=A.onLoad(this);l instanceof Promise&&await l}return this});else if(this.isInitialized=!0,this.initialized=Promise.resolve(this),A.onLoad){const l=A.onLoad(this);l instanceof Promise&&(this.initialized=l.then(()=>this))}this.add(Uu())}async asyncInitialize(A){const{url:e,fileBytes:s,fileType:n,fileName:i,maxSplats:r,constructSplats:a,splatEncoding:o}=A;if(e||s||a){const g={url:e,fileBytes:s,fileType:n,fileName:i,maxSplats:r,construct:a,splatEncoding:o};this.packedSplats.reinitialize(g)}this.packedSplats&&(await this.packedSplats.initialized,this.numSplats=this.packedSplats.numSplats,this.updateGenerator())}static async staticInitialize(){await Rs(),st.isStaticInitialized=!0}pushSplat(A,e,s,n,i){this.packedSplats.pushSplat(A,e,s,n,i)}forEachSplat(A){this.packedSplats.forEachSplat(A)}dispose(){this.packedSplats.dispose()}getBoundingBox(A=!0){if(!this.initialized)throw new Error("Cannot get bounding box before SplatMesh is initialized");const e=new u.Vector3(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),s=new u.Vector3(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),n=new u.Vector3,i=[-1,1];return this.packedSplats.forEachSplat((a,o,g,l,c,I)=>{if(A)e.min(o),s.max(o);else for(const h of i)for(const E of i)for(const C of i)n.set(h*g.x,E*g.y,C*g.z),n.applyQuaternion(l),n.add(o),e.min(n),s.max(n)}),new u.Box3(e,s)}constructGenerator(A){const{transform:e,viewToObject:s,recolor:n}=A,i=FA({index:"int"},{gsplat:AA},({index:r})=>{if(!r)throw new Error("index is undefined");let a=Ft(this.packedSplats.dyno,r);if(this.maxSh>=1){const{sh1Texture:g,sh2Texture:l,sh3Texture:c}=this.ensureShTextures();if(g){let I=function(p,d){const{x:y,y:D}=pt(d).outputs,x=rA(EA(y,D),J("float",.5)),w=rA(ft(D,y),J("float",.5));return EA(x,rA(p,w))};const h=s.translate,{center:E}=Bt(a).outputs,C=Kr(ft(E,h)),B=bu(a,g,C);let Q=I(B,this.packedSplats.dynoSh1MinMax);if(this.maxSh>=2&&l){const p=Fu(a,l,C);Q=EA(Q,I(p,this.packedSplats.dynoSh2MinMax))}if(this.maxSh>=3&&c){const p=Nu(a,c,C);Q=EA(Q,I(p,this.packedSplats.dynoSh3MinMax))}let{rgba:f}=Bt(a).outputs;f=EA(f,$r(Q,J("float",0))),a=rt({gsplat:a,rgba:f})}}if(this.splatRgba){const g=wu(this.splatRgba.dyno,r);a Line truncated
`)}}).outputs.gsplat}const mt=new Float32Array(1);class ro{constructor(A){this.modifier=A,this.cache=new Map}apply(A){let e=this.cache.get(A);return e||(e=FA({index:"int"},{gsplat:AA},({index:s})=>{const{gsplat:n}=A.apply({index:s});return this.modifier.apply({gsplat:n})}),this.cache.set(A,e)),e}}class ht{constructor(){this.scale=new Et({value:Number.NEGATIVE_INFINITY}),this.rotate=new Gt({value:new u.Quaternion(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)}),this.translate=new Nt({value:new u.Vector3(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY)})}apply(A){return Sa(A,{scale:this.scale,rotate:this.rotate,translate:this.translate})}applyDir(A){return Da(A,{rotate:this.rotate})}applyGsplat(A){return ts(A,{scale:this.scale,rotate:this.rotate,translate:this.translate})}updateFromMatrix(A){const e=new u.Vector3,s=new u.Quaternion,n=new u.Vector3;A.decompose(n,s,e);const i=(e.x+e.y+e.z)/3;let r=!1;return i!==this.scale.value&&(this.scale.value=i,r=!0),n.equals(this.translate.value)||(this.translate.value.copy(n),r=!0),s.equals(this.rotate.value)||(this.rotate.value.copy(s),r=!0),r}update(A){return A.updateMatrixWorld(),this.updateFromMatrix(A.matrixWorld)}}class kt extends u.Object3D{constructor({numSplats:A,generator:e,construct:s,update:n}){if(super(),this.numSplats=A??0,this.generator=e,this.frameUpdate=n,this.version=0,s){const i=s(this);Object.assign(this,i)}}updateVersion(){this.version+=1}set needsUpdate(A){A&&this.updateVersion()}}const st=class st extends kt{constructor(A={}){const e=new ht,s=new ht,n=new ht,i=new ht,r=new Gt({value:new u.Vector4(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY)}),a=new Et({value:0}),o=new Et({value:0}),g={transform:e,viewToWorld:s,worldToView:n,viewToObject:i,recolor:r,time:a,deltaTime:o};if(super({update:({time:l,deltaTime:c,viewToWorld:I,globalEdits:h})=>this.update({time:l,deltaTime:c,viewToWorld:I,globalEdits:h})}),this.isInitialized=!1,this.recolor=new u.Color(1,1,1),this.opacity=1,this.enableViewToObject=!1,this.enableViewToWorld=!1,this.enableWorldToView=!1,this.skinning=null,this.edits=null,this.rgbaDisplaceEdits=null,this.splatRgba=null,this.maxSh=3,this.packedSplats=A.packedSplats??new HA,this.packedSplats.splatEncoding=A.splatEncoding??{...De},this.numSplats=this.packedSplats.numSplats,this.editable=A.editable??!0,this.onFrame=A.onFrame,this.context=g,this.objectModifier=A.objectModifier,this.worldModifier=A.worldModifier,this.updateGenerator(),A.url||A.fileBytes||A.constructSplats||A.packedSplats&&!A.packedSplats.isInitialized)this.initialized=this.asyncInitialize(A).then(async()=>{if(this.updateGenerator(),this.isInitialized=!0,A.onLoad){const l=A.onLoad(this);l instanceof Promise&&await l}return this});else if(this.isInitialized=!0,this.initialized=Promise.resolve(this),A.onLoad){const l=A.onLoad(this);l instanceof Promise&&(this.initialized=l.then(()=>this))}this.add(Uu())}async asyncInitialize(A){const{url:e,fileBytes:s,fileType:n,fileName:i,maxSplats:r,constructSplats:a,splatEncoding:o}=A;if(e||s||a){const g={url:e,fileBytes:s,fileType:n,fileName:i,maxSplats:r,construct:a,splatEncoding:o};this.packedSplats.reinitialize(g)}this.packedSplats&&(await this.packedSplats.initialized,this.numSplats=this.packedSplats.numSplats,this.updateGenerator())}static async staticInitialize(){await Gs(),st.isStaticInitialized=!0}pushSplat(A,e,s,n,i){this.packedSplats.pushSplat(A,e,s,n,i)}forEachSplat(A){this.packedSplats.forEachSplat(A)}dispose(){this.packedSplats.dispose()}getBoundingBox(A=!0){if(!this.initialized)throw new Error("Cannot get bounding box before SplatMesh is initialized");const e=new u.Vector3(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),s=new u.Vector3(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),n=new u.Vector3,i=[-1,1];return this.packedSplats.forEachSplat((a,o,g,l,c,I)=>{if(A)e.min(o),s.max(o);else for(const h of i)for(const E of i)for(const C of i)n.set(h*g.x,E*g.y,C*g.z),n.applyQuaternion(l),n.add(o),e.min(n),s.max(n)}),new u.Box3(e,s)}constructGenerator(A){const{transform:e,viewToObject:s,recolor:n}=A,i=FA({index:"int"},{gsplat:AA},({index:r})=>{if(!r)throw new Error("index is undefined");let a=Ft(this.packedSplats.dyno,r);if(this.maxSh>=1){const{sh1Texture:g,sh2Texture:l,sh3Texture:c}=this.ensureShTextures();if(g){let I=function(p,d){const{x:y,y:D}=pt(d).outputs,x=rA(EA(y,D),J("float",.5)),w=rA(ft(D,y),J("float",.5));return EA(x,rA(p,w))};const h=s.translate,{center:E}=Bt(a).outputs,C=qr(ft(E,h)),B=bu(a,g,C);let Q=I(B,this.packedSplats.dynoSh1MinMax);if(this.maxSh>=2&&l){const p=Fu(a,l,C);Q=EA(Q,I(p,this.packedSplats.dynoSh2MinMax))}if(this.maxSh>=3&&c){const p=Nu(a,c,C);Q=EA(Q,I(p,this.packedSplats.dynoSh3MinMax))}let{rgba:f}=Bt(a).outputs;f=EA(f,Kr(Q,J("float",0))),a=rt({gsplat:a,rgba:f})}}if(this.splatRgba){const g=wu(this.splatRgba.dyno,r);a Line truncated
vec3 evaluateSH1(Gsplat gsplat, usampler2DArray sh1, vec3 viewDir) {
// Extract sint7 values packed into 2 x uint32
uvec2 packed = texelFetch(sh1, splatTexCoord(gsplat.index), 0).rg;
@@ -526,7 +526,7 @@ void main() {
item['${n}'] = PARSE_FIELD['${i.type}'](data, offset, ${A});
offset += ${zA[i.type]};
`)}e.push("return offset;");const s=new Function("data","offset","item","PARSE_FIELD",e.join(`
`));return(n,i,r)=>s(n,i,r,St)}function qu(t,A){const e=[];for(const[s,n]of Object.entries(t)){const i=s.match(gs);if(i){const r=+i[1];e.push((a,o,g)=>(g.f_rest[r]=St[n.type](a,o,A),o+zA[n.type]))}else n.isList?e.push((r,a,o)=>{const g=o[s];g.length=St[n.countType](r,a,A);let l=a+zA[n.countType];for(let c=0;c<g.length;c++)g[c]=St[n.type](r,l,A),l+=zA[n.type];return l}):e.push((r,a,o)=>(o[s]=St[n.type](r,a,A),a+zA[n.type]))}return(s,n,i)=>{let r=n;for(let a=0;a<e.length;a++)r=e[a](s,r,i);return r}}function Ze(t){let A=0;for(;t[`f_rest_${A}`];)A+=1;const e=Gu[A];if(e==null)throw new Error(`Unsupported number of SH coefficients: ${A}`);return e}const oo='(function(){"use strict";let DA;const ge=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&ge.decode();let OA=null;function ns(){return(OA===null||OA.byteLength===0)&&(OA=new Uint8Array(DA.memory.buffer)),OA}function gs(s,A){return s=s>>>0,ge.decode(ns().subarray(s,s+A))}function rs(s,A,t){return DA.sort_splats(s,A,t)>>>0}function Is(s,A,t){return DA.sort32_splats(s,A,t)>>>0}async function os(s,A){if(typeof Response=="function"&&s instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(s,A)}catch(e){if(s.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n",e);else throw e}const t=await s.arrayBuffer();return await WebAssembly.instantiate(t,A)}else{const t=await WebAssembly.instantiate(s,A);return t instanceof WebAssembly.Instance?{instance:t,module:s}:t}}function as(){const s={};return s.wbg={},s.wbg.__wbg_buffer_609cc3eee51ed158=function(A){return A.buffer},s.wbg.__wbg_length_3b4f022188ae8db6=function(A){return A.length},s.wbg.__wbg_length_6ca527665d89694d=function(A){return A.length},s.wbg.__wbg_length_8cfd2c6409af88ad=function(A){return A.length},s.wbg.__wbg_new_9fee97a409b32b68=function(A){return new Uint16Array(A)},s.wbg.__wbg_new_e3b321dcfef89fc7=function(A){return new Uint32Array(A)},s.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354=function(A,t,e){return new Float32Array(A,t>>>0,e>>>0)},s.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212=function(A,t,e){return new Uint32Array(A,t>>>0,e>>>0)},s.wbg.__wbg_newwithlength_5a5efe313cfd59f1=function(A){return new Float32Array(A>>>0)},s.wbg.__wbg_set_10bad9bee0e9c58b=function(A,t,e){A.set(t,e>>>0)},s.wbg.__wbg_set_d23661d19148b229=function(A,t,e){A.set(t,e>>>0)},s.wbg.__wbg_set_f4f1f0daa30696fc=function(A,t,e){A.set(t,e>>>0)},s.wbg.__wbg_subarray_3aaeec89bb2544f0=function(A,t,e){return A.subarray(t>>>0,e>>>0)},s.wbg.__wbg_subarray_769e1e0f81bb259b=function(A,t,e){return A.subarray(t>>>0,e>>>0)},s.wbg.__wbindgen_init_externref_table=function(){const A=DA.__wbindgen_export_0,t=A.grow(4);A.set(0,void 0),A.set(t+0,void 0),A.set(t+1,null),A.set(t+2,!0),A.set(t+3,!1)},s.wbg.__wbindgen_memory=function(){return DA.memory},s.wbg.__wbindgen_throw=function(A,t){throw new Error(gs(A,t))},s}function Cs(s,A){return DA=s.exports,re.__wbindgen_wasm_module=A,OA=null,DA.__wbindgen_start(),DA}async function re(s){if(DA!==void 0)return DA;typeof s<"u"&&(Object.getPrototypeOf(s)===Object.prototype?{module_or_path:s}=s:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof s>"u"&&(s=new URL("data:application/wasm;base64,AGFzbQEAAAABzAEeYAJ/fwF/YAJ/fwBgA39/fwF/YAN/f38AYAF/AX9gAX8AYANvf38Bb2AFf39/f38Bf2AFf39/f38AYAFvAW9gA29vfwBgAW8Bf2AAAGAAAX9gBH9/f38AYAR/f39/AX9gA39vbwF/YAF/AW9gAAFvYAF9AX1gBn9/f39/fwBgDX19fX19fX19f29/fX0Bb2AGf39/f39/AX9gBX9/fX9/AGAEf31/fwBgBX9/fH9/AGAEf3x/fwBgBX9/fn9/AGAEf35/fwBgAn19AX0C8gQRA3diZx1fX3diZ19idWZmZXJfNjA5Y2MzZWVlNTFlZDE1OAAJA3diZxpfX3diZ19uZXdfOWZlZTk3YTQwOWIzMmI2OAAJA3diZxpfX3diZ19zZXRfZjRmMWYwZGFhMzA2OTZmYwAKA3diZx1fX3diZ19sZW5ndGhfOGNmZDJjNjQwOWFmODhhZAALA3diZzFfX3diZ19uZXd3aXRoYnl0ZW9mZnNldGFuZGxlbmd0aF9mMWRlYWQ0NGQxZmM3MjEyAAYDd2JnGl9fd2JnX25ld19lM2IzMjFkY2ZlZjg5ZmM3AAkDd2JnGl9fd2JnX3NldF9kMjM2NjFkMTkxNDhiMjI5AAoDd2JnHV9fd2JnX2xlbmd0aF82Y2E1Mjc2NjVkODk2OTRkAAsDd2JnMV9fd2JnX25ld3dpdGhieXRlb2Zmc2V0YW5kbGVuZ3RoX2U2YjdlNjlhY2Q0YzczNTQABgN3YmcaX193Ymdfc2V0XzEwYmFkOWJlZTBlOWM1OGIACgN3YmcdX193YmdfbGVuZ3RoXzNiNGYwMjIxODhhZThkYjYACwN3YmcfX193Ymdfc3ViYXJyYXlfNzY5ZTFlMGY4MWJiMjU5YgAGA3diZx9fX3diZ19zdWJhcnJheV8zYWFlZWM4OWJiMjU0NGYwAAYDd2JnJF9fd2JnX25ld3dpdGhsZW5ndGhfNWE1ZWZlMzEzY2ZkNTlmMQARA3diZxBfX3diaW5kZ2VuX3Rocm93AAEDd2JnEV9fd2JpbmRnZW5fbWVtb3J5ABIDd2JnH19fd2JpbmRnZW5faW5pdF9leHRlcm5yZWZfdGFibGUADANeXQQAAQcFAgMCEwEBAA0BAwEAAA0BAwgIAwEBBRQBAw4AAwEDAgwMAgABAQcDABUBFhcIGRsHBQ4CEBAFAx0FBA8CBAQEAA0AAAEBAQAAAAMBAgMBAAEAAAEAAAEEBAQJAnABLi5vAIABBQMBABEGCQF/AUGAgMAACwdiBgZtZW1vcnkCAAtzb3J0X3NwbGF0cwBJDXNvcnQzMl9zcGxhdHMASg5yYXljYXN0X3NwbGF0cwA+E19fd2JpbmRnZW5fZXhwb3J0XzABARBf Line truncated
`));return(n,i,r)=>s(n,i,r,St)}function qu(t,A){const e=[];for(const[s,n]of Object.entries(t)){const i=s.match(gs);if(i){const r=+i[1];e.push((a,o,g)=>(g.f_rest[r]=St[n.type](a,o,A),o+zA[n.type]))}else n.isList?e.push((r,a,o)=>{const g=o[s];g.length=St[n.countType](r,a,A);let l=a+zA[n.countType];for(let c=0;c<g.length;c++)g[c]=St[n.type](r,l,A),l+=zA[n.type];return l}):e.push((r,a,o)=>(o[s]=St[n.type](r,a,A),a+zA[n.type]))}return(s,n,i)=>{let r=n;for(let a=0;a<e.length;a++)r=e[a](s,r,i);return r}}function Ze(t){let A=0;for(;t[`f_rest_${A}`];)A+=1;const e=Gu[A];if(e==null)throw new Error(`Unsupported number of SH coefficients: ${A}`);return e}const ao='(function(){"use strict";let DA;const re=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&re.decode();let jA=null;function is(){return(jA===null||jA.byteLength===0)&&(jA=new Uint8Array(DA.memory.buffer)),jA}function ns(s,A){return s=s>>>0,re.decode(is().subarray(s,s+A))}function rs(s,A,t){return DA.sort_splats(s,A,t)>>>0}function gs(s,A,t){return DA.sort32_splats(s,A,t)>>>0}async function Is(s,A){if(typeof Response=="function"&&s instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(s,A)}catch(e){if(s.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n",e);else throw e}const t=await s.arrayBuffer();return await WebAssembly.instantiate(t,A)}else{const t=await WebAssembly.instantiate(s,A);return t instanceof WebAssembly.Instance?{instance:t,module:s}:t}}function as(){const s={};return s.wbg={},s.wbg.__wbg_buffer_609cc3eee51ed158=function(A){return A.buffer},s.wbg.__wbg_length_3b4f022188ae8db6=function(A){return A.length},s.wbg.__wbg_length_6ca527665d89694d=function(A){return A.length},s.wbg.__wbg_length_8cfd2c6409af88ad=function(A){return A.length},s.wbg.__wbg_new_9fee97a409b32b68=function(A){return new Uint16Array(A)},s.wbg.__wbg_new_e3b321dcfef89fc7=function(A){return new Uint32Array(A)},s.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354=function(A,t,e){return new Float32Array(A,t>>>0,e>>>0)},s.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212=function(A,t,e){return new Uint32Array(A,t>>>0,e>>>0)},s.wbg.__wbg_newwithlength_5a5efe313cfd59f1=function(A){return new Float32Array(A>>>0)},s.wbg.__wbg_set_10bad9bee0e9c58b=function(A,t,e){A.set(t,e>>>0)},s.wbg.__wbg_set_d23661d19148b229=function(A,t,e){A.set(t,e>>>0)},s.wbg.__wbg_set_f4f1f0daa30696fc=function(A,t,e){A.set(t,e>>>0)},s.wbg.__wbg_subarray_3aaeec89bb2544f0=function(A,t,e){return A.subarray(t>>>0,e>>>0)},s.wbg.__wbg_subarray_769e1e0f81bb259b=function(A,t,e){return A.subarray(t>>>0,e>>>0)},s.wbg.__wbindgen_init_externref_table=function(){const A=DA.__wbindgen_export_0,t=A.grow(4);A.set(0,void 0),A.set(t+0,void 0),A.set(t+1,null),A.set(t+2,!0),A.set(t+3,!1)},s.wbg.__wbindgen_memory=function(){return DA.memory},s.wbg.__wbindgen_throw=function(A,t){throw new Error(ns(A,t))},s}function os(s,A){return DA=s.exports,ge.__wbindgen_wasm_module=A,jA=null,DA.__wbindgen_start(),DA}async function ge(s){if(DA!==void 0)return DA;typeof s<"u"&&(Object.getPrototypeOf(s)===Object.prototype?{module_or_path:s}=s:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof s>"u"&&(s=new URL("data:application/wasm;base64,AGFzbQEAAAABzAEeYAJ/fwF/YAJ/fwBgA39/fwF/YAN/f38AYAF/AX9gAX8AYANvf38Bb2AFf39/f38Bf2AFf39/f38AYAFvAW9gA29vfwBgAW8Bf2AAAGAAAX9gBH9/f38AYAR/f39/AX9gA39vbwF/YAF/AW9gAAFvYAF9AX1gBn9/f39/fwBgDX19fX19fX19f29/fX0Bb2AGf39/f39/AX9gBX9/fX9/AGAEf31/fwBgBX9/fH9/AGAEf3x/fwBgBX9/fn9/AGAEf35/fwBgAn19AX0C8gQRA3diZx1fX3diZ19idWZmZXJfNjA5Y2MzZWVlNTFlZDE1OAAJA3diZxpfX3diZ19uZXdfOWZlZTk3YTQwOWIzMmI2OAAJA3diZxpfX3diZ19zZXRfZjRmMWYwZGFhMzA2OTZmYwAKA3diZx1fX3diZ19sZW5ndGhfOGNmZDJjNjQwOWFmODhhZAALA3diZzFfX3diZ19uZXd3aXRoYnl0ZW9mZnNldGFuZGxlbmd0aF9mMWRlYWQ0NGQxZmM3MjEyAAYDd2JnGl9fd2JnX25ld19lM2IzMjFkY2ZlZjg5ZmM3AAkDd2JnGl9fd2JnX3NldF9kMjM2NjFkMTkxNDhiMjI5AAoDd2JnHV9fd2JnX2xlbmd0aF82Y2E1Mjc2NjVkODk2OTRkAAsDd2JnMV9fd2JnX25ld3dpdGhieXRlb2Zmc2V0YW5kbGVuZ3RoX2U2YjdlNjlhY2Q0YzczNTQABgN3YmcaX193Ymdfc2V0XzEwYmFkOWJlZTBlOWM1OGIACgN3YmcdX193YmdfbGVuZ3RoXzNiNGYwMjIxODhhZThkYjYACwN3YmcfX193Ymdfc3ViYXJyYXlfNzY5ZTFlMGY4MWJiMjU5YgAGA3diZx9fX3diZ19zdWJhcnJheV8zYWFlZWM4OWJiMjU0NGYwAAYDd2JnJF9fd2JnX25ld3dpdGhsZW5ndGhfNWE1ZWZlMzEzY2ZkNTlmMQARA3diZxBfX3diaW5kZ2VuX3Rocm93AAEDd2JnEV9fd2JpbmRnZW5fbWVtb3J5ABIDd2JnH19fd2JpbmRnZW5faW5pdF9leHRlcm5yZWZfdGFibGUADANeXQQAAQcFAgMCEwEBAA0BAwEAAA0BAwgIAwEBBRQBAw4AAwEDAgwMAgABAQcDABUBFhcIGRsHBQ4CEBAFAx0FBA8CBAQEAA0AAAEBAQAAAAMBAgMBAAEAAAEAAAEEBAQJAnABLi5vAIABBQMBABEGCQF/AUGAgMAACwdiBgZtZW1vcnkCAAtzb3J0X3NwbGF0cwBJDXNvcnQzMl9zcGxhdHMASg5yYXljYXN0X3NwbGF0cwA+E19fd2JpbmRnZW5fZXhwb3J0XzABARBf Line truncated
precision highp int;
precision highp sampler2D;
precision highp usampler2D;
@@ -561,7 +561,7 @@ void main() {
} else {
target = uvec4(0u, 0u, 0u, 0u);
}
}`;const De={rgbMin:0,rgbMax:1,lnScaleMin:kA,lnScaleMax:TA,sh1Min:-1,sh1Max:1,sh2Min:-1,sh2Max:1,sh3Min:-1,sh3Max:1},iA=class iA{constructor(A={}){this.maxSplats=0,this.numSplats=0,this.packedArray=null,this.isInitialized=!1,this.target=null,this.source=null,this.needsUpdate=!0,this.extra={},this.dyno=new hs({packedSplats:this}),this.dynoRgbMinMaxLnScaleMinMax=new Gt({key:"rgbMinMaxLnScaleMinMax",value:new u.Vector4(0,1,kA,TA),update:e=>{var s,n,i,r;return e.set(((s=this.splatEncoding)==null?void 0:s.rgbMin)??0,((n=this.splatEncoding)==null?void 0:n.rgbMax)??1,((i=this.splatEncoding)==null?void 0:i.lnScaleMin)??kA,((r=this.splatEncoding)==null?void 0:r.lnScaleMax)??TA),e}}),this.dynoSh1MinMax=new qt({key:"sh1MinMax",value:new u.Vector2(-1,1),update:e=>{var s,n;return e.set(((s=this.splatEncoding)==null?void 0:s.sh1Min)??-1,((n=this.splatEncoding)==null?void 0:n.sh1Max)??1),e}}),this.dynoSh2MinMax=new qt({key:"sh2MinMax",value:new u.Vector2(-1,1),update:e=>{var s,n;return e.set(((s=this.splatEncoding)==null?void 0:s.sh2Min)??-1,((n=this.splatEncoding)==null?void 0:n.sh2Max)??1),e}}),this.dynoSh3MinMax=new qt({key:"sh3MinMax",value:new u.Vector2(-1,1),update:e=>{var s,n;return e.set(((s=this.splatEncoding)==null?void 0:s.sh3Min)??-1,((n=this.splatEncoding)==null?void 0:n.sh3Max)??1),e}}),this.initialized=Promise.resolve(this),this.reinitialize(A)}reinitialize(A){this.isInitialized=!1,this.extra={},this.splatEncoding=A.splatEncoding,A.url||A.fileBytes||A.construct?this.initialized=this.asyncInitialize(A).then(()=>(this.isInitialized=!0,this)):(this.initialize(A),this.isInitialized=!0,this.initialized=Promise.resolve(this))}initialize(A){A.packedArray?(this.packedArray=A.packedArray,this.maxSplats=Math.floor(this.packedArray.length/4),this.maxSplats=Math.floor(this.maxSplats/Z)*Z,this.numSplats=Math.min(this.maxSplats,A.numSplats??Number.POSITIVE_INFINITY)):(this.maxSplats=A.maxSplats??0,this.numSplats=0),this.extra=A.extra??{}}async asyncInitialize(A){const{url:e,fileBytes:s,construct:n}=A;if(e){const i=new Io;i.packedSplats=this,await i.loadAsync(e)}else if(s){const i=await us({input:s,fileType:A.fileType,pathOrUrl:A.fileName??e,splatEncoding:A.splatEncoding??De});this.initialize(i)}if(n){const i=n(this);i instanceof Promise&&await i}}dispose(){this.target&&(this.target.dispose(),this.target=null),this.source&&(this.source.dispose(),this.source=null)}ensureSplats(A){const e=A<=this.maxSplats?this.maxSplats:Math.max(A,2*this.maxSplats),s=this.packedArray?this.packedArray.length/4:0;if(!this.packedArray||e>s){this.maxSplats=xA(e).maxSplats;const n=new Uint32Array(this.maxSplats*4);this.packedArray&&n.set(this.packedArray),this.packedArray=n}return this.packedArray}ensureSplatsSh(A,e){let s,n;if(A===0)return this.ensureSplats(e);if(A===1)s=2,n="sh1";else if(A===2)s=4,n="sh2";else if(A===3)s=4,n="sh3";else throw new Error(`Invalid level: ${A}`);let i=this.extra[n]?this.extra[n].length/s:0;const r=e<=i?i:Math.max(e,2*i);if(!this.extra[n]||r>i){i=xA(r).maxSplats;const a=new Uint32Array(i*s);this.extra[n]&&a.set(this.extra[n]),this.extra[n]=a}return this.extra[n]}getSplat(A){if(!this.packedArray||A>=this.numSplats)throw new Error("Invalid index");return Ee(this.packedArray,A,this.splatEncoding)}setSplat(A,e,s,n,i,r){const a=this.ensureSplats(A+1);Be(a,A,e.x,e.y,e.z,s.x,s.y,s.z,n.x,n.y,n.z,n.w,i,r.r,r.g,r.b),this.numSplats=Math.max(this.numSplats,A+1)}pushSplat(A,e,s,n,i){const r=this.ensureSplats(this.numSplats+1);Be(r,this.numSplats,A.x,A.y,A.z,e.x,e.y,e.z,s.x,s.y,s.z,s.w,n,i.r,i.g,i.b),++this.numSplats}forEachSplat(A){if(!(!this.packedArray||!this.numSplats))for(let e=0;e<this.numSplats;++e){const s=Ee(this.packedArray,e,this.splatEncoding);A(e,s.center,s.scales,s.quaternion,s.opacity,s.color)}}ensureGenerate(A){if(this.target&&(A??1)<=this.maxSplats)return!1;this.dispose();const e=xA(A??1),{width:s,height:n,depth:i}=e;return this.maxSplats=e.maxSplats,this.target=new u.WebGLArrayRenderTarget(s,n,i,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:u.NearestFilter,minFilter:u.NearestFilter}),this.target.texture.format=u.RGBAIntegerFormat,this.target.texture.type=u.UnsignedIntType,this.target.texture.internalFormat="RGBA32UI",this.target.scissorTest=!0,!0}generateMapping(A){let e=0;const s=A.map(n=>{const i=e,r=Math.ceil(n/Z)*Z;return e+=r,{base:i,count:n}});return{maxSplats:e,mapping:s}}getTexture(){return this.target?this.target.texture:this.source||this.packedArray?this.maybeUpdateSource():iA.getEmpty()}maybeUpdateSource(){if(!this.packedArray)throw new Error("No packed splats");if(this.needsUpdate||!this.source){if(this.needsUpdate=!1,this.source){const{width:A,height:e,depth:s}=this.source.image;this.maxSplats!==A*e*s&&(this.source.dispose(),this.source=null)}if(this.source)this.packedArray.buffer!==this.source.image.data.buffer&&(this.source.image.data=new Uint8Array(this.packedArray.buffer));else{const{width:A,height:e,depth:s}=xA(this.maxSplats);this.source=new u.DataArrayTexture(this.packedArra Line truncated
}`;const De={rgbMin:0,rgbMax:1,lnScaleMin:kA,lnScaleMax:TA,sh1Min:-1,sh1Max:1,sh2Min:-1,sh2Max:1,sh3Min:-1,sh3Max:1},iA=class iA{constructor(A={}){this.maxSplats=0,this.numSplats=0,this.packedArray=null,this.isInitialized=!1,this.target=null,this.source=null,this.needsUpdate=!0,this.extra={},this.dyno=new hs({packedSplats:this}),this.dynoRgbMinMaxLnScaleMinMax=new Gt({key:"rgbMinMaxLnScaleMinMax",value:new u.Vector4(0,1,kA,TA),update:e=>{var s,n,i,r;return e.set(((s=this.splatEncoding)==null?void 0:s.rgbMin)??0,((n=this.splatEncoding)==null?void 0:n.rgbMax)??1,((i=this.splatEncoding)==null?void 0:i.lnScaleMin)??kA,((r=this.splatEncoding)==null?void 0:r.lnScaleMax)??TA),e}}),this.dynoSh1MinMax=new qt({key:"sh1MinMax",value:new u.Vector2(-1,1),update:e=>{var s,n;return e.set(((s=this.splatEncoding)==null?void 0:s.sh1Min)??-1,((n=this.splatEncoding)==null?void 0:n.sh1Max)??1),e}}),this.dynoSh2MinMax=new qt({key:"sh2MinMax",value:new u.Vector2(-1,1),update:e=>{var s,n;return e.set(((s=this.splatEncoding)==null?void 0:s.sh2Min)??-1,((n=this.splatEncoding)==null?void 0:n.sh2Max)??1),e}}),this.dynoSh3MinMax=new qt({key:"sh3MinMax",value:new u.Vector2(-1,1),update:e=>{var s,n;return e.set(((s=this.splatEncoding)==null?void 0:s.sh3Min)??-1,((n=this.splatEncoding)==null?void 0:n.sh3Max)??1),e}}),this.initialized=Promise.resolve(this),this.reinitialize(A)}reinitialize(A){this.isInitialized=!1,this.extra={},this.splatEncoding=A.splatEncoding,A.url||A.fileBytes||A.construct?this.initialized=this.asyncInitialize(A).then(()=>(this.isInitialized=!0,this)):(this.initialize(A),this.isInitialized=!0,this.initialized=Promise.resolve(this))}initialize(A){A.packedArray?(this.packedArray=A.packedArray,this.maxSplats=Math.floor(this.packedArray.length/4),this.maxSplats=Math.floor(this.maxSplats/Z)*Z,this.numSplats=Math.min(this.maxSplats,A.numSplats??Number.POSITIVE_INFINITY)):(this.maxSplats=A.maxSplats??0,this.numSplats=0),this.extra=A.extra??{}}async asyncInitialize(A){const{url:e,fileBytes:s,construct:n}=A;if(e){const i=new lo;i.packedSplats=this,await i.loadAsync(e)}else if(s){const i=await us({input:s,fileType:A.fileType,pathOrUrl:A.fileName??e,splatEncoding:A.splatEncoding??De});this.initialize(i)}if(n){const i=n(this);i instanceof Promise&&await i}}dispose(){this.target&&(this.target.dispose(),this.target=null),this.source&&(this.source.dispose(),this.source=null)}ensureSplats(A){const e=A<=this.maxSplats?this.maxSplats:Math.max(A,2*this.maxSplats),s=this.packedArray?this.packedArray.length/4:0;if(!this.packedArray||e>s){this.maxSplats=xA(e).maxSplats;const n=new Uint32Array(this.maxSplats*4);this.packedArray&&n.set(this.packedArray),this.packedArray=n}return this.packedArray}ensureSplatsSh(A,e){let s,n;if(A===0)return this.ensureSplats(e);if(A===1)s=2,n="sh1";else if(A===2)s=4,n="sh2";else if(A===3)s=4,n="sh3";else throw new Error(`Invalid level: ${A}`);let i=this.extra[n]?this.extra[n].length/s:0;const r=e<=i?i:Math.max(e,2*i);if(!this.extra[n]||r>i){i=xA(r).maxSplats;const a=new Uint32Array(i*s);this.extra[n]&&a.set(this.extra[n]),this.extra[n]=a}return this.extra[n]}getSplat(A){if(!this.packedArray||A>=this.numSplats)throw new Error("Invalid index");return Ee(this.packedArray,A,this.splatEncoding)}setSplat(A,e,s,n,i,r){const a=this.ensureSplats(A+1);Be(a,A,e.x,e.y,e.z,s.x,s.y,s.z,n.x,n.y,n.z,n.w,i,r.r,r.g,r.b),this.numSplats=Math.max(this.numSplats,A+1)}pushSplat(A,e,s,n,i){const r=this.ensureSplats(this.numSplats+1);Be(r,this.numSplats,A.x,A.y,A.z,e.x,e.y,e.z,s.x,s.y,s.z,s.w,n,i.r,i.g,i.b),++this.numSplats}forEachSplat(A){if(!(!this.packedArray||!this.numSplats))for(let e=0;e<this.numSplats;++e){const s=Ee(this.packedArray,e,this.splatEncoding);A(e,s.center,s.scales,s.quaternion,s.opacity,s.color)}}ensureGenerate(A){if(this.target&&(A??1)<=this.maxSplats)return!1;this.dispose();const e=xA(A??1),{width:s,height:n,depth:i}=e;return this.maxSplats=e.maxSplats,this.target=new u.WebGLArrayRenderTarget(s,n,i,{depthBuffer:!1,stencilBuffer:!1,generateMipmaps:!1,magFilter:u.NearestFilter,minFilter:u.NearestFilter}),this.target.texture.format=u.RGBAIntegerFormat,this.target.texture.type=u.UnsignedIntType,this.target.texture.internalFormat="RGBA32UI",this.target.scissorTest=!0,!0}generateMapping(A){let e=0;const s=A.map(n=>{const i=e,r=Math.ceil(n/Z)*Z;return e+=r,{base:i,count:n}});return{maxSplats:e,mapping:s}}getTexture(){return this.target?this.target.texture:this.source||this.packedArray?this.maybeUpdateSource():iA.getEmpty()}maybeUpdateSource(){if(!this.packedArray)throw new Error("No packed splats");if(this.needsUpdate||!this.source){if(this.needsUpdate=!1,this.source){const{width:A,height:e,depth:s}=this.source.image;this.maxSplats!==A*e*s&&(this.source.dispose(),this.source=null)}if(this.source)this.packedArray.buffer!==this.source.image.data.buffer&&(this.source.image.data=new Uint8Array(this.packedArray.buffer));else{const{width:A,height:e,depth:s}=xA(this.maxSplats);this.source=new u.DataArrayTexture(this.packedArra Line truncated
float computeSort(Gsplat gsplat, bool sortRadial, vec3 sortOrigin, vec3 sortDirection, float sortDepthBias, bool sort360) {
if (!isGsplatActive(gsplat.flags)) {
return INFINITY;
@@ -948,6 +948,7 @@ uniform uint numSplats;
uniform vec4 renderToViewQuat;
uniform vec3 renderToViewPos;
uniform float maxStdDev;
uniform float minPixelRadius;
uniform float maxPixelRadius;
uniform float time;
uniform float deltaTime;
@@ -1130,11 +1131,14 @@ void main() {
vec2 eigenVec1 = normalize(vec2((abs(b) < 0.001) ? 1.0 : b, eigen1 - a));
vec2 eigenVec2 = vec2(eigenVec1.y, -eigenVec1.x);
float scale1 = position.x * min(maxPixelRadius, maxStdDev * sqrt(eigen1));
float scale2 = position.y * min(maxPixelRadius, maxStdDev * sqrt(eigen2));
float scale1 = min(maxPixelRadius, maxStdDev * sqrt(eigen1));
float scale2 = min(maxPixelRadius, maxStdDev * sqrt(eigen2));
if (scale1 < minPixelRadius && scale2 < minPixelRadius) {
return;
}
vec2 pixelOffset = eigenVec1 * scale1 + eigenVec2 * scale2;
vec2 pixelOffset = position.x * eigenVec1 * scale1 + position.y * eigenVec2 * scale2;
vec2 ndcOffset = (2.0 / scaledRenderSize) * pixelOffset;
vec3 ndc = vec3(ndcCenter.xy + ndcOffset, ndcCenter.z);
@@ -1142,7 +1146,7 @@ void main() {
vSplatUv = position.xy * maxStdDev;
vNdc = ndc;
gl_Position = vec4(ndc.xy * clipCenter.w, clipCenter.zw);
}`;let _e=null;function rh(){return _e||(u.ShaderChunk.splatDefines=sh,_e={splatVertex:ih,splatFragment:nh}),_e}const ws=5,cA=class cA extends u.Mesh{constructor(A){const e=cA.makeUniforms(),s=rh(),n=A.premultipliedAlpha??!0,i=new u.ShaderMaterial({glslVersion:u.GLSL3,vertexShader:s.splatVertex,fragmentShader:s.splatFragment,uniforms:e,premultipliedAlpha:n,transparent:!0,depthTest:!0,depthWrite:!1,side:u.DoubleSide});super(ms,i),this.splatTexture=null,this.autoViewpoints=[],this.rotateToAccumulator=new Gt({value:new u.Quaternion}),this.translateToAccumulator=new Nt({value:new u.Vector3}),this.lastFrame=-1,this.lastUpdateTime=null,this.defaultCameras=[],this.lastStochastic=null,this.pendingUpdate={scene:null,originToWorld:new u.Matrix4,timeoutId:-1},this.envViewpoint=null,this.frustumCulled=!1,this.renderer=A.renderer,this.material=i,this.uniforms=e;const r=FA({gsplat:AA},{gsplat:AA},({gsplat:a})=>{if(!a)throw new Error("gsplat not defined");return a=ts(a,{rotate:this.rotateToAccumulator,translate:this.translateToAccumulator}),{gsplat:a}});this.modifier=new ao(r),this.premultipliedAlpha=n,this.autoUpdate=A.autoUpdate??!0,this.preUpdate=A.preUpdate??!1,this.needsUpdate=!1,this.originDistance=A.originDistance??1,this.maxStdDev=A.maxStdDev??Math.sqrt(8),this.maxPixelRadius=A.maxPixelRadius??512,this.minAlpha=A.minAlpha??.5*(1/255),this.enable2DGS=A.enable2DGS??!1,this.preBlurAmount=A.preBlurAmount??0,this.blurAmount=A.blurAmount??.3,this.focalDistance=A.focalDistance??0,this.apertureAngle=A.apertureAngle??0,this.falloff=A.falloff??1,this.clipXY=A.clipXY??1.4,this.focalAdjustment=A.focalAdjustment??1,this.splatEncoding=A.splatEncoding??{...De},this.active=new ue,this.accumulatorCount=1,this.freeAccumulators=[];for(let a=0;a<1;++a)this.freeAccumulators.push(new ue),this.accumulatorCount+=1;this.defaultView=new Wt({...A.view,autoUpdate:!0,spark:this}),this.viewpoint=this.defaultView,this.prepareViewpoint(this.viewpoint),this.clock=A.clock?ti(A.clock):new u.Clock}static makeUniforms(){return{renderSize:{value:new u.Vector2},near:{value:.1},far:{value:1e3},numSplats:{value:0},renderToViewQuat:{value:new u.Quaternion},renderToViewPos:{value:new u.Vector3},maxStdDev:{value:1},maxPixelRadius:{value:512},minAlpha:{value:.00196078431372549},stochastic:{value:!1},enable2DGS:{value:!1},preBlurAmount:{value:0},blurAmount:{value:.3},focalDistance:{value:0},apertureAngle:{value:0},falloff:{value:1},clipXY:{value:1.4},focalAdjustment:{value:1},splatTexEnable:{value:!1},splatTexture:{type:"t",value:cA.EMPTY_SPLAT_TEXTURE},splatTexMul:{value:new u.Matrix2},splatTexAdd:{value:new u.Vector2},splatTexNear:{value:.1},splatTexFar:{value:1e3},splatTexMid:{value:0},packedSplats:{type:"t",value:HA.getEmpty()},rgbMinMaxLnScaleMinMax:{value:new u.Vector4},time:{value:0},deltaTime:{value:0},encodeLinear:{value:!1},debugFlag:{value:!1}}}canAllocAccumulator(){return this.freeAccumulators.length>0||this.accumulatorCount<ws}maybeAllocAccumulator(){let A=this.freeAccumulators.pop();if(A===void 0){if(this.accumulatorCount>=ws)return null;A=new ue,this.accumulatorCount+=1}return A.refCount=1,A}releaseAccumulator(A){A.refCount-=1,A.refCount===0&&this.freeAccumulators.push(A)}newViewpoint(A){return new Wt({...A,spark:this})}onBeforeRender(A,e,s){var h,E;const n=this.time??this.clock.getElapsedTime(),i=n-(this.viewpoint.lastTime??n);this.viewpoint.lastTime=n;const r=A.info.render.frame,a=r!==this.lastFrame;this.lastFrame=r;const o=this.viewpoint;if(o===this.defaultView){if(a)if(!A.xr.isPresenting)this.defaultView.viewToWorld=s.matrixWorld.clone(),this.defaultCameras=[this.defaultView.viewToWorld];else{const C=A.xr.getCamera().cameras;this.defaultCameras=C.map(B=>B.matrixWorld),this.defaultView.viewToWorld=ah(this.defaultCameras)??new u.Matrix4}this.autoUpdate&&this.update({scene:e,viewToWorld:this.defaultView.viewToWorld})}if(a&&(this.material.premultipliedAlpha!==this.premultipliedAlpha&&(this.material.premultipliedAlpha=this.premultipliedAlpha,this.material.needsUpdate=!0),this.uniforms.time.value=n,this.uniforms.deltaTime.value=i,this.uniforms.debugFlag.value=performance.now()/1e3%2<1,o.display&&o.stochastic&&(this.geometry.instanceCount=this.uniforms.numSplats.value)),o.target)this.uniforms.renderSize.value.set(o.target.width,o.target.height);else{const C=A.getDrawingBufferSize(this.uniforms.renderSize.value);if(C.x===1&&C.y===1){const B=(h=A.xr.getSession())==null?void 0:h.renderState.baseLayer;B&&(C.x=B.framebufferWidth,C.y=B.framebufferHeight)}}const g=s;if(this.uniforms.near.value=g.near,this.uniforms.far.value=g.far,this.uniforms.encodeLinear.value=o.encodeLinear,this.uniforms.maxStdDev.value=this.maxStdDev,this.uniforms.maxPixelRadius.value=this.maxPixelRadius,this.uniforms.minAlpha.value=this.minAlpha,this.uniforms.stochastic.value=o.stochastic,this.uniforms.enable2DGS.value=this.enable2DGS,this.uniforms.preBlurAmount.value=this.preBlurAmount,this.uniforms.blurAmount.value=this.blurAmount,this.uniforms.focalDistance.value=this.focalDista Line truncated
}`;let _e=null;function rh(){return _e||(u.ShaderChunk.splatDefines=sh,_e={splatVertex:ih,splatFragment:nh}),_e}const ws=5,cA=class cA extends u.Mesh{constructor(A){const e=cA.makeUniforms(),s=rh(),n=A.premultipliedAlpha??!0,i=new u.ShaderMaterial({glslVersion:u.GLSL3,vertexShader:s.splatVertex,fragmentShader:s.splatFragment,uniforms:e,premultipliedAlpha:n,transparent:!0,depthTest:!0,depthWrite:!1,side:u.DoubleSide});super(ms,i),this.splatTexture=null,this.autoViewpoints=[],this.rotateToAccumulator=new Gt({value:new u.Quaternion}),this.translateToAccumulator=new Nt({value:new u.Vector3}),this.lastFrame=-1,this.lastUpdateTime=null,this.defaultCameras=[],this.lastStochastic=null,this.pendingUpdate={scene:null,originToWorld:new u.Matrix4,timeoutId:-1},this.envViewpoint=null,this.frustumCulled=!1,this.renderer=A.renderer,this.material=i,this.uniforms=e;const r=FA({gsplat:AA},{gsplat:AA},({gsplat:a})=>{if(!a)throw new Error("gsplat not defined");return a=ts(a,{rotate:this.rotateToAccumulator,translate:this.translateToAccumulator}),{gsplat:a}});this.modifier=new ro(r),this.premultipliedAlpha=n,this.autoUpdate=A.autoUpdate??!0,this.preUpdate=A.preUpdate??!1,this.needsUpdate=!1,this.originDistance=A.originDistance??1,this.maxStdDev=A.maxStdDev??Math.sqrt(8),this.minPixelRadius=A.minPixelRadius??0,this.maxPixelRadius=A.maxPixelRadius??512,this.minAlpha=A.minAlpha??.5*(1/255),this.enable2DGS=A.enable2DGS??!1,this.preBlurAmount=A.preBlurAmount??0,this.blurAmount=A.blurAmount??.3,this.focalDistance=A.focalDistance??0,this.apertureAngle=A.apertureAngle??0,this.falloff=A.falloff??1,this.clipXY=A.clipXY??1.4,this.focalAdjustment=A.focalAdjustment??1,this.splatEncoding=A.splatEncoding??{...De},this.active=new ue,this.accumulatorCount=1,this.freeAccumulators=[];for(let a=0;a<1;++a)this.freeAccumulators.push(new ue),this.accumulatorCount+=1;this.defaultView=new Wt({...A.view,autoUpdate:!0,spark:this}),this.viewpoint=this.defaultView,this.prepareViewpoint(this.viewpoint),this.clock=A.clock?Ai(A.clock):new u.Clock}static makeUniforms(){return{renderSize:{value:new u.Vector2},near:{value:.1},far:{value:1e3},numSplats:{value:0},renderToViewQuat:{value:new u.Quaternion},renderToViewPos:{value:new u.Vector3},maxStdDev:{value:1},minPixelRadius:{value:0},maxPixelRadius:{value:512},minAlpha:{value:.00196078431372549},stochastic:{value:!1},enable2DGS:{value:!1},preBlurAmount:{value:0},blurAmount:{value:.3},focalDistance:{value:0},apertureAngle:{value:0},falloff:{value:1},clipXY:{value:1.4},focalAdjustment:{value:1},splatTexEnable:{value:!1},splatTexture:{type:"t",value:cA.EMPTY_SPLAT_TEXTURE},splatTexMul:{value:new u.Matrix2},splatTexAdd:{value:new u.Vector2},splatTexNear:{value:.1},splatTexFar:{value:1e3},splatTexMid:{value:0},packedSplats:{type:"t",value:HA.getEmpty()},rgbMinMaxLnScaleMinMax:{value:new u.Vector4},time:{value:0},deltaTime:{value:0},encodeLinear:{value:!1},debugFlag:{value:!1}}}canAllocAccumulator(){return this.freeAccumulators.length>0||this.accumulatorCount<ws}maybeAllocAccumulator(){let A=this.freeAccumulators.pop();if(A===void 0){if(this.accumulatorCount>=ws)return null;A=new ue,this.accumulatorCount+=1}return A.refCount=1,A}releaseAccumulator(A){A.refCount-=1,A.refCount===0&&this.freeAccumulators.push(A)}newViewpoint(A){return new Wt({...A,spark:this})}onBeforeRender(A,e,s){var h,E;const n=this.time??this.clock.getElapsedTime(),i=n-(this.viewpoint.lastTime??n);this.viewpoint.lastTime=n;const r=A.info.render.frame,a=r!==this.lastFrame;this.lastFrame=r;const o=this.viewpoint;if(o===this.defaultView){if(a)if(!A.xr.isPresenting)this.defaultView.viewToWorld=s.matrixWorld.clone(),this.defaultCameras=[this.defaultView.viewToWorld];else{const C=A.xr.getCamera().cameras;this.defaultCameras=C.map(B=>B.matrixWorld),this.defaultView.viewToWorld=ah(this.defaultCameras)??new u.Matrix4}this.autoUpdate&&this.update({scene:e,viewToWorld:this.defaultView.viewToWorld})}if(a&&(this.material.premultipliedAlpha!==this.premultipliedAlpha&&(this.material.premultipliedAlpha=this.premultipliedAlpha,this.material.needsUpdate=!0),this.uniforms.time.value=n,this.uniforms.deltaTime.value=i,this.uniforms.debugFlag.value=performance.now()/1e3%2<1,o.display&&o.stochastic&&(this.geometry.instanceCount=this.uniforms.numSplats.value)),o.target)this.uniforms.renderSize.value.set(o.target.width,o.target.height);else{const C=A.getDrawingBufferSize(this.uniforms.renderSize.value);if(C.x===1&&C.y===1){const B=(h=A.xr.getSession())==null?void 0:h.renderState.baseLayer;B&&(C.x=B.framebufferWidth,C.y=B.framebufferHeight)}}const g=s;if(this.uniforms.near.value=g.near,this.uniforms.far.value=g.far,this.uniforms.encodeLinear.value=o.encodeLinear,this.uniforms.maxStdDev.value=this.maxStdDev,this.uniforms.minPixelRadius.value=this.minPixelRadius,this.uniforms.maxPixelRadius.value=this.maxPixelRadius,this.uniforms.minAlpha.value=this.minAlpha,this.uniforms.stochastic.value=o.stochastic,this.uniforms.enable2DGS.value=this.enable2DGS,this.uniforms.preBlurAmount.v Line truncated
struct GsplatSkinning {
int numSplats;
int numBones;
@@ -1208,7 +1212,7 @@ void main() {
center = quatVec(quat, center) + translate;
quaternion = quatQuat(quat, quaternion);
}
`);function Eh(t,A){return new V({inTypes:{gsplat:AA,skinning:Eo},outTypes:{gsplat:AA},globals:()=>[Qo,Bh],inputs:{gsplat:t,skinning:A},statements:({inputs:s,outputs:n})=>{const{skinning:i}=s,{gsplat:r}=n;return YA(`
`);function Eh(t,A){return new V({inTypes:{gsplat:AA,skinning:Bo},outTypes:{gsplat:AA},globals:()=>[Eo,Bh],inputs:{gsplat:t,skinning:A},statements:({inputs:s,outputs:n})=>{const{skinning:i}=s,{gsplat:r}=n;return YA(`
${r} = ${s.gsplat};
if (isGsplatActive(${r}.flags)) {
applyGsplatSkinning(
@@ -1218,5 +1222,5 @@ void main() {
);
}
`)}}).outputs.gsplat}function Qh({splats:t,extents:A,stepSize:e=1,pointRadius:s=.01,pointShadowScale:n=2,opacity:i=1,color:r}){const o=new u.Vector3,g=new u.Vector3,l=new u.Quaternion(0,0,0,1);r==null&&(r=(I,h)=>I.set(.55+.45*Math.cos(h.x*1),.55+.45*Math.cos(h.y*1),.55+.45*Math.cos(h.z*1)));const c=new u.Color;for(let I=A.min.z;I<A.max.z+1e-6;I+=e)for(let h=A.min.y;h<A.max.y+1e-6;h+=e)for(let E=A.min.x;E<A.max.x+1e-6;E+=e){o.set(E,h,I);for(let C=0;C<2;++C)g.setScalar(s*(C?1:n)),C?typeof r=="function"?r(c,o):c.copy(r):c.setScalar(0),t.pushSplat(o,g,l,i,c)}}function ph({splats:t,scale:A=.25,axisRadius:e=.0075,axisShadowScale:s=2,origins:n=[new u.Vector3]}){const i=new u.Vector3,r=new u.Vector3,a=new u.Quaternion(0,0,0,1),o=new u.Color,g=1;for(const l of n)for(let c=0;c<3;++c){i.set(l.x+(c===0?A:0),l.y+(c===1?A:0),l.z+(c===2?A:0));for(let I=0;I<2;++I)r.set((c===0?A:e)*(I?1:s),(c===1?A:e)*(I?1:s),(c===2?A:e)*(I?1:s)),o.setRGB(I===0?0:c===0?1:0,I===0?0:c===1?1:0,I===0?0:c===2?1:0),t.pushSplat(i,r,a,g,o)}}function fh({splats:t,origin:A=new u.Vector3,radius:e=1,maxDepth:s=3,filter:n=null,pointRadius:i=.02,pointThickness:r=.001,color:a=new u.Color(1,1,1)}){const o={};function g(C){if(n&&!n(C))return;const B=`${C.x},${C.y},${C.z}`;o[B]||(o[B]=C)}function l(C,B,Q,f){if(g(B),g(Q),g(f),C>=s)return;const p=new u.Vector3().addVectors(B,Q).normalize(),d=new u.Vector3().addVectors(Q,f).normalize(),y=new u.Vector3().addVectors(f,B).normalize();l(C+1,B,p,y),l(C+1,p,Q,d),l(C+1,y,d,f),l(C+1,p,d,y)}for(const C of[-1,1])for(const B of[-1,1])for(const Q of[-1,1]){const f=new u.Vector3(C,0,0),p=new u.Vector3(0,B,0),d=new u.Vector3(0,0,Q);l(0,f,p,d)}const c=Object.values(o),I=new u.Vector3(i,i,r),h=new u.Quaternion,E=typeof a=="function"?new u.Color:a;for(const C of c)h.setFromUnitVectors(new u.Vector3(0,0,-1),C),typeof a=="function"&&a(E,C),C.multiplyScalar(e),C.add(A),t.pushSplat(C,I,h,1,E)}function dh({text:t,font:A,fontSize:e,color:s,rgb:n,dotRadius:i,textAlign:r,lineHeight:a,objectScale:o}){A=A??"Arial",e=e??32,s=s??new u.Color(1,1,1),i=i??.8,r=r??"start",a=a??1,o=o??1;const g=t.split(`
`),l=document.createElement("canvas"),c=l.getContext("2d");if(!c)throw new Error("Failed to create canvas context");c.font=`${e}px ${A}`,c.textAlign=r;const I=c.measureText(""),h=I.fontBoundingBoxAscent+I.fontBoundingBoxDescent;let E=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,B=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY;for(let F=0;F<g.length;++F){const b=c.measureText(g[F]),T=h*a*F;E=Math.min(E,-b.actualBoundingBoxLeft),C=Math.max(C,b.actualBoundingBoxRight),B=Math.min(B,T-b.actualBoundingBoxAscent),Q=Math.max(Q,T+b.actualBoundingBoxDescent)}const f=Math.floor(E),p=Math.floor(B),d=Math.ceil(C)-f,y=Math.ceil(Q)-p;l.width=d,l.height=y,c.font=`${e}px ${A}`,c.textAlign=r,c.textBaseline="alphabetic",c.fillStyle="#FFFFFF";for(let F=0;F<g.length;++F){const b=h*a*F-p;c.fillText(g[F],-f,b)}const D=c.getImageData(0,0,d,y),x=new Uint8Array(D.data.buffer),w=new HA,m=new u.Vector3,k=new u.Vector3().setScalar(i*o),M=new u.Quaternion(0,0,0,1);n=n??new u.Color(1,1,1);let S=0;for(let F=0;F<y;++F)for(let b=0;b<d;++b){const T=x[S+3];if(T>0){const R=T/255;m.set(b-.5*(d-1),.5*(y-1)-F,0),m.multiplyScalar(o),w.pushSplat(m,k,M,R,n)}S+=4}const U=new ct({packedSplats:w});return U.recolor=s,U}function yh({url:t,dotRadius:A,subXY:e,forEachSplat:s}){return A=A??.8,e=Math.max(1,Math.floor(e??1)),new ct({constructSplats:async n=>new Promise((i,r)=>{const a=new Image;a.crossOrigin="anonymous",a.onerror=r,a.onload=()=>{const{width:o,height:g}=a,l=document.createElement("canvas");l.width=o,l.height=g;const c=l.getContext("2d");if(!c){r(new Error("Failed to create canvas context"));return}c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high";const I=Math.round(o/e),h=Math.round(g/e);c.drawImage(a,0,0,I,h);try{const E=c.getImageData(0,0,I,h),C=new Uint8Array(E.data.buffer),B=new u.Vector3,Q=new u.Vector3().setScalar(A),f=new u.Quaternion(0,0,0,1),p=new u.Color;let d=0;for(let y=0;y<h;++y)for(let D=0;D<I;++D){const x=d*4,w=C[x+3];if(w>0){let m=w/255;p.set(C[x+0]/255,C[x+1]/255,C[x+2]/255),B.set(D-.5*(I-1),.5*(h-1)-y,0),Q.setScalar(A),f.set(0,0,0,1);let k=!0;if(s){const M=s(I,h,d,B,Q,f,m,p);m=M??m,k=M!==null}k&&n.pushSplat(B,Q,f,m,p)}d+=1}i()}catch(E){r(E)}},a.src=t})})}function wh({box:t,cells:A,dotScale:e,color:s,opacity:n}){A.x=Math.max(1,Math.round(A.x)),A.y=Math.max(1,Math.round(A.y)),A.z=Math.max(1,Math.round(A.z)),n=n??1;const i=A.x*A.y*A.z,r=J("int",A.x),a=J("int",A.y);J("int",A.z);const o=qA(0),g=new kt({numSplats:i,generator:FA({index:"int"},{gsplat:AA},({index:c})=>{if(!c)throw new Error("index is undefined");const I=Ke(c,r),h=le(c,r),E=Ke(h,a),C=le(h,a),B=VA({vectorType:"ivec3",x:I,y:E,z:C}),Q=lr(o),f=VA({vectorType:"ivec2",x:c,y:Q}),p=Ca(f),d=J("vec3",t.min),y=J("vec3",t.max),D=ft(y,d),x=le(EA(Qt(B),p),J("vec3",A));let w,m,k;s?(w=J("float",s.r),m=J("float",s.g),k=J("float",s.b)):{r:w,g:m,b:k}=pt(x).outputs;const M=VA({vectorType:"vec4",r:w,g:m,b:k,a:J("float",n)}),S=EA(d,rA(D,x)),U=Qt(J("float",e)),F=J("vec4",new u.Quaternion(0,0,0,1));let b=rt({flags:he("uint","GSPLAT_FLAG_ACTIVE"),index:c,center:S,scales:U,quaternion:F,rgba:M});return b=l.applyGsplat(b),{gsplat:b}},{globals:()=>[NA]}),update:({time:c})=>{o.value=c,l.update(g),g.updateVersion()}}),l=new ht;return g}const mh={box:new u.Box3(new u.Vector3(-1,-1,-1),new u.Vector3(1,1,1)),density:100,fallDirection:new u.Vector3(-1,-3,1).normalize(),fallVelocity:.02,wanderScale:.04,wanderVariance:2,color1:new u.Color(1,1,1),color2:new u.Color(.5,.5,1),minScale:.001,maxScale:.005,anisoScale:new u.Vector3(1,1,1)},xh={box:new u.Box3(new u.Vector3(-2,-1,-2),new u.Vector3(2,5,2)),density:10,fallDirection:new u.Vector3(0,-1,0),fallVelocity:2,wanderScale:.1,wanderVariance:1,color1:new u.Color(1,1,1),color2:new u.Color(.25,.25,.5),minScale:.005,maxScale:.01,anisoScale:new u.Vector3(.1,1,.1)};function Sh({box:t,minY:A,numSplats:e,density:s,anisoScale:n,minScale:i,maxScale:r,fallDirection:a,fallVelocity:o,wanderScale:g,wanderVariance:l,color1:c,color2:I,opacity:h,onFrame:E}){t=t??new u.Box3(new u.Vector3(-1,-1,-1),new u.Vector3(1,1,1));const C=(t.max.x-t.min.x)*(t.max.y-t.min.y)*(t.max.z-t.min.z);s=s??100,e=e??Math.max(1,Math.min(1e6,Math.round(C*s)));const B=qA(i??.001),Q=qA(r??.005),f=et(((n==null?void 0:n.clone())??new u.Vector3(1,1,1)).normalize()),p=et((a??new u.Vector3(0,-1,0)).normalize()),d=qA(o??.02),y=qA(g??.01),D=qA(l??2),x=et(c??new u.Color(1,1,1)),w=et(I??new u.Color(.5,.5,1)),m=qA(h??1),k=qA(0),M=et(new u.Vector3(0,0,0)),S=et(t.min),U=et(t.max),F=qA(A??Number.NEGATIVE_INFINITY),b=ft(U,S),T=new kt({numSplats:e,generator:FA({index:"int"},{gsplat:AA},({index:X})=>{if(!X)throw new Error("index not defined");const _=Ve(X),eA=pt(_).outputs.w;let q=Qt(_),O=Ie(rA(eA,J("float",100)));O=Pe(rA(he("float","PI"),O)),O=EA(B,rA(O,ft(Q,B)));const L=rA(O,f),j=Ie(rA(eA,J("float",10))),P=Ie(eA),W=hi(x,w,P),G=rA(W,j),dA=Ve(VA({vectorType:"ivec2",x:X,y:J("int",6837)}));let lA=Qt(dA),yA=rA(pt(dA).outputs.w,D);yA=EA(k,yA),q=EA(q,M);const wA=Ii(q,J("vec3",new u.Vector3(1,1,1)));q=E Line truncated
`),l=document.createElement("canvas"),c=l.getContext("2d");if(!c)throw new Error("Failed to create canvas context");c.font=`${e}px ${A}`,c.textAlign=r;const I=c.measureText(""),h=I.fontBoundingBoxAscent+I.fontBoundingBoxDescent;let E=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,B=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY;for(let F=0;F<g.length;++F){const b=c.measureText(g[F]),T=h*a*F;E=Math.min(E,-b.actualBoundingBoxLeft),C=Math.max(C,b.actualBoundingBoxRight),B=Math.min(B,T-b.actualBoundingBoxAscent),Q=Math.max(Q,T+b.actualBoundingBoxDescent)}const f=Math.floor(E),p=Math.floor(B),d=Math.ceil(C)-f,y=Math.ceil(Q)-p;l.width=d,l.height=y,c.font=`${e}px ${A}`,c.textAlign=r,c.textBaseline="alphabetic",c.fillStyle="#FFFFFF";for(let F=0;F<g.length;++F){const b=h*a*F-p;c.fillText(g[F],-f,b)}const D=c.getImageData(0,0,d,y),x=new Uint8Array(D.data.buffer),w=new HA,m=new u.Vector3,k=new u.Vector3().setScalar(i*o),M=new u.Quaternion(0,0,0,1);n=n??new u.Color(1,1,1);let S=0;for(let F=0;F<y;++F)for(let b=0;b<d;++b){const T=x[S+3];if(T>0){const R=T/255;m.set(b-.5*(d-1),.5*(y-1)-F,0),m.multiplyScalar(o),w.pushSplat(m,k,M,R,n)}S+=4}const U=new ct({packedSplats:w});return U.recolor=s,U}function yh({url:t,dotRadius:A,subXY:e,forEachSplat:s}){return A=A??.8,e=Math.max(1,Math.floor(e??1)),new ct({constructSplats:async n=>new Promise((i,r)=>{const a=new Image;a.crossOrigin="anonymous",a.onerror=r,a.onload=()=>{const{width:o,height:g}=a,l=document.createElement("canvas");l.width=o,l.height=g;const c=l.getContext("2d");if(!c){r(new Error("Failed to create canvas context"));return}c.imageSmoothingEnabled=!0,c.imageSmoothingQuality="high";const I=Math.round(o/e),h=Math.round(g/e);c.drawImage(a,0,0,I,h);try{const E=c.getImageData(0,0,I,h),C=new Uint8Array(E.data.buffer),B=new u.Vector3,Q=new u.Vector3().setScalar(A),f=new u.Quaternion(0,0,0,1),p=new u.Color;let d=0;for(let y=0;y<h;++y)for(let D=0;D<I;++D){const x=d*4,w=C[x+3];if(w>0){let m=w/255;p.set(C[x+0]/255,C[x+1]/255,C[x+2]/255),B.set(D-.5*(I-1),.5*(h-1)-y,0),Q.setScalar(A),f.set(0,0,0,1);let k=!0;if(s){const M=s(I,h,d,B,Q,f,m,p);m=M??m,k=M!==null}k&&n.pushSplat(B,Q,f,m,p)}d+=1}i()}catch(E){r(E)}},a.src=t})})}function wh({box:t,cells:A,dotScale:e,color:s,opacity:n}){A.x=Math.max(1,Math.round(A.x)),A.y=Math.max(1,Math.round(A.y)),A.z=Math.max(1,Math.round(A.z)),n=n??1;const i=A.x*A.y*A.z,r=J("int",A.x),a=J("int",A.y);J("int",A.z);const o=qA(0),g=new kt({numSplats:i,generator:FA({index:"int"},{gsplat:AA},({index:c})=>{if(!c)throw new Error("index is undefined");const I=Ke(c,r),h=le(c,r),E=Ke(h,a),C=le(h,a),B=VA({vectorType:"ivec3",x:I,y:E,z:C}),Q=gr(o),f=VA({vectorType:"ivec2",x:c,y:Q}),p=ha(f),d=J("vec3",t.min),y=J("vec3",t.max),D=ft(y,d),x=le(EA(Qt(B),p),J("vec3",A));let w,m,k;s?(w=J("float",s.r),m=J("float",s.g),k=J("float",s.b)):{r:w,g:m,b:k}=pt(x).outputs;const M=VA({vectorType:"vec4",r:w,g:m,b:k,a:J("float",n)}),S=EA(d,rA(D,x)),U=Qt(J("float",e)),F=J("vec4",new u.Quaternion(0,0,0,1));let b=rt({flags:he("uint","GSPLAT_FLAG_ACTIVE"),index:c,center:S,scales:U,quaternion:F,rgba:M});return b=l.applyGsplat(b),{gsplat:b}},{globals:()=>[NA]}),update:({time:c})=>{o.value=c,l.update(g),g.updateVersion()}}),l=new ht;return g}const mh={box:new u.Box3(new u.Vector3(-1,-1,-1),new u.Vector3(1,1,1)),density:100,fallDirection:new u.Vector3(-1,-3,1).normalize(),fallVelocity:.02,wanderScale:.04,wanderVariance:2,color1:new u.Color(1,1,1),color2:new u.Color(.5,.5,1),minScale:.001,maxScale:.005,anisoScale:new u.Vector3(1,1,1)},xh={box:new u.Box3(new u.Vector3(-2,-1,-2),new u.Vector3(2,5,2)),density:10,fallDirection:new u.Vector3(0,-1,0),fallVelocity:2,wanderScale:.1,wanderVariance:1,color1:new u.Color(1,1,1),color2:new u.Color(.25,.25,.5),minScale:.005,maxScale:.01,anisoScale:new u.Vector3(.1,1,.1)};function Sh({box:t,minY:A,numSplats:e,density:s,anisoScale:n,minScale:i,maxScale:r,fallDirection:a,fallVelocity:o,wanderScale:g,wanderVariance:l,color1:c,color2:I,opacity:h,onFrame:E}){t=t??new u.Box3(new u.Vector3(-1,-1,-1),new u.Vector3(1,1,1));const C=(t.max.x-t.min.x)*(t.max.y-t.min.y)*(t.max.z-t.min.z);s=s??100,e=e??Math.max(1,Math.min(1e6,Math.round(C*s)));const B=qA(i??.001),Q=qA(r??.005),f=et(((n==null?void 0:n.clone())??new u.Vector3(1,1,1)).normalize()),p=et((a??new u.Vector3(0,-1,0)).normalize()),d=qA(o??.02),y=qA(g??.01),D=qA(l??2),x=et(c??new u.Color(1,1,1)),w=et(I??new u.Color(.5,.5,1)),m=qA(h??1),k=qA(0),M=et(new u.Vector3(0,0,0)),S=et(t.min),U=et(t.max),F=qA(A??Number.NEGATIVE_INFINITY),b=ft(U,S),T=new kt({numSplats:e,generator:FA({index:"int"},{gsplat:AA},({index:X})=>{if(!X)throw new Error("index not defined");const _=Ve(X),eA=pt(_).outputs.w;let q=Qt(_),O=Ie(rA(eA,J("float",100)));O=Pe(rA(he("float","PI"),O)),O=EA(B,rA(O,ft(Q,B)));const L=rA(O,f),j=Ie(rA(eA,J("float",10))),P=Ie(eA),W=ui(x,w,P),G=rA(W,j),dA=Ve(VA({vectorType:"ivec2",x:X,y:J("int",6837)}));let lA=Qt(dA),yA=rA(pt(dA).outputs.w,D);yA=EA(k,yA),q=EA(q,M);const wA=li(q,J("vec3",new u.Vector3(1,1,1)));q=E Line truncated
//# sourceMappingURL=spark.cjs.min.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"spark.cjs.min.js","sources":["../node_modules/three/examples/jsm/postprocessing/Pass.js","../node_modules/fflate/esm/browser.js","../rust/spark-internal-rs/pkg/spark_internal_rs.js","../src/defines.ts","../src/dyno/types.ts","../src/dyno/value.ts","../src/dyno/base.ts","../src/dyno/splats.ts","../src/dyno/output.ts","../src/dyno/uniforms.ts","../src/utils.ts","../src/dyno/program.ts","../src/dyno/mathTypes.ts","../src/dyno/math.ts","../src/dyno/logic.ts","../src/dyno/convert.ts","../src/dyno/vecmat.ts","../src/dyno/util.ts","../src/dyno/transform.ts","../src/dyno/control.ts","../src/dyno/texture.ts","../src/dyno/trig.ts","../src/shaders/computeVec4.glsl","../src/Readback.ts","../src/RgbaArray.ts","../src/SplatEdit.ts","../src/SplatGenerator.ts","../src/SplatMesh.ts","../src/ply.ts","../src/splatWorker.ts","../src/SplatLoader.ts","../src/shaders/computeUvec4.glsl","../src/PackedSplats.ts","../src/SplatGeometry.ts","../src/SparkViewpoint.ts","../src/SplatAccumulator.ts","../src/shaders/splatDefines.glsl","../src/shaders/splatFragment.glsl","../src/shaders/splatVertex.glsl","../src/shaders.ts","../src/SparkRenderer.ts","../src/antisplat.ts","../src/ksplat.ts","../src/spz.ts","../src/SplatSkinning.ts","../src/splatConstructors.ts","../src/generators/static.ts","../src/generators/snow.ts","../src/modifiers/normalColor.ts","../src/modifiers/depthColor.ts","../src/vrButton.ts","../src/hands.ts","../src/controls.ts"],"sourcesContent":["import {\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tOrthographicCamera,\n\tMesh\n} from 'three';\n\n/**\n * Abstract base class for all post processing passes.\n *\n * This module is only relevant for post processing with {@link WebGLRenderer}.\n *\n * @abstract\n * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js';\n */\nclass Pass {\n\n\t/**\n\t * Constructs a new pass.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPass = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass is processed by the composer.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass indicates to swap read and write buffer after rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.needsSwap = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass clears its buffer before rendering\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clear = false;\n\n\t\t/**\n\t\t * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers\n\t\t * pass chain gets automatically rendered to screen, no matter how this property is configured.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.renderToScreen = false;\n\n\t}\n\n\t/**\n\t * Sets the size of the pass.\n\t *\n\t * @abstract\n\t * @param {number} width - The width to set.\n\t * @param {number} height - The height to set.\n\t */\n\tsetSize( /* width, height */ ) {}\n\n\t/**\n\t * This method holds the render logic of a pass. It must be implemented in all derived classes.\n\t *\n\t * @abstract\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering\n\t * destination for the pass.\n\t * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the\n\t * previous pass from this buffer.\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @param {boolean} maskActive - Whether masking is active or not.\n\t */\n\trender( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n\t\tconsole.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the pass is no longer used in your app.\n\t *\n\t * @abstract\n\t */\n\tdispose() {}\n\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass FullscreenTriangleGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new FullscreenTriangleGeometry();\n\n\n/**\n * This module is a helper for passes which need to render a full\n * screen effect which is quite common in context of post processing.\n *\n * The intended usage is to reuse a single full screen quad for rendering\n * subsequent passes by just reassigning the `material` reference.\n *\n * This module can only be used with {@link WebGLRLine truncated
{"version":3,"file":"spark.cjs.min.js","sources":["../node_modules/three/examples/jsm/postprocessing/Pass.js","../node_modules/fflate/esm/browser.js","../rust/spark-internal-rs/pkg/spark_internal_rs.js","../src/defines.ts","../src/dyno/types.ts","../src/dyno/value.ts","../src/dyno/base.ts","../src/dyno/splats.ts","../src/dyno/output.ts","../src/dyno/uniforms.ts","../src/utils.ts","../src/dyno/program.ts","../src/dyno/mathTypes.ts","../src/dyno/math.ts","../src/dyno/logic.ts","../src/dyno/convert.ts","../src/dyno/vecmat.ts","../src/dyno/util.ts","../src/dyno/transform.ts","../src/dyno/control.ts","../src/dyno/texture.ts","../src/dyno/trig.ts","../src/shaders/computeVec4.glsl","../src/Readback.ts","../src/RgbaArray.ts","../src/SplatEdit.ts","../src/SplatGenerator.ts","../src/SplatMesh.ts","../src/ply.ts","../src/splatWorker.ts","../src/SplatLoader.ts","../src/shaders/computeUvec4.glsl","../src/PackedSplats.ts","../src/SplatGeometry.ts","../src/SparkViewpoint.ts","../src/SplatAccumulator.ts","../src/shaders/splatDefines.glsl","../src/shaders/splatFragment.glsl","../src/shaders/splatVertex.glsl","../src/shaders.ts","../src/SparkRenderer.ts","../src/antisplat.ts","../src/ksplat.ts","../src/spz.ts","../src/SplatSkinning.ts","../src/splatConstructors.ts","../src/generators/static.ts","../src/generators/snow.ts","../src/modifiers/normalColor.ts","../src/modifiers/depthColor.ts","../src/vrButton.ts","../src/hands.ts","../src/controls.ts"],"sourcesContent":["import {\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tOrthographicCamera,\n\tMesh\n} from 'three';\n\n/**\n * Abstract base class for all post processing passes.\n *\n * This module is only relevant for post processing with {@link WebGLRenderer}.\n *\n * @abstract\n * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js';\n */\nclass Pass {\n\n\t/**\n\t * Constructs a new pass.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPass = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass is processed by the composer.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass indicates to swap read and write buffer after rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.needsSwap = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass clears its buffer before rendering\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clear = false;\n\n\t\t/**\n\t\t * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers\n\t\t * pass chain gets automatically rendered to screen, no matter how this property is configured.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.renderToScreen = false;\n\n\t}\n\n\t/**\n\t * Sets the size of the pass.\n\t *\n\t * @abstract\n\t * @param {number} width - The width to set.\n\t * @param {number} height - The height to set.\n\t */\n\tsetSize( /* width, height */ ) {}\n\n\t/**\n\t * This method holds the render logic of a pass. It must be implemented in all derived classes.\n\t *\n\t * @abstract\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering\n\t * destination for the pass.\n\t * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the\n\t * previous pass from this buffer.\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @param {boolean} maskActive - Whether masking is active or not.\n\t */\n\trender( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n\t\tconsole.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the pass is no longer used in your app.\n\t *\n\t * @abstract\n\t */\n\tdispose() {}\n\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass FullscreenTriangleGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new FullscreenTriangleGeometry();\n\n\n/**\n * This module is a helper for passes which need to render a full\n * screen effect which is quite common in context of post processing.\n *\n * The intended usage is to reuse a single full screen quad for rendering\n * subsequent passes by just reassigning the `material` reference.\n *\n * This module can only be used with {@link WebGLRLine truncated
+66 -32
View File
@@ -3165,25 +3165,20 @@ class GunzipReader {
}) {
this.fileBytes = fileBytes;
this.chunkBytes = chunkBytes;
this.offset = 0;
this.chunks = [];
this.totalBytes = 0;
this.gunzip = new Gunzip((chunk, _final) => {
const ds = new DecompressionStream("gzip");
const decompressionStream = new Blob([fileBytes]).stream().pipeThrough(ds);
this.reader = decompressionStream.getReader();
}
async read(numBytes) {
while (this.totalBytes < numBytes) {
const { value: chunk, done: readerDone } = await this.reader.read();
if (readerDone) {
break;
}
this.chunks.push(chunk);
this.totalBytes += chunk.length;
});
}
read(numBytes) {
while (this.totalBytes < numBytes && this.offset < this.fileBytes.length) {
const end = Math.min(
this.offset + this.chunkBytes,
this.fileBytes.length
);
this.gunzip.push(this.fileBytes.subarray(this.offset, end), false);
this.offset = end;
}
if (this.totalBytes < numBytes && this.offset >= this.fileBytes.length) {
this.gunzip.push(new Uint8Array(0), true);
}
if (this.totalBytes < numBytes) {
throw new Error(
@@ -8566,7 +8561,7 @@ function getNumSh(properties) {
}
return numSh;
}
const jsContent = '(function() {\n "use strict";\n let wasm;\n const cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {\n throw Error("TextDecoder not available");\n } };\n if (typeof TextDecoder !== "undefined") {\n cachedTextDecoder.decode();\n }\n let cachedUint8ArrayMemory0 = null;\n function getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n }\n function getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n }\n function sort_splats(num_splats, readback, ordering) {\n const ret = wasm.sort_splats(num_splats, readback, ordering);\n return ret >>> 0;\n }\n function sort32_splats(num_splats, readback, ordering) {\n const ret = wasm.sort32_splats(num_splats, readback, ordering);\n return ret >>> 0;\n }\n async function __wbg_load(module, imports) {\n if (typeof Response === "function" && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === "function") {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n if (module.headers.get("Content-Type") != "application/wasm") {\n console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n", e);\n } else {\n throw e;\n }\n }\n }\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n }\n function __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {\n const ret = arg0.buffer;\n return ret;\n };\n imports.wbg.__wbg_length_3b4f022188ae8db6 = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_6ca527665d89694d = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_8cfd2c6409af88ad = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_new_9fee97a409b32b68 = function(arg0) {\n const ret = new Uint16Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_new_e3b321dcfef89fc7 = function(arg0) {\n const ret = new Uint32Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354 = function(arg0, arg1, arg2) {\n const ret = new Float32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212 = function(arg0, arg1, arg2) {\n const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithlength_5a5efe313cfd59f1 = function(arg0) {\n const ret = new Float32Array(arg0 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_set_10bad9bee0e9c58b = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_set_d23661d19148b229 = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_set_f4f1f0daa30696fc = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_subarray_3aaeec89bb2544f0 = function(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_subarray_769e1e0f81bb259b = function(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbindgen_init_externref_table = function() {\n const table = wasm.__wbindgen_export_0;\n const offset = table.grow(4);\n table.set(0, void 0);\n table.set(offset + 0, void 0);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n };\n imports.wbg.__wbindgen_memory = function() {\n const ret = wasm.memory;\n return ret;\n };\n imports.wbg.__wbindgen_throw = function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n };\n return imports;\n }\n function __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedUint8ArrayMemory0 = null;\n wasm.__wbindgen_start();\n return wasm;\n Line truncated
const jsContent = '(function() {\n "use strict";\n let wasm;\n const cachedTextDecoder = typeof TextDecoder !== "undefined" ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) : { decode: () => {\n throw Error("TextDecoder not available");\n } };\n if (typeof TextDecoder !== "undefined") {\n cachedTextDecoder.decode();\n }\n let cachedUint8ArrayMemory0 = null;\n function getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n }\n function getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n }\n function sort_splats(num_splats, readback, ordering) {\n const ret = wasm.sort_splats(num_splats, readback, ordering);\n return ret >>> 0;\n }\n function sort32_splats(num_splats, readback, ordering) {\n const ret = wasm.sort32_splats(num_splats, readback, ordering);\n return ret >>> 0;\n }\n async function __wbg_load(module, imports) {\n if (typeof Response === "function" && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === "function") {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n if (module.headers.get("Content-Type") != "application/wasm") {\n console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n", e);\n } else {\n throw e;\n }\n }\n }\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n }\n function __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {\n const ret = arg0.buffer;\n return ret;\n };\n imports.wbg.__wbg_length_3b4f022188ae8db6 = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_6ca527665d89694d = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_length_8cfd2c6409af88ad = function(arg0) {\n const ret = arg0.length;\n return ret;\n };\n imports.wbg.__wbg_new_9fee97a409b32b68 = function(arg0) {\n const ret = new Uint16Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_new_e3b321dcfef89fc7 = function(arg0) {\n const ret = new Uint32Array(arg0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354 = function(arg0, arg1, arg2) {\n const ret = new Float32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithbyteoffsetandlength_f1dead44d1fc7212 = function(arg0, arg1, arg2) {\n const ret = new Uint32Array(arg0, arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_newwithlength_5a5efe313cfd59f1 = function(arg0) {\n const ret = new Float32Array(arg0 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_set_10bad9bee0e9c58b = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_set_d23661d19148b229 = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_set_f4f1f0daa30696fc = function(arg0, arg1, arg2) {\n arg0.set(arg1, arg2 >>> 0);\n };\n imports.wbg.__wbg_subarray_3aaeec89bb2544f0 = function(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbg_subarray_769e1e0f81bb259b = function(arg0, arg1, arg2) {\n const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);\n return ret;\n };\n imports.wbg.__wbindgen_init_externref_table = function() {\n const table = wasm.__wbindgen_export_0;\n const offset = table.grow(4);\n table.set(0, void 0);\n table.set(offset + 0, void 0);\n table.set(offset + 1, null);\n table.set(offset + 2, true);\n table.set(offset + 3, false);\n };\n imports.wbg.__wbindgen_memory = function() {\n const ret = wasm.memory;\n return ret;\n };\n imports.wbg.__wbindgen_throw = function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n };\n return imports;\n }\n function __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedUint8ArrayMemory0 = null;\n wasm.__wbindgen_start();\n return wasm;\n Line truncated
const blob = typeof self !== "undefined" && self.Blob && new Blob([jsContent], { type: "text/javascript;charset=utf-8" });
function WorkerWrapper(options) {
let objURL;
@@ -8887,6 +8882,9 @@ function getSplatFileTypeFromPath(pathOrUrl) {
if (extension === "ksplat") {
return "ksplat";
}
if (extension === "sog") {
return "pcsogszip";
}
return void 0;
}
function isPcSogs(input) {
@@ -8908,15 +8906,28 @@ function tryPcSogs(input) {
if (!json || typeof json !== "object" || Array.isArray(json)) {
return void 0;
}
const isVersion2 = json.version === 2;
for (const key of ["means", "scales", "quats", "sh0"]) {
if (!json[key] || typeof json[key] !== "object" || Array.isArray(json[key])) {
return void 0;
}
if (!json[key].shape || !json[key].files) {
return void 0;
}
if (key !== "quats" && (!json[key].mins || !json[key].maxs)) {
return void 0;
if (isVersion2) {
if (!json[key].files) {
return void 0;
}
if ((key === "scales" || key === "sh0") && !json[key].codebook) {
return void 0;
}
if (key === "means" && (!json[key].mins || !json[key].maxs)) {
return void 0;
}
} else {
if (!json[key].shape || !json[key].files) {
return void 0;
}
if (key !== "quats" && (!json[key].mins || !json[key].maxs)) {
return void 0;
}
}
}
return json;
@@ -10338,7 +10349,7 @@ class SplatAccumulator {
}
var splatDefines_default = "const float LN_SCALE_MIN = -12.0;\nconst float LN_SCALE_MAX = 9.0;\n\nconst uint SPLAT_TEX_WIDTH_BITS = 11u;\nconst uint SPLAT_TEX_HEIGHT_BITS = 11u;\nconst uint SPLAT_TEX_DEPTH_BITS = 11u;\nconst uint SPLAT_TEX_LAYER_BITS = SPLAT_TEX_WIDTH_BITS + SPLAT_TEX_HEIGHT_BITS;\n\nconst uint SPLAT_TEX_WIDTH = 1u << SPLAT_TEX_WIDTH_BITS;\nconst uint SPLAT_TEX_HEIGHT = 1u << SPLAT_TEX_HEIGHT_BITS;\nconst uint SPLAT_TEX_DEPTH = 1u << SPLAT_TEX_DEPTH_BITS;\n\nconst uint SPLAT_TEX_WIDTH_MASK = SPLAT_TEX_WIDTH - 1u;\nconst uint SPLAT_TEX_HEIGHT_MASK = SPLAT_TEX_HEIGHT - 1u;\nconst uint SPLAT_TEX_DEPTH_MASK = SPLAT_TEX_DEPTH - 1u;\n\nconst uint F16_INF = 0x7c00u;\nconst float PI = 3.1415926535897932384626433832795;\n\nconst float INFINITY = 1.0 / 0.0;\nconst float NEG_INFINITY = -INFINITY;\n\nfloat sqr(float x) {\n return x * x;\n}\n\nfloat pow4(float x) {\n float x2 = x * x;\n return x2 * x2;\n}\n\nfloat pow8(float x) {\n float x4 = pow4(x);\n return x4 * x4;\n}\n\nvec3 srgbToLinear(vec3 rgb) {\n return pow(rgb, vec3(2.2));\n}\n\nvec3 linearToSrgb(vec3 rgb) {\n return pow(rgb, vec3(1.0 / 2.2));\n}\n\nuint encodeQuatOctXy88R8(vec4 q) {\n \n if (q.w < 0.0) {\n q = -q;\n }\n \n float theta = 2.0 * acos(q.w);\n float halfTheta = theta * 0.5;\n float s = sin(halfTheta);\n \n vec3 axis = (abs(s) < 1e-6) ? vec3(1.0, 0.0, 0.0) : q.xyz / s;\n \n \n \n float sum = abs(axis.x) + abs(axis.y) + abs(axis.z);\n vec2 p = vec2(axis.x, axis.y) / sum;\n \n if (axis.z < 0.0) {\n float oldPx = p.x;\n p.x = (1.0 - abs(p.y)) * (p.x >= 0.0 ? 1.0 : -1.0);\n p.y = (1.0 - abs(oldPx)) * (p.y >= 0.0 ? 1.0 : -1.0);\n }\n \n float u_f = p.x * 0.5 + 0.5;\n float v_f = p.y * 0.5 + 0.5;\n \n uint quantU = uint(clamp(round(u_f * 255.0), 0.0, 255.0));\n uint quantV = uint(clamp(round(v_f * 255.0), 0.0, 255.0));\n \n \n \n uint angleInt = uint(clamp(round((theta / 3.14159265359) * 255.0), 0.0, 255.0));\n \n \n return (angleInt << 16u) | (quantV << 8u) | quantU;\n}\n\nvec4 decodeQuatOctXy88R8(uint encoded) {\n \n uint quantU = encoded & uint(0xFFu); \n uint quantV = (encoded >> 8u) & uint(0xFFu); \n uint angleInt = encoded >> 16u; \n\n \n float u_f = float(quantU) / 255.0;\n float v_f = float(quantV) / 255.0;\n vec2 f = vec2(u_f * 2.0 - 1.0, v_f * 2.0 - 1.0);\n\n vec3 axis = vec3(f.xy, 1.0 - abs(f.x) - abs(f.y));\n float t = max(-axis.z, 0.0);\n axis.x += (axis.x >= 0.0) ? -t : t;\n axis.y += (axis.y >= 0.0) ? -t : t;\n axis = normalize(axis);\n \n \n float theta = (float(angleInt) / 255.0) * 3.14159265359;\n float halfTheta = theta * 0.5;\n float s = sin(halfTheta);\n float w = cos(halfTheta);\n \n return vec4(axis * s, w);\n}\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\nuvec4 packSplatEncoding(\n vec3 center, vec3 scales, vec4 quaternion, vec4 rgba, vec4 rgbMinMaxLnScaleMinMax\n) {\n float rgbMin = rgbMinMaxLnScaleMinMax.x;\n float rgbMax = rgbMinMaxLnScaleMinMax.y;\n vec3 encRgb = (rgba.rgb - vec3(rgbMin)) / (rgbMax - rgbMin);\n uvec4 uRgba = uvec4(round(clamp(vec4(encRgb, rgba.a) * 255.0, 0.0, 255.0)));\n\n uint uQuat = encodeQuatOctXy88R8(quaternion);\n \n \n uvec3 uQuat3 = uvec3(uQuat & 0xffu, (uQuat >> 8u) & 0xffu, (uQuat >> 16u) & 0xffu);\n\n \n float lnScaleMin = rgbMinMaxLnScaleMinMax.z;\n float lnScaleMax = rgbMinMaxLnScaleMinMax.w;\n float lnScaleScale = 254.0 / (lnScaleMax - lnScaleMin);\n uvec3 uScales = uvec3(\n (scales.x == 0.0) ? 0u : uint(round(clamp((log(scales.x) - lnScaleMin) * lnScaleScale, 0.0, 254.0))) + 1u,\n (scales.y == 0.0) ? 0u : uint(round(clamp((log(scales.y) - lnScaleMin) * lnScaleScale, 0.0, 254.0))) + 1u,\n (scales.z == 0.0) ? 0u : uint(round(clamp((log(scales.z) - lnScaleMin) * lnScaleScale, 0.0, 254.0))) + 1u\n );\n\n \n uint word0 = uRgba.r | (uRgba.g << 8u) | (uRgba.b << 16u) | (uRgba.a << 24u);\n uint word1 = packHalf2x16(center.xy);\n uint word2 = packHalf2x16(vec2(center.z, 0.0)) | (uQuat3.x << 16u) | (uQuat3.y << 24u);\n uint word3 = uScales.x | (uScales.y << 8u) | (uScales.z << 16u) | (uQuat3.z << 24u);\n return uvec4(word0, word1, word2, word3);\n}\n\nuvec4 packSplat(vec3 center, vec3 scales, vec4 quaternion, vec4 rgba) {\n return packSplatEncoding(center, scales, quaternion, rgba, vec4(0.0, 1.0, LN_SCALE_MIN, LN_SCALE_MAX));\n}\n\nvoid unpackSplatEncoding(uvec4 packed, out vec3 center, out vec3 scales, out vec4 quaternion, out vec4 rgba, vec4 rgbMinMaxLnScaleMinMax) {\n uint word0 = packed.x, word1 = packed.y, word2 = packed.z, word3 = packed.w;\n\n uvec4 uRgba = uvec4(word0 & 0xffu, (word0 >> 8u) & 0xffu, (word0 >> 16u) & 0xffu, (word0 >> 24u) & 0xffu);\n float rgbMin = rgbMinMaxLnScaleMinMax.x;\n float rgbMaxLine truncated
var splatFragment_default = "precision highp float;\nprecision highp int;\n\n#include <splatDefines>\n\nuniform float near;\nuniform float far;\nuniform bool encodeLinear;\nuniform float time;\nuniform bool debugFlag;\nuniform float maxStdDev;\nuniform float minAlpha;\nuniform bool stochastic;\nuniform bool disableFalloff;\nuniform float falloff;\n\nuniform bool splatTexEnable;\nuniform sampler3D splatTexture;\nuniform mat2 splatTexMul;\nuniform vec2 splatTexAdd;\nuniform float splatTexNear;\nuniform float splatTexFar;\nuniform float splatTexMid;\n\nout vec4 fragColor;\n\nin vec4 vRgba;\nin vec2 vSplatUv;\nin vec3 vNdc;\nflat in uint vSplatIndex;\n\nvoid main() {\n vec4 rgba = vRgba;\n\n float z = dot(vSplatUv, vSplatUv);\n if (!splatTexEnable) {\n if (z > (maxStdDev * maxStdDev)) {\n discard;\n }\n } else {\n vec2 uv = splatTexMul * vSplatUv + splatTexAdd;\n float ndcZ = vNdc.z;\n float depth = (2.0 * near * far) / (far + near - ndcZ * (far - near));\n float clampedFar = max(splatTexFar, splatTexNear);\n float clampedDepth = clamp(depth, splatTexNear, clampedFar);\n float logDepth = log2(clampedDepth + 1.0);\n float logNear = log2(splatTexNear + 1.0);\n float logFar = log2(clampedFar + 1.0);\n\n float texZ;\n if (splatTexMid > 0.0) {\n float clampedMid = clamp(splatTexMid, splatTexNear, clampedFar);\n float logMid = log2(clampedMid + 1.0);\n texZ = (clampedDepth <= clampedMid) ?\n (0.5 * ((logDepth - logNear) / (logMid - logNear))) :\n (0.5 * ((logDepth - logMid) / (logFar - logMid)) + 0.5);\n } else {\n texZ = (logDepth - logNear) / (logFar - logNear);\n }\n\n vec4 modulate = texture(splatTexture, vec3(uv, 1.0 - texZ));\n rgba *= modulate;\n }\n\n rgba.a *= mix(1.0, exp(-0.5 * z), falloff);\n\n if (rgba.a < minAlpha) {\n discard;\n }\n if (encodeLinear) {\n rgba.rgb = srgbToLinear(rgba.rgb);\n }\n\n if (stochastic) {\n const bool STEADY = false;\n uint uTime = STEADY ? 0u : floatBitsToUint(time);\n uvec2 coord = uvec2(gl_FragCoord.xy);\n uint state = uTime + 0x9e3779b9u * coord.x + 0x85ebca6bu * coord.y + 0xc2b2ae35u * uint(vSplatIndex);\n state = state * 747796405u + 2891336453u;\n uint hash = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;\n hash = (hash >> 22u) ^ hash;\n float rand = float(hash) / 4294967296.0;\n if (rand < rgba.a) {\n fragColor = vec4(rgba.rgb, 1.0);\n } else {\n discard;\n }\n } else {\n #ifdef PREMULTIPLIED_ALPHA\n fragColor = vec4(rgba.rgb * rgba.a, rgba.a);\n #else\n fragColor = rgba;\n #endif\n }\n}";
var splatVertex_default = "precision highp float;\nprecision highp int;\nprecision highp usampler2DArray;\n\n#include <splatDefines>\n\nattribute uint splatIndex;\n\nout vec4 vRgba;\nout vec2 vSplatUv;\nout vec3 vNdc;\nflat out uint vSplatIndex;\n\nuniform vec2 renderSize;\nuniform uint numSplats;\nuniform vec4 renderToViewQuat;\nuniform vec3 renderToViewPos;\nuniform float maxStdDev;\nuniform float maxPixelRadius;\nuniform float time;\nuniform float deltaTime;\nuniform bool debugFlag;\nuniform float minAlpha;\nuniform bool stochastic;\nuniform bool enable2DGS;\nuniform float blurAmount;\nuniform float preBlurAmount;\nuniform float focalDistance;\nuniform float apertureAngle;\nuniform float clipXY;\nuniform float focalAdjustment;\n\nuniform usampler2DArray packedSplats;\nuniform vec4 rgbMinMaxLnScaleMinMax;\n\nvoid main() {\n \n gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n\n if (uint(gl_InstanceID) >= numSplats) {\n return;\n }\n\n ivec3 texCoord;\n if (stochastic) {\n texCoord = ivec3(\n uint(gl_InstanceID) & SPLAT_TEX_WIDTH_MASK,\n (uint(gl_InstanceID) >> SPLAT_TEX_WIDTH_BITS) & SPLAT_TEX_HEIGHT_MASK,\n (uint(gl_InstanceID) >> SPLAT_TEX_LAYER_BITS)\n );\n } else {\n if (splatIndex == 0xffffffffu) {\n \n return;\n }\n texCoord = ivec3(\n splatIndex & SPLAT_TEX_WIDTH_MASK,\n (splatIndex >> SPLAT_TEX_WIDTH_BITS) & SPLAT_TEX_HEIGHT_MASK,\n splatIndex >> SPLAT_TEX_LAYER_BITS\n );\n }\n uvec4 packed = texelFetch(packedSplats, texCoord, 0);\n\n vec3 center, scales;\n vec4 quaternion, rgba;\n unpackSplatEncoding(packed, center, scales, quaternion, rgba, rgbMinMaxLnScaleMinMax);\n\n if (rgba.a < minAlpha) {\n return;\n }\n bvec3 zeroScales = equal(scales, vec3(0.0));\n if (all(zeroScales)) {\n return;\n }\n\n \n vec3 viewCenter = quatVec(renderToViewQuat, center) + renderToViewPos;\n\n \n if (viewCenter.z >= 0.0) {\n return;\n }\n\n \n vec4 clipCenter = projectionMatrix * vec4(viewCenter, 1.0);\n\n \n if (abs(clipCenter.z) >= clipCenter.w) {\n return;\n }\n\n \n float clip = clipXY * clipCenter.w;\n if (abs(clipCenter.x) > clip || abs(clipCenter.y) > clip) {\n return;\n }\n\n \n vSplatIndex = splatIndex;\n\n \n vec4 viewQuaternion = quatQuat(renderToViewQuat, quaternion);\n\n if (enable2DGS && any(zeroScales)) {\n vRgba = rgba;\n vSplatUv = position.xy * maxStdDev;\n\n vec3 offset;\n if (zeroScales.z) {\n offset = vec3(vSplatUv.xy * scales.xy, 0.0);\n } else if (zeroScales.y) {\n offset = vec3(vSplatUv.x * scales.x, 0.0, vSplatUv.y * scales.z);\n } else {\n offset = vec3(0.0, vSplatUv.xy * scales.yz);\n }\n\n vec3 viewPos = viewCenter + quatVec(viewQuaternion, offset);\n gl_Position = projectionMatrix * vec4(viewPos, 1.0);\n vNdc = gl_Position.xyz / gl_Position.w;\n return;\n }\n\n \n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n \n mat3 RS = scaleQuaternionToMatrix(scales, viewQuaternion);\n mat3 cov3D = RS * transpose(RS);\n\n \n vec2 scaledRenderSize = renderSize * focalAdjustment;\n vec2 focal = 0.5 * scaledRenderSize * vec2(projectionMatrix[0][0], projectionMatrix[1][1]);\n\n mat3 J;\n if(isOrthographic) {\n J = mat3(\n focal.x, 0.0, 0.0,\n 0.0, focal.y, 0.0,\n 0.0, 0.0, 0.0\n );\n } else {\n float invZ = 1.0 / viewCenter.z;\n vec2 J1 = focal * invZ;\n vec2 J2 = -(J1 * viewCenter.xy) * invZ;\n J = mat3(\n J1.x, 0.0, J2.x,\n 0.0, J1.y, J2.y,\n 0.0, 0.0, 0.0\n );\n }\n\n \n \n \n \n \n \n \n mat3 cov2D = transpose(J) * cov3D * J;\n float a = cov2D[0][0];\n float d = cov2D[1][1];\n float b = cov2D[0][1];\n\n \n a += preBlurAmount;\n d += preBlurAmount;\n\n float fullBlurAmount = blurAmount;\n if ((focalDistance > 0.0) && (apertureAngle > 0.0)) {\n float focusRadius = maxPixelRadius;\n if (viewCenter.z < 0.0) {\n float focusBlur = abs((-viewCenter.z - focalDistance) / viewCenter.z);\n float apertureRadius = focal.x * tan(0.5 * apertureAngle);\n focusRadius = focusBlur * apertureRadius;\n }\n fullBlurAmount = clamp(sqr(focusRadius), blurAmount, sqr(maxPixelRadius));\n }\n\n \n float detOrig = a * d - b * b;\n a += fullBlurAmount;\n d += fullBlurAmount;\n float det = a * d - b * b;\n\n \n float blurAdjust = sqrt(max(0.0, detOrig / det));\n rgba.a *= blurAdjust;\n if (rgba.a < minAlpha) {\n return;\n }\n\n \n float eigenAvg = 0.5 * (a + d);\n float eigenDelta = sqrt(max(0.0, eigenAvg * eigenAvg - det));\n float eigen1 = Line truncated
var splatVertex_default = "precision highp float;\nprecision highp int;\nprecision highp usampler2DArray;\n\n#include <splatDefines>\n\nattribute uint splatIndex;\n\nout vec4 vRgba;\nout vec2 vSplatUv;\nout vec3 vNdc;\nflat out uint vSplatIndex;\n\nuniform vec2 renderSize;\nuniform uint numSplats;\nuniform vec4 renderToViewQuat;\nuniform vec3 renderToViewPos;\nuniform float maxStdDev;\nuniform float minPixelRadius;\nuniform float maxPixelRadius;\nuniform float time;\nuniform float deltaTime;\nuniform bool debugFlag;\nuniform float minAlpha;\nuniform bool stochastic;\nuniform bool enable2DGS;\nuniform float blurAmount;\nuniform float preBlurAmount;\nuniform float focalDistance;\nuniform float apertureAngle;\nuniform float clipXY;\nuniform float focalAdjustment;\n\nuniform usampler2DArray packedSplats;\nuniform vec4 rgbMinMaxLnScaleMinMax;\n\nvoid main() {\n \n gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n\n if (uint(gl_InstanceID) >= numSplats) {\n return;\n }\n\n ivec3 texCoord;\n if (stochastic) {\n texCoord = ivec3(\n uint(gl_InstanceID) & SPLAT_TEX_WIDTH_MASK,\n (uint(gl_InstanceID) >> SPLAT_TEX_WIDTH_BITS) & SPLAT_TEX_HEIGHT_MASK,\n (uint(gl_InstanceID) >> SPLAT_TEX_LAYER_BITS)\n );\n } else {\n if (splatIndex == 0xffffffffu) {\n \n return;\n }\n texCoord = ivec3(\n splatIndex & SPLAT_TEX_WIDTH_MASK,\n (splatIndex >> SPLAT_TEX_WIDTH_BITS) & SPLAT_TEX_HEIGHT_MASK,\n splatIndex >> SPLAT_TEX_LAYER_BITS\n );\n }\n uvec4 packed = texelFetch(packedSplats, texCoord, 0);\n\n vec3 center, scales;\n vec4 quaternion, rgba;\n unpackSplatEncoding(packed, center, scales, quaternion, rgba, rgbMinMaxLnScaleMinMax);\n\n if (rgba.a < minAlpha) {\n return;\n }\n bvec3 zeroScales = equal(scales, vec3(0.0));\n if (all(zeroScales)) {\n return;\n }\n\n \n vec3 viewCenter = quatVec(renderToViewQuat, center) + renderToViewPos;\n\n \n if (viewCenter.z >= 0.0) {\n return;\n }\n\n \n vec4 clipCenter = projectionMatrix * vec4(viewCenter, 1.0);\n\n \n if (abs(clipCenter.z) >= clipCenter.w) {\n return;\n }\n\n \n float clip = clipXY * clipCenter.w;\n if (abs(clipCenter.x) > clip || abs(clipCenter.y) > clip) {\n return;\n }\n\n \n vSplatIndex = splatIndex;\n\n \n vec4 viewQuaternion = quatQuat(renderToViewQuat, quaternion);\n\n if (enable2DGS && any(zeroScales)) {\n vRgba = rgba;\n vSplatUv = position.xy * maxStdDev;\n\n vec3 offset;\n if (zeroScales.z) {\n offset = vec3(vSplatUv.xy * scales.xy, 0.0);\n } else if (zeroScales.y) {\n offset = vec3(vSplatUv.x * scales.x, 0.0, vSplatUv.y * scales.z);\n } else {\n offset = vec3(0.0, vSplatUv.xy * scales.yz);\n }\n\n vec3 viewPos = viewCenter + quatVec(viewQuaternion, offset);\n gl_Position = projectionMatrix * vec4(viewPos, 1.0);\n vNdc = gl_Position.xyz / gl_Position.w;\n return;\n }\n\n \n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n \n mat3 RS = scaleQuaternionToMatrix(scales, viewQuaternion);\n mat3 cov3D = RS * transpose(RS);\n\n \n vec2 scaledRenderSize = renderSize * focalAdjustment;\n vec2 focal = 0.5 * scaledRenderSize * vec2(projectionMatrix[0][0], projectionMatrix[1][1]);\n\n mat3 J;\n if(isOrthographic) {\n J = mat3(\n focal.x, 0.0, 0.0,\n 0.0, focal.y, 0.0,\n 0.0, 0.0, 0.0\n );\n } else {\n float invZ = 1.0 / viewCenter.z;\n vec2 J1 = focal * invZ;\n vec2 J2 = -(J1 * viewCenter.xy) * invZ;\n J = mat3(\n J1.x, 0.0, J2.x,\n 0.0, J1.y, J2.y,\n 0.0, 0.0, 0.0\n );\n }\n\n \n \n \n \n \n \n \n mat3 cov2D = transpose(J) * cov3D * J;\n float a = cov2D[0][0];\n float d = cov2D[1][1];\n float b = cov2D[0][1];\n\n \n a += preBlurAmount;\n d += preBlurAmount;\n\n float fullBlurAmount = blurAmount;\n if ((focalDistance > 0.0) && (apertureAngle > 0.0)) {\n float focusRadius = maxPixelRadius;\n if (viewCenter.z < 0.0) {\n float focusBlur = abs((-viewCenter.z - focalDistance) / viewCenter.z);\n float apertureRadius = focal.x * tan(0.5 * apertureAngle);\n focusRadius = focusBlur * apertureRadius;\n }\n fullBlurAmount = clamp(sqr(focusRadius), blurAmount, sqr(maxPixelRadius));\n }\n\n \n float detOrig = a * d - b * b;\n a += fullBlurAmount;\n d += fullBlurAmount;\n float det = a * d - b * b;\n\n \n float blurAdjust = sqrt(max(0.0, detOrig / det));\n rgba.a *= blurAdjust;\n if (rgba.a < minAlpha) {\n return;\n }\n\n \n float eigenAvg = 0.5 * (a + d);\n float eigenDelta = sqrt(max(0.0, eigenAvg * eigenAvLine truncated
let shaders = null;
function getShaders() {
if (!shaders) {
@@ -10407,6 +10418,7 @@ const _SparkRenderer = class _SparkRenderer extends THREE.Mesh {
this.needsUpdate = false;
this.originDistance = options.originDistance ?? 1;
this.maxStdDev = options.maxStdDev ?? Math.sqrt(8);
this.minPixelRadius = options.minPixelRadius ?? 0;
this.maxPixelRadius = options.maxPixelRadius ?? 512;
this.minAlpha = options.minAlpha ?? 0.5 * (1 / 255);
this.enable2DGS = options.enable2DGS ?? false;
@@ -10449,6 +10461,8 @@ const _SparkRenderer = class _SparkRenderer extends THREE.Mesh {
renderToViewPos: { value: new THREE.Vector3() },
// Maximum distance (in stddevs) from Gsplat center to render
maxStdDev: { value: 1 },
// Minimum pixel radius for splat rendering
minPixelRadius: { value: 0 },
// Maximum pixel radius for splat rendering
maxPixelRadius: { value: 512 },
// Minimum alpha value for splat rendering
@@ -10583,6 +10597,7 @@ const _SparkRenderer = class _SparkRenderer extends THREE.Mesh {
this.uniforms.far.value = typedCamera.far;
this.uniforms.encodeLinear.value = viewpoint.encodeLinear;
this.uniforms.maxStdDev.value = this.maxStdDev;
this.uniforms.minPixelRadius.value = this.minPixelRadius;
this.uniforms.maxPixelRadius.value = this.maxPixelRadius;
this.uniforms.minAlpha.value = this.minAlpha;
this.uniforms.stochastic.value = viewpoint.stochastic;
@@ -11279,9 +11294,23 @@ function decodeKsplat(fileBytes, initNumSplats, splatCallback, shCallback) {
}
class SpzReader {
constructor({ fileBytes }) {
this.version = -1;
this.numSplats = 0;
this.shDegree = 0;
this.fractionalBits = 0;
this.flags = 0;
this.flagAntiAlias = false;
this.reserved = 0;
this.headerParsed = false;
this.parsed = false;
this.fileBytes = fileBytes instanceof ArrayBuffer ? new Uint8Array(fileBytes) : fileBytes;
this.reader = new GunzipReader({ fileBytes: this.fileBytes });
const header = new DataView(this.reader.read(16).buffer);
}
async parseHeader() {
if (this.headerParsed) {
throw new Error("SPZ file header already parsed");
}
const header = new DataView((await this.reader.read(16)).buffer);
if (header.getUint32(0, true) !== 1347635022) {
throw new Error("Invalid SPZ file");
}
@@ -11295,15 +11324,19 @@ class SpzReader {
this.flags = header.getUint8(14);
this.flagAntiAlias = (this.flags & 1) !== 0;
this.reserved = header.getUint8(15);
this.headerParsed = true;
this.parsed = false;
}
parseSplats(centerCallback, alphaCallback, rgbCallback, scalesCallback, quatCallback, shCallback) {
async parseSplats(centerCallback, alphaCallback, rgbCallback, scalesCallback, quatCallback, shCallback) {
if (!this.headerParsed) {
throw new Error("SPZ file header must be parsed first");
}
if (this.parsed) {
throw new Error("SPZ file already parsed");
}
this.parsed = true;
if (this.version === 1) {
const centerBytes = this.reader.read(this.numSplats * 3 * 2);
const centerBytes = await this.reader.read(this.numSplats * 3 * 2);
const centerUint16 = new Uint16Array(centerBytes.buffer);
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 3;
@@ -11314,7 +11347,7 @@ class SpzReader {
}
} else if (this.version === 2 || this.version === 3) {
const fixed = 1 << this.fractionalBits;
const centerBytes = this.reader.read(this.numSplats * 3 * 3);
const centerBytes = await this.reader.read(this.numSplats * 3 * 3);
for (let i = 0; i < this.numSplats; i++) {
const i9 = i * 9;
const x = ((centerBytes[i9 + 2] << 24 | centerBytes[i9 + 1] << 16 | centerBytes[i9] << 8) >> 8) / fixed;
@@ -11326,13 +11359,13 @@ class SpzReader {
throw new Error("Unreachable");
}
{
const bytes = this.reader.read(this.numSplats);
const bytes = await this.reader.read(this.numSplats);
for (let i = 0; i < this.numSplats; i++) {
alphaCallback == null ? void 0 : alphaCallback(i, bytes[i] / 255);
}
}
{
const rgbBytes = this.reader.read(this.numSplats * 3);
const rgbBytes = await this.reader.read(this.numSplats * 3);
const scale = SH_C0 / 0.15;
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 3;
@@ -11343,7 +11376,7 @@ class SpzReader {
}
}
{
const scalesBytes = this.reader.read(this.numSplats * 3);
const scalesBytes = await this.reader.read(this.numSplats * 3);
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 3;
const scaleX = Math.exp(scalesBytes[i3] / 16 - 10);
@@ -11354,7 +11387,7 @@ class SpzReader {
}
if (this.version === 3) {
const maxValue = 1 / Math.sqrt(2);
const quatBytes = this.reader.read(this.numSplats * 4);
const quatBytes = await this.reader.read(this.numSplats * 4);
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 4;
const quaternion = [0, 0, 0, 0];
@@ -11390,7 +11423,7 @@ class SpzReader {
);
}
} else {
const quatBytes = this.reader.read(this.numSplats * 3);
const quatBytes = await this.reader.read(this.numSplats * 3);
for (let i = 0; i < this.numSplats; i++) {
const i3 = i * 3;
const quatX = quatBytes[i3] / 127.5 - 1;
@@ -11406,7 +11439,7 @@ class SpzReader {
const sh1 = new Float32Array(3 * 3);
const sh2 = this.shDegree >= 2 ? new Float32Array(5 * 3) : void 0;
const sh3 = this.shDegree >= 3 ? new Float32Array(7 * 3) : void 0;
const shBytes = this.reader.read(
const shBytes = await this.reader.read(
this.numSplats * SH_DEGREE_TO_VECS[this.shDegree] * 3
);
let offset = 0;
@@ -11685,6 +11718,7 @@ async function transcodeSpz(input) {
}
case SplatFileType.SPZ: {
const spz2 = new SpzReader({ fileBytes: input2.fileBytes });
await spz2.parseHeader();
const mapping = new Int32Array(spz2.numSplats);
mapping.fill(-1);
const centers = new Float32Array(spz2.numSplats * 3);
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"spark.module.js","sources":["../node_modules/three/examples/jsm/postprocessing/Pass.js","../node_modules/fflate/esm/browser.js","../rust/spark-internal-rs/pkg/spark_internal_rs.js","../src/defines.ts","../src/dyno/types.ts","../src/dyno/value.ts","../src/dyno/base.ts","../src/dyno/splats.ts","../src/dyno/output.ts","../src/dyno/uniforms.ts","../src/utils.ts","../src/dyno/program.ts","../src/dyno/mathTypes.ts","../src/dyno/math.ts","../src/dyno/logic.ts","../src/dyno/convert.ts","../src/dyno/vecmat.ts","../src/dyno/util.ts","../src/dyno/transform.ts","../src/dyno/control.ts","../src/dyno/texture.ts","../src/dyno/trig.ts","../src/shaders/computeVec4.glsl","../src/Readback.ts","../src/RgbaArray.ts","../src/SplatEdit.ts","../src/SplatGenerator.ts","../src/SplatMesh.ts","../src/ply.ts","../src/splatWorker.ts","../src/SplatLoader.ts","../src/shaders/computeUvec4.glsl","../src/PackedSplats.ts","../src/SplatGeometry.ts","../src/SparkViewpoint.ts","../src/SplatAccumulator.ts","../src/shaders/splatDefines.glsl","../src/shaders/splatFragment.glsl","../src/shaders/splatVertex.glsl","../src/shaders.ts","../src/SparkRenderer.ts","../src/antisplat.ts","../src/ksplat.ts","../src/spz.ts","../src/SplatSkinning.ts","../src/splatConstructors.ts","../src/generators/static.ts","../src/generators/snow.ts","../src/modifiers/normalColor.ts","../src/modifiers/depthColor.ts","../src/vrButton.ts","../src/hands.ts","../src/controls.ts"],"sourcesContent":["import {\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tOrthographicCamera,\n\tMesh\n} from 'three';\n\n/**\n * Abstract base class for all post processing passes.\n *\n * This module is only relevant for post processing with {@link WebGLRenderer}.\n *\n * @abstract\n * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js';\n */\nclass Pass {\n\n\t/**\n\t * Constructs a new pass.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPass = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass is processed by the composer.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass indicates to swap read and write buffer after rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.needsSwap = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass clears its buffer before rendering\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clear = false;\n\n\t\t/**\n\t\t * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers\n\t\t * pass chain gets automatically rendered to screen, no matter how this property is configured.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.renderToScreen = false;\n\n\t}\n\n\t/**\n\t * Sets the size of the pass.\n\t *\n\t * @abstract\n\t * @param {number} width - The width to set.\n\t * @param {number} height - The height to set.\n\t */\n\tsetSize( /* width, height */ ) {}\n\n\t/**\n\t * This method holds the render logic of a pass. It must be implemented in all derived classes.\n\t *\n\t * @abstract\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering\n\t * destination for the pass.\n\t * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the\n\t * previous pass from this buffer.\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @param {boolean} maskActive - Whether masking is active or not.\n\t */\n\trender( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n\t\tconsole.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the pass is no longer used in your app.\n\t *\n\t * @abstract\n\t */\n\tdispose() {}\n\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass FullscreenTriangleGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new FullscreenTriangleGeometry();\n\n\n/**\n * This module is a helper for passes which need to render a full\n * screen effect which is quite common in context of post processing.\n *\n * The intended usage is to reuse a single full screen quad for rendering\n * subsequent passes by just reassigning the `material` reference.\n *\n * This module can only be used with {@link WebGLReLine truncated
{"version":3,"file":"spark.module.js","sources":["../node_modules/three/examples/jsm/postprocessing/Pass.js","../node_modules/fflate/esm/browser.js","../rust/spark-internal-rs/pkg/spark_internal_rs.js","../src/defines.ts","../src/dyno/types.ts","../src/dyno/value.ts","../src/dyno/base.ts","../src/dyno/splats.ts","../src/dyno/output.ts","../src/dyno/uniforms.ts","../src/utils.ts","../src/dyno/program.ts","../src/dyno/mathTypes.ts","../src/dyno/math.ts","../src/dyno/logic.ts","../src/dyno/convert.ts","../src/dyno/vecmat.ts","../src/dyno/util.ts","../src/dyno/transform.ts","../src/dyno/control.ts","../src/dyno/texture.ts","../src/dyno/trig.ts","../src/shaders/computeVec4.glsl","../src/Readback.ts","../src/RgbaArray.ts","../src/SplatEdit.ts","../src/SplatGenerator.ts","../src/SplatMesh.ts","../src/ply.ts","../src/splatWorker.ts","../src/SplatLoader.ts","../src/shaders/computeUvec4.glsl","../src/PackedSplats.ts","../src/SplatGeometry.ts","../src/SparkViewpoint.ts","../src/SplatAccumulator.ts","../src/shaders/splatDefines.glsl","../src/shaders/splatFragment.glsl","../src/shaders/splatVertex.glsl","../src/shaders.ts","../src/SparkRenderer.ts","../src/antisplat.ts","../src/ksplat.ts","../src/spz.ts","../src/SplatSkinning.ts","../src/splatConstructors.ts","../src/generators/static.ts","../src/generators/snow.ts","../src/modifiers/normalColor.ts","../src/modifiers/depthColor.ts","../src/vrButton.ts","../src/hands.ts","../src/controls.ts"],"sourcesContent":["import {\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tOrthographicCamera,\n\tMesh\n} from 'three';\n\n/**\n * Abstract base class for all post processing passes.\n *\n * This module is only relevant for post processing with {@link WebGLRenderer}.\n *\n * @abstract\n * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js';\n */\nclass Pass {\n\n\t/**\n\t * Constructs a new pass.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPass = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass is processed by the composer.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass indicates to swap read and write buffer after rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.needsSwap = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass clears its buffer before rendering\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clear = false;\n\n\t\t/**\n\t\t * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers\n\t\t * pass chain gets automatically rendered to screen, no matter how this property is configured.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.renderToScreen = false;\n\n\t}\n\n\t/**\n\t * Sets the size of the pass.\n\t *\n\t * @abstract\n\t * @param {number} width - The width to set.\n\t * @param {number} height - The height to set.\n\t */\n\tsetSize( /* width, height */ ) {}\n\n\t/**\n\t * This method holds the render logic of a pass. It must be implemented in all derived classes.\n\t *\n\t * @abstract\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering\n\t * destination for the pass.\n\t * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the\n\t * previous pass from this buffer.\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @param {boolean} maskActive - Whether masking is active or not.\n\t */\n\trender( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n\t\tconsole.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the pass is no longer used in your app.\n\t *\n\t * @abstract\n\t */\n\tdispose() {}\n\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass FullscreenTriangleGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new FullscreenTriangleGeometry();\n\n\n/**\n * This module is a helper for passes which need to render a full\n * screen effect which is quite common in context of post processing.\n *\n * The intended usage is to reuse a single full screen quad for rendering\n * subsequent passes by just reassigning the `material` reference.\n *\n * This module can only be used with {@link WebGLReLine truncated
+651 -629
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"spark.module.min.js","sources":["../node_modules/three/examples/jsm/postprocessing/Pass.js","../node_modules/fflate/esm/browser.js","../rust/spark-internal-rs/pkg/spark_internal_rs.js","../src/defines.ts","../src/dyno/types.ts","../src/dyno/value.ts","../src/dyno/base.ts","../src/dyno/splats.ts","../src/dyno/output.ts","../src/dyno/uniforms.ts","../src/utils.ts","../src/dyno/program.ts","../src/dyno/mathTypes.ts","../src/dyno/math.ts","../src/dyno/logic.ts","../src/dyno/convert.ts","../src/dyno/vecmat.ts","../src/dyno/util.ts","../src/dyno/transform.ts","../src/dyno/control.ts","../src/dyno/texture.ts","../src/dyno/trig.ts","../src/shaders/computeVec4.glsl","../src/Readback.ts","../src/RgbaArray.ts","../src/SplatEdit.ts","../src/SplatGenerator.ts","../src/SplatMesh.ts","../src/ply.ts","../src/splatWorker.ts","../src/SplatLoader.ts","../src/shaders/computeUvec4.glsl","../src/PackedSplats.ts","../src/SplatGeometry.ts","../src/SparkViewpoint.ts","../src/SplatAccumulator.ts","../src/shaders/splatDefines.glsl","../src/shaders/splatFragment.glsl","../src/shaders/splatVertex.glsl","../src/shaders.ts","../src/SparkRenderer.ts","../src/antisplat.ts","../src/ksplat.ts","../src/spz.ts","../src/SplatSkinning.ts","../src/splatConstructors.ts","../src/generators/static.ts","../src/generators/snow.ts","../src/modifiers/normalColor.ts","../src/modifiers/depthColor.ts","../src/vrButton.ts","../src/hands.ts","../src/controls.ts"],"sourcesContent":["import {\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tOrthographicCamera,\n\tMesh\n} from 'three';\n\n/**\n * Abstract base class for all post processing passes.\n *\n * This module is only relevant for post processing with {@link WebGLRenderer}.\n *\n * @abstract\n * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js';\n */\nclass Pass {\n\n\t/**\n\t * Constructs a new pass.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPass = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass is processed by the composer.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass indicates to swap read and write buffer after rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.needsSwap = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass clears its buffer before rendering\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clear = false;\n\n\t\t/**\n\t\t * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers\n\t\t * pass chain gets automatically rendered to screen, no matter how this property is configured.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.renderToScreen = false;\n\n\t}\n\n\t/**\n\t * Sets the size of the pass.\n\t *\n\t * @abstract\n\t * @param {number} width - The width to set.\n\t * @param {number} height - The height to set.\n\t */\n\tsetSize( /* width, height */ ) {}\n\n\t/**\n\t * This method holds the render logic of a pass. It must be implemented in all derived classes.\n\t *\n\t * @abstract\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering\n\t * destination for the pass.\n\t * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the\n\t * previous pass from this buffer.\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @param {boolean} maskActive - Whether masking is active or not.\n\t */\n\trender( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n\t\tconsole.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the pass is no longer used in your app.\n\t *\n\t * @abstract\n\t */\n\tdispose() {}\n\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass FullscreenTriangleGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new FullscreenTriangleGeometry();\n\n\n/**\n * This module is a helper for passes which need to render a full\n * screen effect which is quite common in context of post processing.\n *\n * The intended usage is to reuse a single full screen quad for rendering\n * subsequent passes by just reassigning the `material` reference.\n *\n * This module can only be used with {@link WebLine truncated
{"version":3,"file":"spark.module.min.js","sources":["../node_modules/three/examples/jsm/postprocessing/Pass.js","../node_modules/fflate/esm/browser.js","../rust/spark-internal-rs/pkg/spark_internal_rs.js","../src/defines.ts","../src/dyno/types.ts","../src/dyno/value.ts","../src/dyno/base.ts","../src/dyno/splats.ts","../src/dyno/output.ts","../src/dyno/uniforms.ts","../src/utils.ts","../src/dyno/program.ts","../src/dyno/mathTypes.ts","../src/dyno/math.ts","../src/dyno/logic.ts","../src/dyno/convert.ts","../src/dyno/vecmat.ts","../src/dyno/util.ts","../src/dyno/transform.ts","../src/dyno/control.ts","../src/dyno/texture.ts","../src/dyno/trig.ts","../src/shaders/computeVec4.glsl","../src/Readback.ts","../src/RgbaArray.ts","../src/SplatEdit.ts","../src/SplatGenerator.ts","../src/SplatMesh.ts","../src/ply.ts","../src/splatWorker.ts","../src/SplatLoader.ts","../src/shaders/computeUvec4.glsl","../src/PackedSplats.ts","../src/SplatGeometry.ts","../src/SparkViewpoint.ts","../src/SplatAccumulator.ts","../src/shaders/splatDefines.glsl","../src/shaders/splatFragment.glsl","../src/shaders/splatVertex.glsl","../src/shaders.ts","../src/SparkRenderer.ts","../src/antisplat.ts","../src/ksplat.ts","../src/spz.ts","../src/SplatSkinning.ts","../src/splatConstructors.ts","../src/generators/static.ts","../src/generators/snow.ts","../src/modifiers/normalColor.ts","../src/modifiers/depthColor.ts","../src/vrButton.ts","../src/hands.ts","../src/controls.ts"],"sourcesContent":["import {\n\tBufferGeometry,\n\tFloat32BufferAttribute,\n\tOrthographicCamera,\n\tMesh\n} from 'three';\n\n/**\n * Abstract base class for all post processing passes.\n *\n * This module is only relevant for post processing with {@link WebGLRenderer}.\n *\n * @abstract\n * @three_import import { Pass } from 'three/addons/postprocessing/Pass.js';\n */\nclass Pass {\n\n\t/**\n\t * Constructs a new pass.\n\t */\n\tconstructor() {\n\n\t\t/**\n\t\t * This flag can be used for type testing.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @readonly\n\t\t * @default true\n\t\t */\n\t\tthis.isPass = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass is processed by the composer.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.enabled = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass indicates to swap read and write buffer after rendering.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default true\n\t\t */\n\t\tthis.needsSwap = true;\n\n\t\t/**\n\t\t * If set to `true`, the pass clears its buffer before rendering\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.clear = false;\n\n\t\t/**\n\t\t * If set to `true`, the result of the pass is rendered to screen. The last pass in the composers\n\t\t * pass chain gets automatically rendered to screen, no matter how this property is configured.\n\t\t *\n\t\t * @type {boolean}\n\t\t * @default false\n\t\t */\n\t\tthis.renderToScreen = false;\n\n\t}\n\n\t/**\n\t * Sets the size of the pass.\n\t *\n\t * @abstract\n\t * @param {number} width - The width to set.\n\t * @param {number} height - The height to set.\n\t */\n\tsetSize( /* width, height */ ) {}\n\n\t/**\n\t * This method holds the render logic of a pass. It must be implemented in all derived classes.\n\t *\n\t * @abstract\n\t * @param {WebGLRenderer} renderer - The renderer.\n\t * @param {WebGLRenderTarget} writeBuffer - The write buffer. This buffer is intended as the rendering\n\t * destination for the pass.\n\t * @param {WebGLRenderTarget} readBuffer - The read buffer. The pass can access the result from the\n\t * previous pass from this buffer.\n\t * @param {number} deltaTime - The delta time in seconds.\n\t * @param {boolean} maskActive - Whether masking is active or not.\n\t */\n\trender( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {\n\n\t\tconsole.error( 'THREE.Pass: .render() must be implemented in derived pass.' );\n\n\t}\n\n\t/**\n\t * Frees the GPU-related resources allocated by this instance. Call this\n\t * method whenever the pass is no longer used in your app.\n\t *\n\t * @abstract\n\t */\n\tdispose() {}\n\n}\n\n// Helper for passes that need to fill the viewport with a single quad.\n\nconst _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );\n\n// https://github.com/mrdoob/three.js/pull/21358\n\nclass FullscreenTriangleGeometry extends BufferGeometry {\n\n\tconstructor() {\n\n\t\tsuper();\n\n\t\tthis.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );\n\t\tthis.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );\n\n\t}\n\n}\n\nconst _geometry = new FullscreenTriangleGeometry();\n\n\n/**\n * This module is a helper for passes which need to render a full\n * screen effect which is quite common in context of post processing.\n *\n * The intended usage is to reuse a single full screen quad for rendering\n * subsequent passes by just reassigning the `material` reference.\n *\n * This module can only be used with {@link WebLine truncated
+9
View File
@@ -48,6 +48,11 @@ export type SparkRendererOptions = {
* @default Math.sqrt(8)
*/
maxStdDev?: number;
/**
* Minimum pixel radius for splat rendering.
* @default 0.0
*/
minPixelRadius?: number;
/**
* Maximum pixel radius for splat rendering.
* @default 512.0
@@ -132,6 +137,7 @@ export declare class SparkRenderer extends THREE.Mesh {
needsUpdate: boolean;
originDistance: number;
maxStdDev: number;
minPixelRadius: number;
maxPixelRadius: number;
minAlpha: number;
enable2DGS: boolean;
@@ -196,6 +202,9 @@ export declare class SparkRenderer extends THREE.Mesh {
maxStdDev: {
value: number;
};
minPixelRadius: {
value: number;
};
maxPixelRadius: {
value: number;
};
+28 -1
View File
@@ -58,8 +58,35 @@ export type PcSogsJson = {
files: string[];
};
};
export type PcSogsV2Json = {
version: 2;
count: number;
antialias?: boolean;
means: {
mins: number[];
maxs: number[];
files: string[];
};
scales: {
codebook: number[];
files: string[];
};
quats: {
files: string[];
};
sh0: {
codebook: number[];
files: string[];
};
shN?: {
count: number;
bands: number;
codebook: number[];
files: string[];
};
};
export declare function isPcSogs(input: ArrayBuffer | Uint8Array | string): boolean;
export declare function tryPcSogs(input: ArrayBuffer | Uint8Array | string): PcSogsJson | undefined;
export declare function tryPcSogs(input: ArrayBuffer | Uint8Array | string): PcSogsJson | PcSogsV2Json | undefined;
export declare function tryPcSogsZip(input: ArrayBuffer | Uint8Array): {
name: string;
json: PcSogsJson;
+2 -2
View File
@@ -1,6 +1,6 @@
import { SplatEncoding } from './PackedSplats';
import { PcSogsJson } from './SplatLoader';
export declare function unpackPcSogs(json: PcSogsJson, extraFiles: Record<string, ArrayBuffer>, splatEncoding: SplatEncoding): Promise<{
import { PcSogsJson, PcSogsV2Json } from './SplatLoader';
export declare function unpackPcSogs(json: PcSogsJson | PcSogsV2Json, extraFiles: Record<string, ArrayBuffer>, splatEncoding: SplatEncoding): Promise<{
packedArray: Uint32Array;
numSplats: number;
extra: Record<string, unknown>;
+3 -1
View File
@@ -10,11 +10,13 @@ export declare class SpzReader {
flags: number;
flagAntiAlias: boolean;
reserved: number;
headerParsed: boolean;
parsed: boolean;
constructor({ fileBytes }: {
fileBytes: Uint8Array | ArrayBuffer;
});
parseSplats(centerCallback?: (index: number, x: number, y: number, z: number) => void, alphaCallback?: (index: number, alpha: number) => void, rgbCallback?: (index: number, r: number, g: number, b: number) => void, scalesCallback?: (index: number, scaleX: number, scaleY: number, scaleZ: number) => void, quatCallback?: (index: number, quatX: number, quatY: number, quatZ: number, quatW: number) => void, shCallback?: (index: number, sh1: Float32Array, sh2?: Float32Array, sh3?: Float32Array) => void): void;
parseHeader(): Promise<void>;
parseSplats(centerCallback?: (index: number, x: number, y: number, z: number) => void, alphaCallback?: (index: number, alpha: number) => void, rgbCallback?: (index: number, r: number, g: number, b: number) => void, scalesCallback?: (index: number, scaleX: number, scaleY: number, scaleZ: number) => void, quatCallback?: (index: number, quatX: number, quatY: number, quatZ: number, quatW: number) => void, shCallback?: (index: number, sh1: Float32Array, sh2?: Float32Array, sh3?: Float32Array) => void): Promise<void>;
}
export declare const SPZ_MAGIC = 1347635022;
export declare const SPZ_VERSION = 3;
+2 -4
View File
@@ -1,4 +1,3 @@
import { Gunzip } from 'fflate';
import * as THREE from "three";
export declare function normalize(vec: number[]): number[];
export declare function floatBitsToUint(f: number): number;
@@ -170,14 +169,13 @@ export declare function decompressPartialGzip(fileBytes: Uint8Array, numBytes: n
export declare class GunzipReader {
fileBytes: Uint8Array;
chunkBytes: number;
offset: number;
chunks: Uint8Array[];
totalBytes: number;
gunzip: Gunzip;
reader: ReadableStreamDefaultReader;
constructor({ fileBytes, chunkBytes, }: {
fileBytes: Uint8Array;
chunkBytes?: number;
});
read(numBytes: number): Uint8Array;
read(numBytes: number): Promise<Uint8Array>;
}
export {};