@playcanvas/splat-transform 0.16.1 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +161 -2
- package/bin/cli.mjs +1 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/node-device.d.ts +7 -0
- package/dist/cli/node-file-system.d.ts +16 -0
- package/dist/cli.mjs +16212 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.mjs +1728 -61270
- package/dist/index.mjs.map +1 -1
- package/dist/lib/data-table/combine.d.ts +3 -0
- package/dist/lib/data-table/data-table.d.ts +32 -0
- package/dist/lib/data-table/morton-order.d.ts +3 -0
- package/dist/lib/data-table/summary.d.ts +17 -0
- package/dist/lib/data-table/transform.d.ts +4 -0
- package/dist/lib/gpu/gpu-clustering.d.ts +8 -0
- package/dist/lib/index.d.ts +34 -0
- package/dist/lib/io/read/file-system.d.ts +91 -0
- package/dist/lib/io/read/index.d.ts +5 -0
- package/dist/lib/io/read/memory-file-system.d.ts +22 -0
- package/dist/lib/io/read/url-file-system.d.ts +14 -0
- package/dist/lib/io/read/zip-file-system.d.ts +51 -0
- package/dist/lib/io/write/crc.d.ts +7 -0
- package/dist/lib/io/write/file-system.d.ts +9 -0
- package/dist/lib/io/write/index.d.ts +4 -0
- package/dist/lib/io/write/memory-file-system.d.ts +7 -0
- package/dist/lib/io/write/write-helpers.d.ts +3 -0
- package/dist/lib/io/write/zip-file-system.d.ts +8 -0
- package/dist/lib/process.d.ts +52 -0
- package/dist/lib/read.d.ts +14 -0
- package/dist/lib/readers/decompress-ply.d.ts +5 -0
- package/dist/lib/readers/read-ksplat.d.ts +4 -0
- package/dist/lib/readers/read-lcc.d.ts +5 -0
- package/dist/lib/readers/read-mjs.d.ts +4 -0
- package/dist/lib/readers/read-ply.d.ts +11 -0
- package/dist/lib/readers/read-sog.d.ts +10 -0
- package/dist/lib/readers/read-splat.d.ts +4 -0
- package/dist/lib/readers/read-spz.d.ts +4 -0
- package/dist/lib/spatial/b-tree.d.ts +22 -0
- package/dist/lib/spatial/k-means.d.ts +7 -0
- package/dist/lib/spatial/kd-tree.d.ts +18 -0
- package/dist/lib/types.d.ts +25 -0
- package/dist/lib/utils/base64.d.ts +2 -0
- package/dist/lib/utils/logger.d.ts +66 -0
- package/dist/lib/utils/math.d.ts +2 -0
- package/dist/lib/utils/rotate-sh.d.ts +6 -0
- package/dist/lib/utils/webp-codec.d.ts +21 -0
- package/dist/lib/write.d.ts +16 -0
- package/dist/lib/writers/compressed-chunk.d.ts +14 -0
- package/dist/lib/writers/write-compressed-ply.d.ts +8 -0
- package/dist/lib/writers/write-csv.d.ts +8 -0
- package/dist/lib/writers/write-html.d.ts +13 -0
- package/dist/lib/writers/write-lod.d.ts +14 -0
- package/dist/lib/writers/write-ply.d.ts +8 -0
- package/dist/lib/writers/write-sog.d.ts +18 -0
- package/lib/BUILD.md +1 -1
- package/lib/webp.mjs +1 -1
- package/lib/webp.wasm +0 -0
- package/package.json +28 -12
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare class WebPCodec {
|
|
2
|
+
/**
|
|
3
|
+
* URL to the webp.wasm file. Set this before any SOG read/write operations
|
|
4
|
+
* in browser environments where the default path resolution doesn't work.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* import { WebPCodec } from '@playcanvas/splat-transform';
|
|
8
|
+
* import wasmUrl from '@playcanvas/splat-transform/lib/webp.wasm?url';
|
|
9
|
+
* WebPCodec.wasmUrl = wasmUrl;
|
|
10
|
+
*/
|
|
11
|
+
static wasmUrl: string | null;
|
|
12
|
+
Module: any;
|
|
13
|
+
static create(): Promise<WebPCodec>;
|
|
14
|
+
encodeLosslessRGBA(rgba: Uint8Array, width: number, height: number, stride?: number): any;
|
|
15
|
+
decodeRGBA(webp: Uint8Array): {
|
|
16
|
+
rgba: Uint8Array;
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export { WebPCodec };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DataTable } from './data-table/data-table';
|
|
2
|
+
import { type FileSystem } from './io/write';
|
|
3
|
+
import { Options } from './types';
|
|
4
|
+
import { type DeviceCreator } from './writers/write-sog';
|
|
5
|
+
type OutputFormat = 'csv' | 'sog' | 'sog-bundle' | 'lod' | 'compressed-ply' | 'ply' | 'html' | 'html-bundle';
|
|
6
|
+
type WriteOptions = {
|
|
7
|
+
filename: string;
|
|
8
|
+
outputFormat: OutputFormat;
|
|
9
|
+
dataTable: DataTable;
|
|
10
|
+
envDataTable?: DataTable;
|
|
11
|
+
options: Options;
|
|
12
|
+
createDevice?: DeviceCreator;
|
|
13
|
+
};
|
|
14
|
+
declare const getOutputFormat: (filename: string, options: Options) => OutputFormat;
|
|
15
|
+
declare const writeFile: (writeOptions: WriteOptions, fs: FileSystem) => Promise<void>;
|
|
16
|
+
export { getOutputFormat, writeFile, type OutputFormat };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class CompressedChunk {
|
|
2
|
+
static members: string[];
|
|
3
|
+
size: number;
|
|
4
|
+
data: any;
|
|
5
|
+
chunkData: Float32Array;
|
|
6
|
+
position: Uint32Array;
|
|
7
|
+
rotation: Uint32Array;
|
|
8
|
+
scale: Uint32Array;
|
|
9
|
+
color: Uint32Array;
|
|
10
|
+
constructor(size?: number);
|
|
11
|
+
set(index: number, data: any): void;
|
|
12
|
+
pack(): void;
|
|
13
|
+
}
|
|
14
|
+
export { CompressedChunk };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataTable } from '../data-table/data-table';
|
|
2
|
+
import { type FileSystem } from '../io/write';
|
|
3
|
+
type WriteCompressedPlyOptions = {
|
|
4
|
+
filename: string;
|
|
5
|
+
dataTable: DataTable;
|
|
6
|
+
};
|
|
7
|
+
declare const writeCompressedPly: (options: WriteCompressedPlyOptions, fs: FileSystem) => Promise<void>;
|
|
8
|
+
export { writeCompressedPly };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DataTable } from '../data-table/data-table';
|
|
2
|
+
import { type FileSystem } from '../io/write';
|
|
3
|
+
type WriteCSVOptions = {
|
|
4
|
+
filename: string;
|
|
5
|
+
dataTable: DataTable;
|
|
6
|
+
};
|
|
7
|
+
declare const writeCsv: (options: WriteCSVOptions, fs: FileSystem) => Promise<void>;
|
|
8
|
+
export { writeCsv };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type DeviceCreator } from './write-sog';
|
|
2
|
+
import { DataTable } from '../data-table/data-table';
|
|
3
|
+
import { type FileSystem } from '../io/write';
|
|
4
|
+
type WriteHtmlOptions = {
|
|
5
|
+
filename: string;
|
|
6
|
+
dataTable: DataTable;
|
|
7
|
+
viewerSettingsJson?: any;
|
|
8
|
+
bundle: boolean;
|
|
9
|
+
iterations: number;
|
|
10
|
+
createDevice?: DeviceCreator;
|
|
11
|
+
};
|
|
12
|
+
declare const writeHtml: (options: WriteHtmlOptions, fs: FileSystem) => Promise<void>;
|
|
13
|
+
export { writeHtml };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type DeviceCreator } from './write-sog.js';
|
|
2
|
+
import { DataTable } from '../data-table/data-table';
|
|
3
|
+
import { type FileSystem } from '../io/write';
|
|
4
|
+
type WriteLodOptions = {
|
|
5
|
+
filename: string;
|
|
6
|
+
dataTable: DataTable;
|
|
7
|
+
envDataTable: DataTable | null;
|
|
8
|
+
iterations: number;
|
|
9
|
+
createDevice?: DeviceCreator;
|
|
10
|
+
chunkCount: number;
|
|
11
|
+
chunkExtent: number;
|
|
12
|
+
};
|
|
13
|
+
declare const writeLod: (options: WriteLodOptions, fs: FileSystem) => Promise<void>;
|
|
14
|
+
export { writeLod };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FileSystem } from '../io/write';
|
|
2
|
+
import { PlyData } from '../readers/read-ply';
|
|
3
|
+
type WritePlyOptions = {
|
|
4
|
+
filename: string;
|
|
5
|
+
plyData: PlyData;
|
|
6
|
+
};
|
|
7
|
+
declare const writePly: (options: WritePlyOptions, fs: FileSystem) => Promise<void>;
|
|
8
|
+
export { writePly };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GraphicsDevice } from 'playcanvas';
|
|
2
|
+
import { DataTable } from '../data-table/data-table';
|
|
3
|
+
import { type FileSystem } from '../io/write';
|
|
4
|
+
/**
|
|
5
|
+
* A function that creates a GraphicsDevice on demand.
|
|
6
|
+
* The application is responsible for caching if needed.
|
|
7
|
+
*/
|
|
8
|
+
type DeviceCreator = () => Promise<GraphicsDevice>;
|
|
9
|
+
type WriteSogOptions = {
|
|
10
|
+
filename: string;
|
|
11
|
+
dataTable: DataTable;
|
|
12
|
+
indices?: Uint32Array;
|
|
13
|
+
bundle: boolean;
|
|
14
|
+
iterations: number;
|
|
15
|
+
createDevice?: DeviceCreator;
|
|
16
|
+
};
|
|
17
|
+
declare const writeSog: (options: WriteSogOptions, fs: FileSystem) => Promise<void>;
|
|
18
|
+
export { writeSog, type DeviceCreator };
|
package/lib/BUILD.md
CHANGED
|
@@ -9,7 +9,7 @@ emcmake cmake -S . -B build -DBUILD_SHARED_LIBS=OFF
|
|
|
9
9
|
emmake make -C build
|
|
10
10
|
|
|
11
11
|
emcc -O3 webp.c build/libwebp.a build/libsharpyuv.a \
|
|
12
|
-
-sENVIRONMENT=node -sMODULARIZE=1 -sEXPORT_ES6=1 -sALLOW_MEMORY_GROWTH \
|
|
12
|
+
-sENVIRONMENT=node,web,worker -sMODULARIZE=1 -sEXPORT_ES6=1 -sALLOW_MEMORY_GROWTH \
|
|
13
13
|
-sEXPORTED_FUNCTIONS='["_webp_encode_rgba","_webp_encode_lossless_rgba","_webp_free","_malloc","_free"]' \
|
|
14
14
|
-sEXPORTED_RUNTIME_METHODS='["cwrap","HEAPU8","HEAPU32"]' \
|
|
15
15
|
-o webp.mjs
|
package/lib/webp.mjs
CHANGED
|
@@ -4,7 +4,7 @@ var Module = (() => {
|
|
|
4
4
|
async function(moduleArg = {}) {
|
|
5
5
|
var moduleRtn;
|
|
6
6
|
|
|
7
|
-
var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_NODE=true;if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("module");var require=createRequire(import.meta.url)}var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(_scriptName.startsWith("file:")){scriptDirectory=nodePath.dirname(require("url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var wasmMemory;var ABORT=false;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;var runtimeInitialized=false;var isFileURI=filename=>filename.startsWith("file://");function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["c"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}var runDependencies=0;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("webp.wasm")}return new URL("webp.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return{a:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["b"];updateMemoryViews();removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(mod,inst)=>{resolve(receiveInstance(mod,inst))})})}wasmBinaryFile??=findWasmBinary();try{var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}catch(e){readyPromiseReject(e);return Promise.reject(e)}}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"]}Module["cwrap"]=cwrap;var wasmImports={a:_emscripten_resize_heap};var wasmExports=await createWasm();var ___wasm_call_ctors=wasmExports["c"];var _webp_encode_rgba=Module["_webp_encode_rgba"]=wasmExports["d"];var _webp_encode_lossless_rgba=Module["_webp_encode_lossless_rgba"]=wasmExports["e"];var _webp_decode_rgba=Module["_webp_decode_rgba"]=wasmExports["f"];var _webp_free=Module["_webp_free"]=wasmExports["g"];var _malloc=Module["_malloc"]=wasmExports["h"];var _free=Module["_free"]=wasmExports["i"];var __emscripten_stack_restore=wasmExports["j"];var __emscripten_stack_alloc=wasmExports["k"];var _emscripten_stack_get_current=wasmExports["l"];function run(){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}function preInit(){if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}preInit();run();moduleRtn=readyPromise;
|
|
7
|
+
var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;var readyPromise=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&process.versions?.node&&process.type!="renderer";if(ENVIRONMENT_IS_NODE){const{createRequire}=await import("module");var require=createRequire(import.meta.url)}var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=import.meta.url;var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");var nodePath=require("path");if(_scriptName.startsWith("file:")){scriptDirectory=nodePath.dirname(require("url").fileURLToPath(_scriptName))+"/"}readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var wasmMemory;var ABORT=false;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64;var runtimeInitialized=false;var isFileURI=filename=>filename.startsWith("file://");function updateMemoryViews(){var b=wasmMemory.buffer;HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=true;wasmExports["c"]()}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(onPostRuns)}var runDependencies=0;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var wasmBinaryFile;function findWasmBinary(){if(Module["locateFile"]){return locateFile("webp.wasm")}return new URL("webp.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return{a:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["b"];updateMemoryViews();removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(mod,inst)=>{resolve(receiveInstance(mod,inst))})})}wasmBinaryFile??=findWasmBinary();try{var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}catch(e){readyPromiseReject(e);return Promise.reject(e)}}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var stackRestore=val=>__emscripten_stack_restore(val);var stackSave=()=>_emscripten_stack_get_current();var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var getCFunc=ident=>{var func=Module["_"+ident];return func};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var lengthBytesUTF8=str=>{var len=0;for(var i=0;i<str.length;++i){var c=str.charCodeAt(i);if(c<=127){len++}else if(c<=2047){len+=2}else if(c>=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i<str.length;++i){var u=str.charCodeAt(i);if(u>=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var UTF8Decoder=typeof TextDecoder!="undefined"?new TextDecoder:undefined;var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead=NaN)=>{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx<endPtr){var u0=heapOrArray[idx++];if(!(u0&128)){str+=String.fromCharCode(u0);continue}var u1=heapOrArray[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}var u2=heapOrArray[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u0=(u0&7)<<18|u1<<12|u2<<6|heapOrArray[idx++]&63}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}return str};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={string:str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},array:arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i<args.length;i++){var converter=toC[argTypes[i]];if(converter){if(stack===0)stack=stackSave();cArgs[i]=converter(args[i])}else{cArgs[i]=args[i]}}}var ret=func(...cArgs);function onDone(ret){if(stack!==0)stackRestore(stack);return convertReturnValue(ret)}ret=onDone(ret);return ret};var cwrap=(ident,returnType,argTypes,opts)=>{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return(...args)=>ccall(ident,returnType,argTypes,args,opts)};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])out=Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"]}Module["cwrap"]=cwrap;var wasmImports={a:_emscripten_resize_heap};var wasmExports=await createWasm();var ___wasm_call_ctors=wasmExports["c"];var _webp_encode_rgba=Module["_webp_encode_rgba"]=wasmExports["d"];var _webp_encode_lossless_rgba=Module["_webp_encode_lossless_rgba"]=wasmExports["e"];var _webp_decode_rgba=Module["_webp_decode_rgba"]=wasmExports["f"];var _webp_free=Module["_webp_free"]=wasmExports["g"];var _malloc=Module["_malloc"]=wasmExports["h"];var _free=Module["_free"]=wasmExports["i"];var __emscripten_stack_restore=wasmExports["j"];var __emscripten_stack_alloc=wasmExports["k"];var _emscripten_stack_get_current=wasmExports["l"];function run(){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);Module["onRuntimeInitialized"]?.();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun()},1)}else{doRun()}}function preInit(){if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()()}}}preInit();run();moduleRtn=readyPromise;
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
return moduleRtn;
|
package/lib/webp.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcanvas/splat-transform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"author": "PlayCanvas<support@playcanvas.com>",
|
|
5
5
|
"homepage": "https://playcanvas.com",
|
|
6
|
-
"description": "CLI tool for 3D Gaussian splat format conversion and transformation",
|
|
6
|
+
"description": "Library and CLI tool for 3D Gaussian splat format conversion and transformation",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"3d-gaussian-splatting",
|
|
9
9
|
"cli",
|
|
@@ -13,6 +13,16 @@
|
|
|
13
13
|
"typescript"
|
|
14
14
|
],
|
|
15
15
|
"license": "MIT",
|
|
16
|
+
"main": "dist/index.mjs",
|
|
17
|
+
"module": "dist/index.mjs",
|
|
18
|
+
"types": "dist/lib/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/lib/index.d.ts",
|
|
22
|
+
"import": "./dist/index.mjs"
|
|
23
|
+
},
|
|
24
|
+
"./lib/*": "./lib/*"
|
|
25
|
+
},
|
|
16
26
|
"bin": {
|
|
17
27
|
"splat-transform": "bin/cli.mjs"
|
|
18
28
|
},
|
|
@@ -25,35 +35,41 @@
|
|
|
25
35
|
},
|
|
26
36
|
"files": [
|
|
27
37
|
"dist/",
|
|
38
|
+
"bin/",
|
|
28
39
|
"lib/"
|
|
29
40
|
],
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"webgpu": "^0.3.8"
|
|
43
|
+
},
|
|
30
44
|
"devDependencies": {
|
|
31
45
|
"@playcanvas/eslint-config": "2.1.0",
|
|
32
46
|
"@playcanvas/supersplat-viewer": "1.10.2",
|
|
33
47
|
"@rollup/plugin-json": "6.1.0",
|
|
34
48
|
"@rollup/plugin-node-resolve": "16.0.3",
|
|
35
49
|
"@rollup/plugin-typescript": "12.3.0",
|
|
36
|
-
"@types/jsdom": "27.0.0",
|
|
37
50
|
"@types/node": "24.10.4",
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
39
|
-
"@typescript-eslint/parser": "8.
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "8.51.0",
|
|
52
|
+
"@typescript-eslint/parser": "8.51.0",
|
|
40
53
|
"eslint": "9.39.2",
|
|
41
54
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
42
|
-
"
|
|
55
|
+
"pathe": "^2.0.3",
|
|
56
|
+
"playcanvas": "2.14.4",
|
|
43
57
|
"publint": "0.3.16",
|
|
44
|
-
"rollup": "4.
|
|
58
|
+
"rollup": "4.54.0",
|
|
45
59
|
"tslib": "2.8.1",
|
|
46
60
|
"typescript": "5.9.3"
|
|
47
61
|
},
|
|
48
|
-
"
|
|
49
|
-
"
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"playcanvas": ">=2.0.0"
|
|
50
64
|
},
|
|
51
65
|
"scripts": {
|
|
52
66
|
"build": "rollup -c",
|
|
53
|
-
"lint": "eslint src
|
|
54
|
-
"lint:fix": "eslint src
|
|
67
|
+
"lint": "eslint src",
|
|
68
|
+
"lint:fix": "eslint src --fix",
|
|
55
69
|
"publint": "publint",
|
|
56
|
-
"watch": "rollup -c -w"
|
|
70
|
+
"watch": "rollup -c -w",
|
|
71
|
+
"test": "node --test test/*.test.mjs",
|
|
72
|
+
"test:fixtures": "node test/fixtures/create-fixtures.mjs"
|
|
57
73
|
},
|
|
58
74
|
"engines": {
|
|
59
75
|
"node": ">=18.0.0"
|