@babylonjs/loaders 9.12.0 → 9.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/FBX/fbxFileLoader.d.ts +194 -0
  2. package/FBX/fbxFileLoader.js +2440 -0
  3. package/FBX/fbxFileLoader.js.map +1 -0
  4. package/FBX/fbxFileLoader.metadata.d.ts +11 -0
  5. package/FBX/fbxFileLoader.metadata.js +11 -0
  6. package/FBX/fbxFileLoader.metadata.js.map +1 -0
  7. package/FBX/index.d.ts +3 -0
  8. package/FBX/index.js +3 -0
  9. package/FBX/index.js.map +1 -0
  10. package/FBX/interpreter/animation.d.ts +122 -0
  11. package/FBX/interpreter/animation.js +648 -0
  12. package/FBX/interpreter/animation.js.map +1 -0
  13. package/FBX/interpreter/blendShapes.d.ts +44 -0
  14. package/FBX/interpreter/blendShapes.js +192 -0
  15. package/FBX/interpreter/blendShapes.js.map +1 -0
  16. package/FBX/interpreter/connections.d.ts +95 -0
  17. package/FBX/interpreter/connections.js +233 -0
  18. package/FBX/interpreter/connections.js.map +1 -0
  19. package/FBX/interpreter/fbxInterpreter.d.ts +149 -0
  20. package/FBX/interpreter/fbxInterpreter.js +496 -0
  21. package/FBX/interpreter/fbxInterpreter.js.map +1 -0
  22. package/FBX/interpreter/geometry.d.ts +55 -0
  23. package/FBX/interpreter/geometry.js +573 -0
  24. package/FBX/interpreter/geometry.js.map +1 -0
  25. package/FBX/interpreter/materials.d.ts +50 -0
  26. package/FBX/interpreter/materials.js +144 -0
  27. package/FBX/interpreter/materials.js.map +1 -0
  28. package/FBX/interpreter/propertyTemplates.d.ts +22 -0
  29. package/FBX/interpreter/propertyTemplates.js +125 -0
  30. package/FBX/interpreter/propertyTemplates.js.map +1 -0
  31. package/FBX/interpreter/rig.d.ts +20 -0
  32. package/FBX/interpreter/rig.js +259 -0
  33. package/FBX/interpreter/rig.js.map +1 -0
  34. package/FBX/interpreter/sceneDiagnostics.d.ts +14 -0
  35. package/FBX/interpreter/sceneDiagnostics.js +55 -0
  36. package/FBX/interpreter/sceneDiagnostics.js.map +1 -0
  37. package/FBX/interpreter/skeleton.d.ts +93 -0
  38. package/FBX/interpreter/skeleton.js +515 -0
  39. package/FBX/interpreter/skeleton.js.map +1 -0
  40. package/FBX/interpreter/transform.d.ts +21 -0
  41. package/FBX/interpreter/transform.js +92 -0
  42. package/FBX/interpreter/transform.js.map +1 -0
  43. package/FBX/parsers/fbxAsciiParser.d.ts +5 -0
  44. package/FBX/parsers/fbxAsciiParser.js +330 -0
  45. package/FBX/parsers/fbxAsciiParser.js.map +1 -0
  46. package/FBX/parsers/fbxBinaryParser.d.ts +6 -0
  47. package/FBX/parsers/fbxBinaryParser.js +255 -0
  48. package/FBX/parsers/fbxBinaryParser.js.map +1 -0
  49. package/FBX/parsers/zlibInflate.d.ts +7 -0
  50. package/FBX/parsers/zlibInflate.js +350 -0
  51. package/FBX/parsers/zlibInflate.js.map +1 -0
  52. package/FBX/types/fbxTypes.d.ts +54 -0
  53. package/FBX/types/fbxTypes.js +66 -0
  54. package/FBX/types/fbxTypes.js.map +1 -0
  55. package/SPLAT/gaussianSplattingStream.d.ts +404 -0
  56. package/SPLAT/gaussianSplattingStream.js +1159 -0
  57. package/SPLAT/gaussianSplattingStream.js.map +1 -0
  58. package/SPLAT/gaussianSplattingWorkBuffer.d.ts +71 -0
  59. package/SPLAT/gaussianSplattingWorkBuffer.js +249 -0
  60. package/SPLAT/gaussianSplattingWorkBuffer.js.map +1 -0
  61. package/SPLAT/gaussianSplattingWorkBufferShaders.d.ts +25 -0
  62. package/SPLAT/gaussianSplattingWorkBufferShaders.js +255 -0
  63. package/SPLAT/gaussianSplattingWorkBufferShaders.js.map +1 -0
  64. package/SPLAT/index.d.ts +1 -0
  65. package/SPLAT/index.js +1 -0
  66. package/SPLAT/index.js.map +1 -1
  67. package/SPLAT/sog.d.ts +6 -1
  68. package/SPLAT/sog.js +111 -25
  69. package/SPLAT/sog.js.map +1 -1
  70. package/SPLAT/splatFileLoader.d.ts +8 -0
  71. package/SPLAT/splatFileLoader.js +49 -0
  72. package/SPLAT/splatFileLoader.js.map +1 -1
  73. package/dynamic.js +9 -0
  74. package/dynamic.js.map +1 -1
  75. package/index.d.ts +1 -0
  76. package/index.js +1 -0
  77. package/index.js.map +1 -1
  78. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zlibInflate.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/FBX/parsers/zlibInflate.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,MAAM,SAAS,GAAG,KAAK,CAAC;AACxB,MAAM,QAAQ,GAAG,EAAE,CAAC;AAEpB,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACxI,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClH,MAAM,aAAa,GAAG,CAAC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AC3D,CAAC;gBACD,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;gBAC5C,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBACtC,MAAM;YACV,KAAK,EAAE;gBACH,aAAa,GAAG,CAAC,CAAC;gBAClB,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBACtC,MAAM;YACV,KAAK,EAAE;gBACH,aAAa,GAAG,CAAC,CAAC;gBAClB,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;gBACvC,MAAM;YACV;gBACI,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC/D,CAAC;QAED,IAAI,OAAO,CAAC,MAAM,GAAG,YAAY,GAAG,KAAK,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC3D,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAChC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention, jsdoc/require-param, jsdoc/require-returns */\r\nconst ADLER_MOD = 65521;\r\nconst MAX_BITS = 15;\r\n\r\nconst LENGTH_BASE = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258];\r\nconst LENGTH_EXTRA_BITS = [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];\r\nconst DISTANCE_BASE = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577];\r\nconst DISTANCE_EXTRA_BITS = [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];\r\nconst CODE_LENGTH_ORDER = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\r\n\r\n/**\r\n * Inflate a zlib-wrapped deflate stream.\r\n *\r\n * This implementation is intentionally scoped to FBX binary array payloads: one-shot,\r\n * synchronous zlib streams with the exact uncompressed length known up front.\r\n */\r\nexport function inflateZlib(input: Uint8Array, expectedLength: number): Uint8Array {\r\n if (!Number.isInteger(expectedLength) || expectedLength < 0) {\r\n throw new Error(\"zlib: invalid expected length\");\r\n }\r\n if (input.byteLength < 6) {\r\n throw new Error(\"zlib: unexpected end of input\");\r\n }\r\n\r\n const cmf = input[0];\r\n const flg = input[1];\r\n if ((cmf & 0x0f) !== 8 || cmf >> 4 > 7 || ((cmf << 8) + flg) % 31 !== 0) {\r\n throw new Error(\"zlib: invalid header\");\r\n }\r\n if ((flg & 0x20) !== 0) {\r\n throw new Error(\"zlib: preset dictionary not supported\");\r\n }\r\n\r\n const reader = new BitReader(input, 2, input.byteLength - 4);\r\n const output = new OutputWriter(expectedLength);\r\n\r\n let isFinalBlock = false;\r\n while (!isFinalBlock) {\r\n isFinalBlock = reader.readBits(1) === 1;\r\n const blockType = reader.readBits(2);\r\n switch (blockType) {\r\n case 0:\r\n inflateStoredBlock(reader, output);\r\n break;\r\n case 1:\r\n inflateCompressedBlock(reader, output, getFixedLiteralLengthTree(), getFixedDistanceTree());\r\n break;\r\n case 2: {\r\n const { literalLengthTree, distanceTree } = readDynamicTrees(reader);\r\n inflateCompressedBlock(reader, output, literalLengthTree, distanceTree);\r\n break;\r\n }\r\n default:\r\n throw new Error(\"deflate: invalid block type\");\r\n }\r\n }\r\n\r\n if (reader.byteOffset < input.byteLength - 4) {\r\n throw new Error(\"zlib: trailing deflate data\");\r\n }\r\n\r\n output.finish();\r\n const expectedAdler = ((input[input.byteLength - 4] << 24) | (input[input.byteLength - 3] << 16) | (input[input.byteLength - 2] << 8) | input[input.byteLength - 1]) >>> 0;\r\n if (output.adler32() !== expectedAdler) {\r\n throw new Error(\"zlib: adler32 mismatch\");\r\n }\r\n\r\n return output.bytes;\r\n}\r\n\r\nclass BitReader {\r\n private bitBuffer = 0;\r\n private bitCount = 0;\r\n\r\n public constructor(\r\n private readonly input: Uint8Array,\r\n public byteOffset: number,\r\n private readonly endOffset: number\r\n ) {}\r\n\r\n public readBits(count: number): number {\r\n this.ensureBits(count);\r\n const value = this.bitBuffer & ((1 << count) - 1);\r\n this.bitBuffer >>>= count;\r\n this.bitCount -= count;\r\n return value;\r\n }\r\n\r\n public readBit(): number {\r\n if (this.bitCount === 0) {\r\n if (this.byteOffset >= this.endOffset) {\r\n throw new Error(\"zlib: unexpected end of input\");\r\n }\r\n this.bitBuffer = this.input[this.byteOffset++];\r\n this.bitCount = 8;\r\n }\r\n const bit = this.bitBuffer & 1;\r\n this.bitBuffer >>>= 1;\r\n this.bitCount--;\r\n return bit;\r\n }\r\n\r\n public alignToByte(): void {\r\n this.bitBuffer = 0;\r\n this.bitCount = 0;\r\n }\r\n\r\n public readUint16LE(): number {\r\n this.ensureByteAligned();\r\n if (this.byteOffset + 2 > this.endOffset) {\r\n throw new Error(\"zlib: unexpected end of input\");\r\n }\r\n const value = this.input[this.byteOffset] | (this.input[this.byteOffset + 1] << 8);\r\n this.byteOffset += 2;\r\n return value;\r\n }\r\n\r\n public readByte(): number {\r\n this.ensureByteAligned();\r\n if (this.byteOffset >= this.endOffset) {\r\n throw new Error(\"zlib: unexpected end of input\");\r\n }\r\n return this.input[this.byteOffset++];\r\n }\r\n\r\n private ensureByteAligned(): void {\r\n if (this.bitCount !== 0) {\r\n throw new Error(\"deflate: expected byte alignment\");\r\n }\r\n }\r\n\r\n private ensureBits(count: number): void {\r\n while (this.bitCount < count) {\r\n if (this.byteOffset >= this.endOffset) {\r\n throw new Error(\"zlib: unexpected end of input\");\r\n }\r\n this.bitBuffer |= this.input[this.byteOffset++] << this.bitCount;\r\n this.bitCount += 8;\r\n }\r\n }\r\n}\r\n\r\nclass OutputWriter {\r\n private offset = 0;\r\n private adlerA = 1;\r\n private adlerB = 0;\r\n\r\n public readonly bytes: Uint8Array;\r\n\r\n public constructor(expectedLength: number) {\r\n this.bytes = new Uint8Array(expectedLength);\r\n }\r\n\r\n public writeByte(value: number): void {\r\n if (this.offset >= this.bytes.byteLength) {\r\n throw new Error(\"zlib: output length mismatch\");\r\n }\r\n const byte = value & 0xff;\r\n this.bytes[this.offset++] = byte;\r\n this.adlerA += byte;\r\n this.adlerB += this.adlerA;\r\n this.adlerA %= ADLER_MOD;\r\n this.adlerB %= ADLER_MOD;\r\n }\r\n\r\n public copy(distance: number, length: number): void {\r\n if (distance <= 0 || distance > this.offset) {\r\n throw new Error(\"deflate: distance out of range\");\r\n }\r\n for (let i = 0; i < length; i++) {\r\n this.writeByte(this.bytes[this.offset - distance]);\r\n }\r\n }\r\n\r\n public finish(): void {\r\n if (this.offset !== this.bytes.byteLength) {\r\n throw new Error(\"zlib: output length mismatch\");\r\n }\r\n }\r\n\r\n public adler32(): number {\r\n return ((this.adlerB << 16) | this.adlerA) >>> 0;\r\n }\r\n}\r\n\r\nclass HuffmanTree {\r\n private readonly symbolsByLength: Array<Int16Array | undefined>;\r\n private readonly maxCodeLength: number;\r\n\r\n public constructor(codeLengths: readonly number[], options: { allowEmpty?: boolean } = {}) {\r\n const counts = new Array<number>(MAX_BITS + 1).fill(0);\r\n let nonZeroCount = 0;\r\n let maxCodeLength = 0;\r\n\r\n for (const length of codeLengths) {\r\n if (!Number.isInteger(length) || length < 0 || length > MAX_BITS) {\r\n throw new Error(\"deflate: invalid huffman code lengths\");\r\n }\r\n if (length > 0) {\r\n counts[length]++;\r\n nonZeroCount++;\r\n maxCodeLength = Math.max(maxCodeLength, length);\r\n }\r\n }\r\n\r\n if (nonZeroCount === 0) {\r\n if (options.allowEmpty) {\r\n this.symbolsByLength = [];\r\n this.maxCodeLength = 0;\r\n return;\r\n }\r\n throw new Error(\"deflate: invalid huffman code lengths\");\r\n }\r\n\r\n let remaining = 1;\r\n for (let bits = 1; bits <= MAX_BITS; bits++) {\r\n remaining = (remaining << 1) - counts[bits];\r\n if (remaining < 0) {\r\n throw new Error(\"deflate: invalid huffman code lengths\");\r\n }\r\n }\r\n if (remaining !== 0 && nonZeroCount !== 1) {\r\n throw new Error(\"deflate: invalid huffman code lengths\");\r\n }\r\n\r\n const nextCode = new Array<number>(MAX_BITS + 1).fill(0);\r\n let code = 0;\r\n for (let bits = 1; bits <= MAX_BITS; bits++) {\r\n code = (code + counts[bits - 1]) << 1;\r\n nextCode[bits] = code;\r\n }\r\n\r\n this.symbolsByLength = Array.from({ length: MAX_BITS + 1 }, (_, length) => {\r\n if (counts[length] === 0) {\r\n return undefined;\r\n }\r\n const symbols = new Int16Array(1 << length);\r\n symbols.fill(-1);\r\n return symbols;\r\n });\r\n for (let symbol = 0; symbol < codeLengths.length; symbol++) {\r\n const length = codeLengths[symbol];\r\n if (length === 0) {\r\n continue;\r\n }\r\n this.symbolsByLength[length]![nextCode[length]++] = symbol;\r\n }\r\n this.maxCodeLength = maxCodeLength;\r\n }\r\n\r\n public decode(reader: BitReader): number {\r\n if (this.maxCodeLength === 0) {\r\n throw new Error(\"deflate: invalid huffman code\");\r\n }\r\n\r\n let code = 0;\r\n for (let length = 1; length <= this.maxCodeLength; length++) {\r\n code = (code << 1) | reader.readBit();\r\n const symbol = this.symbolsByLength[length]?.[code] ?? -1;\r\n if (symbol >= 0) {\r\n return symbol;\r\n }\r\n }\r\n throw new Error(\"deflate: invalid huffman code\");\r\n }\r\n}\r\n\r\nlet fixedLiteralLengthTree: HuffmanTree | undefined;\r\nlet fixedDistanceTree: HuffmanTree | undefined;\r\n\r\nfunction getFixedLiteralLengthTree(): HuffmanTree {\r\n if (!fixedLiteralLengthTree) {\r\n const lengths = new Array<number>(288);\r\n for (let symbol = 0; symbol <= 143; symbol++) {\r\n lengths[symbol] = 8;\r\n }\r\n for (let symbol = 144; symbol <= 255; symbol++) {\r\n lengths[symbol] = 9;\r\n }\r\n for (let symbol = 256; symbol <= 279; symbol++) {\r\n lengths[symbol] = 7;\r\n }\r\n for (let symbol = 280; symbol <= 287; symbol++) {\r\n lengths[symbol] = 8;\r\n }\r\n fixedLiteralLengthTree = new HuffmanTree(lengths);\r\n }\r\n return fixedLiteralLengthTree;\r\n}\r\n\r\nfunction getFixedDistanceTree(): HuffmanTree {\r\n if (!fixedDistanceTree) {\r\n fixedDistanceTree = new HuffmanTree(new Array<number>(32).fill(5));\r\n }\r\n return fixedDistanceTree;\r\n}\r\n\r\nfunction inflateStoredBlock(reader: BitReader, output: OutputWriter): void {\r\n reader.alignToByte();\r\n const length = reader.readUint16LE();\r\n const inverseLength = reader.readUint16LE();\r\n if (((length ^ inverseLength) & 0xffff) !== 0xffff) {\r\n throw new Error(\"deflate: invalid stored block length\");\r\n }\r\n\r\n for (let i = 0; i < length; i++) {\r\n output.writeByte(reader.readByte());\r\n }\r\n}\r\n\r\nfunction inflateCompressedBlock(reader: BitReader, output: OutputWriter, literalLengthTree: HuffmanTree, distanceTree: HuffmanTree): void {\r\n while (true) {\r\n const symbol = literalLengthTree.decode(reader);\r\n if (symbol < 256) {\r\n output.writeByte(symbol);\r\n continue;\r\n }\r\n if (symbol === 256) {\r\n return;\r\n }\r\n if (symbol > 285) {\r\n throw new Error(\"deflate: invalid literal/length symbol\");\r\n }\r\n\r\n const lengthIndex = symbol - 257;\r\n const length = LENGTH_BASE[lengthIndex] + reader.readBits(LENGTH_EXTRA_BITS[lengthIndex]);\r\n const distanceSymbol = distanceTree.decode(reader);\r\n if (distanceSymbol > 29) {\r\n throw new Error(\"deflate: invalid distance symbol\");\r\n }\r\n const distance = DISTANCE_BASE[distanceSymbol] + reader.readBits(DISTANCE_EXTRA_BITS[distanceSymbol]);\r\n output.copy(distance, length);\r\n }\r\n}\r\n\r\nfunction readDynamicTrees(reader: BitReader): {\r\n literalLengthTree: HuffmanTree;\r\n distanceTree: HuffmanTree;\r\n} {\r\n const literalLengthCount = reader.readBits(5) + 257;\r\n const distanceCount = reader.readBits(5) + 1;\r\n const codeLengthCount = reader.readBits(4) + 4;\r\n\r\n const codeLengthLengths = new Array<number>(19).fill(0);\r\n for (let i = 0; i < codeLengthCount; i++) {\r\n codeLengthLengths[CODE_LENGTH_ORDER[i]] = reader.readBits(3);\r\n }\r\n\r\n const codeLengthTree = new HuffmanTree(codeLengthLengths);\r\n const lengths = readCodeLengths(reader, codeLengthTree, literalLengthCount + distanceCount);\r\n const literalLengthLengths = lengths.slice(0, literalLengthCount);\r\n const distanceLengths = lengths.slice(literalLengthCount);\r\n\r\n if (literalLengthLengths[256] === 0) {\r\n throw new Error(\"deflate: missing end-of-block code\");\r\n }\r\n\r\n return {\r\n literalLengthTree: new HuffmanTree(literalLengthLengths),\r\n distanceTree: new HuffmanTree(distanceLengths, { allowEmpty: true }),\r\n };\r\n}\r\n\r\nfunction readCodeLengths(reader: BitReader, codeLengthTree: HuffmanTree, count: number): number[] {\r\n const lengths: number[] = [];\r\n while (lengths.length < count) {\r\n const symbol = codeLengthTree.decode(reader);\r\n if (symbol <= 15) {\r\n lengths.push(symbol);\r\n continue;\r\n }\r\n\r\n let repeatLength: number;\r\n let repeatedValue: number;\r\n switch (symbol) {\r\n case 16:\r\n if (lengths.length === 0) {\r\n throw new Error(\"deflate: invalid code length repeat\");\r\n }\r\n repeatedValue = lengths[lengths.length - 1];\r\n repeatLength = reader.readBits(2) + 3;\r\n break;\r\n case 17:\r\n repeatedValue = 0;\r\n repeatLength = reader.readBits(3) + 3;\r\n break;\r\n case 18:\r\n repeatedValue = 0;\r\n repeatLength = reader.readBits(7) + 11;\r\n break;\r\n default:\r\n throw new Error(\"deflate: invalid code length symbol\");\r\n }\r\n\r\n if (lengths.length + repeatLength > count) {\r\n throw new Error(\"deflate: invalid code length repeat\");\r\n }\r\n for (let i = 0; i < repeatLength; i++) {\r\n lengths.push(repeatedValue);\r\n }\r\n }\r\n return lengths;\r\n}\r\n"]}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Intermediate representation for parsed FBX data.
3
+ * Both binary and ASCII parsers produce this same structure.
4
+ */
5
+ /** Individual property value within an FBX node */
6
+ export type FBXPropertyValue = boolean | number | string | Float32Array | Float64Array | Int32Array | Uint8Array;
7
+ /** Parsed FBX property type identifier. */
8
+ export type FBXPropertyType = "boolean" | "int16" | "int32" | "int64" | "float32" | "float64" | "string" | "raw" | "float32[]" | "float64[]" | "int32[]" | "int64[]" | "boolean[]";
9
+ /** Individual property within an FBX node. */
10
+ export interface FBXProperty {
11
+ /** Parsed property type. */
12
+ type: FBXPropertyType;
13
+ /** Parsed property value. */
14
+ value: FBXPropertyValue;
15
+ }
16
+ /** A node in the FBX document tree */
17
+ export interface FBXNode {
18
+ /** Node name. */
19
+ name: string;
20
+ /** Node properties. */
21
+ properties: FBXProperty[];
22
+ /** Child nodes. */
23
+ children: FBXNode[];
24
+ }
25
+ /** Top-level parsed FBX document */
26
+ export interface FBXDocument {
27
+ /** FBX file version. */
28
+ version: number;
29
+ /** Top-level document nodes. */
30
+ nodes: FBXNode[];
31
+ }
32
+ /** Helper to find a child node by name */
33
+ export declare function findChildByName(node: FBXNode, name: string): FBXNode | undefined;
34
+ /** Helper to find all children with a given name */
35
+ export declare function findChildrenByName(node: FBXNode, name: string): FBXNode[];
36
+ /** Helper to find a top-level node in a document */
37
+ export declare function findDocumentNode(doc: FBXDocument, name: string): FBXNode | undefined;
38
+ /** Extract a property value by index, with type narrowing */
39
+ export declare function getPropertyValue<T extends FBXPropertyValue>(node: FBXNode, index: number): T | undefined;
40
+ /**
41
+ * Converts an FBX object ID value to a safe JavaScript number.
42
+ * @param value - Parsed FBX object ID value
43
+ * @returns The object ID, or undefined when the value is not numeric
44
+ */
45
+ export declare function getSafeFBXObjectId(value: unknown): number | undefined;
46
+ /** Get the numeric ID from a node (first property is typically the int64 UID) */
47
+ export declare function getNodeId(node: FBXNode): number | undefined;
48
+ /**
49
+ * Clean FBX object names.
50
+ * FBX names may contain:
51
+ * - A "Class::" prefix (e.g. "Model::valkyrie_mesh") — strip it
52
+ * - A binary null/control-character class suffix — strip it
53
+ */
54
+ export declare function cleanFBXName(fbxName: string): string;
@@ -0,0 +1,66 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention, jsdoc/require-param, jsdoc/require-returns */
2
+ /**
3
+ * Intermediate representation for parsed FBX data.
4
+ * Both binary and ASCII parsers produce this same structure.
5
+ */
6
+ /** Helper to find a child node by name */
7
+ export function findChildByName(node, name) {
8
+ return node.children.find((c) => c.name === name);
9
+ }
10
+ /** Helper to find all children with a given name */
11
+ export function findChildrenByName(node, name) {
12
+ return node.children.filter((c) => c.name === name);
13
+ }
14
+ /** Helper to find a top-level node in a document */
15
+ export function findDocumentNode(doc, name) {
16
+ return doc.nodes.find((n) => n.name === name);
17
+ }
18
+ /** Extract a property value by index, with type narrowing */
19
+ export function getPropertyValue(node, index) {
20
+ if (index < node.properties.length) {
21
+ return node.properties[index].value;
22
+ }
23
+ return undefined;
24
+ }
25
+ /**
26
+ * Converts an FBX object ID value to a safe JavaScript number.
27
+ * @param value - Parsed FBX object ID value
28
+ * @returns The object ID, or undefined when the value is not numeric
29
+ */
30
+ export function getSafeFBXObjectId(value) {
31
+ if (typeof value !== "number") {
32
+ return undefined;
33
+ }
34
+ if (!Number.isSafeInteger(value)) {
35
+ throw new Error(`Unsafe FBX object ID ${value.toString()}: object IDs must be safe integers.`);
36
+ }
37
+ return value;
38
+ }
39
+ /** Get the numeric ID from a node (first property is typically the int64 UID) */
40
+ export function getNodeId(node) {
41
+ const prop = node.properties[0];
42
+ if (prop && (prop.type === "int64" || prop.type === "int32")) {
43
+ return getSafeFBXObjectId(prop.value);
44
+ }
45
+ return undefined;
46
+ }
47
+ /**
48
+ * Clean FBX object names.
49
+ * FBX names may contain:
50
+ * - A "Class::" prefix (e.g. "Model::valkyrie_mesh") — strip it
51
+ * - A binary null/control-character class suffix — strip it
52
+ */
53
+ export function cleanFBXName(fbxName) {
54
+ // Strip \x00\x01 suffix (binary FBX name/class separator)
55
+ const nullIdx = fbxName.indexOf("\0");
56
+ if (nullIdx >= 0) {
57
+ fbxName = fbxName.substring(0, nullIdx);
58
+ }
59
+ // Strip "ClassName::" prefix (ASCII FBX)
60
+ const colonIdx = fbxName.indexOf("::");
61
+ if (colonIdx >= 0) {
62
+ fbxName = fbxName.substring(colonIdx + 2);
63
+ }
64
+ return fbxName;
65
+ }
66
+ //# sourceMappingURL=fbxTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fbxTypes.js","sourceRoot":"","sources":["../../../../../dev/loaders/src/FBX/types/fbxTypes.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG;;;GAGG;AA+CH,0CAA0C;AAC1C,MAAM,UAAU,eAAe,CAAC,IAAa,EAAE,IAAY;IACvD,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACtD,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,kBAAkB,CAAC,IAAa,EAAE,IAAY;IAC1D,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,gBAAgB,CAAC,GAAgB,EAAE,IAAY;IAC3D,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,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,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAChB,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention, jsdoc/require-param, jsdoc/require-returns */\r\n/**\r\n * Intermediate representation for parsed FBX data.\r\n * Both binary and ASCII parsers produce this same structure.\r\n */\r\n\r\n/** Individual property value within an FBX node */\r\nexport type FBXPropertyValue = boolean | number | string | Float32Array | Float64Array | Int32Array | Uint8Array;\r\n\r\n/** Parsed FBX property type identifier. */\r\nexport type FBXPropertyType =\r\n | \"boolean\" // 'C'\r\n | \"int16\" // 'Y'\r\n | \"int32\" // 'I'\r\n | \"int64\" // 'L'\r\n | \"float32\" // 'F'\r\n | \"float64\" // 'D'\r\n | \"string\" // 'S'\r\n | \"raw\" // 'R'\r\n | \"float32[]\" // 'f'\r\n | \"float64[]\" // 'd'\r\n | \"int32[]\" // 'i'\r\n | \"int64[]\" // 'l'\r\n | \"boolean[]\"; // 'b' (stored as Uint8Array where 0=false, 1=true)\r\n\r\n/** Individual property within an FBX node. */\r\nexport interface FBXProperty {\r\n /** Parsed property type. */\r\n type: FBXPropertyType;\r\n /** Parsed property value. */\r\n value: FBXPropertyValue;\r\n}\r\n\r\n/** A node in the FBX document tree */\r\nexport interface FBXNode {\r\n /** Node name. */\r\n name: string;\r\n /** Node properties. */\r\n properties: FBXProperty[];\r\n /** Child nodes. */\r\n children: FBXNode[];\r\n}\r\n\r\n/** Top-level parsed FBX document */\r\nexport interface FBXDocument {\r\n /** FBX file version. */\r\n version: number;\r\n /** Top-level document nodes. */\r\n nodes: FBXNode[];\r\n}\r\n\r\n/** Helper to find a child node by name */\r\nexport function findChildByName(node: FBXNode, name: string): FBXNode | undefined {\r\n return node.children.find((c) => c.name === name);\r\n}\r\n\r\n/** Helper to find all children with a given name */\r\nexport function findChildrenByName(node: FBXNode, name: string): FBXNode[] {\r\n return node.children.filter((c) => c.name === name);\r\n}\r\n\r\n/** Helper to find a top-level node in a document */\r\nexport function findDocumentNode(doc: FBXDocument, name: string): FBXNode | undefined {\r\n return doc.nodes.find((n) => n.name === name);\r\n}\r\n\r\n/** Extract a property value by index, with type narrowing */\r\nexport function getPropertyValue<T extends FBXPropertyValue>(node: FBXNode, index: number): T | undefined {\r\n if (index < node.properties.length) {\r\n return node.properties[index].value as T;\r\n }\r\n return undefined;\r\n}\r\n\r\n/**\r\n * Converts an FBX object ID value to a safe JavaScript number.\r\n * @param value - Parsed FBX object ID value\r\n * @returns The object ID, or undefined when the value is not numeric\r\n */\r\nexport function getSafeFBXObjectId(value: unknown): number | undefined {\r\n if (typeof value !== \"number\") {\r\n return undefined;\r\n }\r\n if (!Number.isSafeInteger(value)) {\r\n throw new Error(`Unsafe FBX object ID ${value.toString()}: object IDs must be safe integers.`);\r\n }\r\n return value;\r\n}\r\n\r\n/** Get the numeric ID from a node (first property is typically the int64 UID) */\r\nexport function getNodeId(node: FBXNode): number | undefined {\r\n const prop = node.properties[0];\r\n if (prop && (prop.type === \"int64\" || prop.type === \"int32\")) {\r\n return getSafeFBXObjectId(prop.value);\r\n }\r\n return undefined;\r\n}\r\n\r\n/**\r\n * Clean FBX object names.\r\n * FBX names may contain:\r\n * - A \"Class::\" prefix (e.g. \"Model::valkyrie_mesh\") — strip it\r\n * - A binary null/control-character class suffix — strip it\r\n */\r\nexport function cleanFBXName(fbxName: string): string {\r\n // Strip \\x00\\x01 suffix (binary FBX name/class separator)\r\n const nullIdx = fbxName.indexOf(\"\\0\");\r\n if (nullIdx >= 0) {\r\n fbxName = fbxName.substring(0, nullIdx);\r\n }\r\n\r\n // Strip \"ClassName::\" prefix (ASCII FBX)\r\n const colonIdx = fbxName.indexOf(\"::\");\r\n if (colonIdx >= 0) {\r\n fbxName = fbxName.substring(colonIdx + 2);\r\n }\r\n\r\n return fbxName;\r\n}\r\n"]}
@@ -0,0 +1,404 @@
1
+ import { GaussianSplattingMesh } from "@babylonjs/core/Meshes/GaussianSplatting/gaussianSplattingMesh.js";
2
+ import { type Scene } from "@babylonjs/core/scene.js";
3
+ import { type Nullable } from "@babylonjs/core/types.js";
4
+ import { Camera } from "@babylonjs/core/Cameras/camera.js";
5
+ import { BoundingInfo } from "@babylonjs/core/Culling/boundingInfo.js";
6
+ /**
7
+ * A single LOD variant of a tree node: a contiguous splat range inside one streamed SOG file.
8
+ */
9
+ interface ISOGLODEntry {
10
+ /** Index into {@link ISOGLODMetadata.filenames}. */
11
+ file: number;
12
+ /** First splat index inside that file. */
13
+ offset: number;
14
+ /** Number of splats. */
15
+ count: number;
16
+ }
17
+ /**
18
+ * A node of the PlayCanvas-style SOG LOD octree. Internal nodes have `children`; leaves have `lods`.
19
+ */
20
+ interface ISOGLODNode {
21
+ bound: {
22
+ min: number[];
23
+ max: number[];
24
+ };
25
+ children?: ISOGLODNode[];
26
+ lods?: {
27
+ [level: string]: ISOGLODEntry;
28
+ };
29
+ /** LOD level currently streamed/rendered for this node, or undefined until its base LOD is ready. */
30
+ activeLod?: number;
31
+ /** Distance-based ideal LOD level for this node, recomputed per frame. */
32
+ optimalLod?: number;
33
+ /** Available LOD levels for this leaf, sorted ascending (0 = finest). Set during the tree walk. */
34
+ availableLevels?: number[];
35
+ /** Coarsest available level (= max key), always streamed as the permanent base layer. */
36
+ baseLod?: number;
37
+ /** Final LOD level the node should stream/render (distance optimal, capped by maxDetailLod). */
38
+ targetLevel?: number;
39
+ /** Frames remaining before this node may switch LOD again (oscillation damping). */
40
+ lodCooldown?: number;
41
+ /** True when the node's bounding box currently intersects the camera frustum. Drives the LOD bias that
42
+ * pushes off-screen nodes to the coarsest level (they stay rendered, not hidden). */
43
+ inFrustum?: boolean;
44
+ /** Cached local-space bounding info used for the per-node frustum test (created once per leaf). */
45
+ cullBounds?: BoundingInfo;
46
+ }
47
+ /**
48
+ * Parsed contents of a PlayCanvas-style `lod-meta.json` file.
49
+ */
50
+ export interface ISOGLODMetadata {
51
+ /** Number of LOD levels (0 = highest detail). */
52
+ lodLevels: number;
53
+ /** SOG `meta.json` paths, relative to the metadata file, indexed by `ISOGLODEntry.file`. */
54
+ filenames: string[];
55
+ /** Optional always-on environment `.sog` bundle, relative to the metadata file. */
56
+ environment?: string;
57
+ /** Root of the LOD octree. */
58
+ tree: ISOGLODNode;
59
+ }
60
+ /**
61
+ * Selects which LOD value drives the {@link GaussianSplattingStream} debug wireframe colors.
62
+ */
63
+ export type GaussianSplattingStreamDebugLodSource = "optimal" | "current";
64
+ /**
65
+ * Options for {@link GaussianSplattingStream}.
66
+ */
67
+ export interface IGaussianSplattingStreamOptions {
68
+ /** URL of the fflate UMD module used to unzip `.sog` environment bundles. */
69
+ deflateURL?: string;
70
+ /** Pre-loaded fflate module. */
71
+ fflate?: any;
72
+ /** When true, renders a wireframe box per LOD node, colored by the node's LOD level. */
73
+ debugDisplay?: boolean;
74
+ /** Which LOD value drives the debug wireframe colors. Defaults to `"optimal"`. */
75
+ debugLodSource?: GaussianSplattingStreamDebugLodSource;
76
+ /** Distance (in local units) of the first LOD transition. PlayCanvas default `5`. */
77
+ lodBaseDistance?: number;
78
+ /** Geometric ratio between successive LOD transition distances. PlayCanvas default `3`. */
79
+ lodMultiplier?: number;
80
+ /** Distance multiplier applied to nodes behind the camera (`1` = no penalty). PlayCanvas default `1`. */
81
+ lodBehindPenalty?: number;
82
+ /** Lowest LOD index the optimal-LOD heuristic may select. Defaults to `0`. */
83
+ lodRangeMin?: number;
84
+ /** Highest LOD index the optimal-LOD heuristic may select. Defaults to `lodLevels - 1`. */
85
+ lodRangeMax?: number;
86
+ /** Maximum number of LOD source files to GPU-decode per frame (spreads work to avoid hitches). Defaults to `1`. */
87
+ maxDecodesPerFrame?: number;
88
+ /** Frames a node must wait after switching LOD before it may switch again (oscillation damping). Defaults to `10`. */
89
+ lodCooldownFrames?: number;
90
+ /** Minimum number of frames between LOD re-evaluations (throttles per-frame work during motion). Defaults to `4`. */
91
+ lodUpdateInterval?: number;
92
+ /** Minimum camera movement (world units) required to re-evaluate LODs. Defaults to `0.5`. */
93
+ lodUpdateDistance?: number;
94
+ /**
95
+ * Finest (most detailed) LOD level any node is allowed to render. `0` allows full detail (level 0);
96
+ * `1` caps detail at the next-coarser level, and so on. Higher values force a coarser maximum detail.
97
+ */
98
+ maxDetailLod?: number;
99
+ /**
100
+ * When true (default), LOD nodes outside the camera frustum are biased to their coarsest LOD rather than
101
+ * rendered at full detail. They stay in the sort/render set so they appear instantly (at low detail) when
102
+ * the camera turns toward them, then refine. Set to `false` to render every node at its distance LOD.
103
+ */
104
+ frustumCulling?: boolean;
105
+ }
106
+ /**
107
+ * Streams a PlayCanvas-style SOG LOD scene (`lod-meta.json`) into a single Gaussian Splatting mesh.
108
+ *
109
+ * Each selected SOG file (plus the environment) is loaded directly as GPU textures and decoded on the
110
+ * GPU into one unified, PlayCanvas-style square work buffer (no CPU splat decode or `updateData`). Only
111
+ * the splats of each node's currently-selected LOD are rendered/sorted via the mesh's interval filter.
112
+ *
113
+ * The coarsest (least-detail) LOD of every node is streamed first as a permanent base layer so the whole
114
+ * scene is visible quickly with no holes. A distance-based "optimal" LOD is then computed per node (see
115
+ * {@link evaluateOptimalLods}); finer LOD source files are streamed on demand and a node only switches to
116
+ * a finer LOD once that file is decoded, so transitions never flash or leave gaps.
117
+ *
118
+ * @experimental
119
+ */
120
+ export declare class GaussianSplattingStream extends GaussianSplattingMesh {
121
+ private readonly _metadata;
122
+ private readonly _rootUrl;
123
+ private readonly _streamOptions;
124
+ private readonly _leafNodes;
125
+ private _lodBaseDistance;
126
+ private _lodMultiplier;
127
+ private _lodBehindPenalty;
128
+ private _lodRangeMin;
129
+ private _lodRangeMax;
130
+ private _maxDecodesPerFrame;
131
+ private _lodCooldownFrames;
132
+ private _lodUpdateInterval;
133
+ private _lodUpdateDistance;
134
+ private _maxDetailLod;
135
+ private _frustumCulling;
136
+ private readonly _frustumPlanes;
137
+ private readonly _cullViewProj;
138
+ private _workBuffer;
139
+ private _useGpuPositionReadback;
140
+ private _readbackCandidate;
141
+ private _readbackProbed;
142
+ private readonly _fileBaseSplat;
143
+ private readonly _fileCounts;
144
+ private readonly _fileMeta;
145
+ private readonly _decodedFiles;
146
+ private readonly _loadingFiles;
147
+ private readonly _decodeQueue;
148
+ private _environmentRange;
149
+ private _environmentFiles;
150
+ private _lodObserver;
151
+ private _baseLayerReady;
152
+ private _framesSinceLodUpdate;
153
+ private readonly _lastLodCamPos;
154
+ private _forceLodUpdate;
155
+ private readonly _boundsMin;
156
+ private readonly _boundsMax;
157
+ private _debugDisplay;
158
+ private _debugLodSource;
159
+ private _debugMesh;
160
+ private _debugObserver;
161
+ private _debugColorData;
162
+ private _debugSignature;
163
+ private _disposed;
164
+ /**
165
+ * Returns true when the parsed JSON looks like a PlayCanvas-style `lod-meta.json` payload.
166
+ * @param data parsed JSON
167
+ * @returns whether the data is SOG LOD metadata
168
+ */
169
+ static IsLODMetadata(data: unknown): data is ISOGLODMetadata;
170
+ /**
171
+ * Creates a new SOG LOD streaming mesh and immediately starts streaming (non-blocking).
172
+ * @param name mesh name
173
+ * @param metadata parsed `lod-meta.json`
174
+ * @param rootUrl base URL the metadata's relative paths resolve against
175
+ * @param scene hosting scene
176
+ * @param options streaming options
177
+ */
178
+ constructor(name: string, metadata: ISOGLODMetadata, rootUrl: string, scene: Scene, options?: IGaussianSplattingStreamOptions);
179
+ getClassName(): string;
180
+ /**
181
+ * Finest (most detailed) LOD level any node is allowed to render. `0` allows full detail (level 0);
182
+ * `1` caps detail at the next-coarser level, and so on. Nodes already coarser than this cap (by
183
+ * distance) are unaffected. Changes take effect in real time.
184
+ */
185
+ get maxDetailLod(): number;
186
+ set maxDetailLod(value: number);
187
+ /**
188
+ * Coarsest LOD level index in the scene (number of LOD levels minus one). Useful as the upper bound
189
+ * for {@link maxDetailLod}.
190
+ */
191
+ get maxLodLevel(): number;
192
+ /**
193
+ * When true (default), nodes whose bounding box is outside the camera frustum are biased to the coarsest
194
+ * LOD instead of being hidden. They stay in the sort/render set (their off-screen splats are clipped), so
195
+ * turning the camera toward them shows low detail immediately with no invisible frames, then refines.
196
+ * Changes take effect in real time.
197
+ */
198
+ get frustumCulling(): boolean;
199
+ set frustumCulling(value: boolean);
200
+ /**
201
+ * When true, renders a wireframe box per LOD node, colored by the LOD level selected by {@link debugLodSource}.
202
+ */
203
+ get debugDisplay(): boolean;
204
+ set debugDisplay(value: boolean);
205
+ /**
206
+ * Selects which LOD value drives the debug wireframe colors: the distance-based `"optimal"` LOD
207
+ * (default, recomputed as the camera moves) or the `"current"` streamed/rendered LOD.
208
+ */
209
+ get debugLodSource(): GaussianSplattingStreamDebugLodSource;
210
+ set debugLodSource(value: GaussianSplattingStreamDebugLodSource);
211
+ dispose(doNotRecurse?: boolean): void;
212
+ /**
213
+ * Re-evaluates the optimal LOD for every node based on the camera position. The result is stored in
214
+ * each node's `optimalLod`. Rendering is unaffected; this currently drives only diagnostics and the
215
+ * debug wireframe display.
216
+ * @param camera camera to evaluate against (defaults to the scene's active camera)
217
+ */
218
+ evaluateOptimalLods(camera?: Nullable<Camera>): void;
219
+ /**
220
+ * The LOD level used to color a node's debug box, per {@link debugLodSource}.
221
+ * @param node leaf node
222
+ * @returns the displayed LOD level
223
+ */
224
+ private _displayedLodLevel;
225
+ /**
226
+ * Rebuilds the debug wireframe (evaluating the optimal LOD first when needed) and wires up the per-frame
227
+ * recolor observer. The observer runs for both LOD sources: "optimal" colors track the camera, and
228
+ * "current" colors track LOD levels as they stream in/out.
229
+ */
230
+ private _refreshDebugDisplay;
231
+ /**
232
+ * Per-frame debug update: recolors the existing wireframe in place whenever the displayed LOD levels
233
+ * change. For the "optimal" source the optimal LOD is recomputed first (it tracks the camera); for the
234
+ * "current" source the levels are driven by the streaming loop, so no recomputation is needed here. The
235
+ * geometry is never rebuilt, which avoids the dispose/recreate flicker while the camera moves.
236
+ */
237
+ private _onDebugFrame;
238
+ /**
239
+ * Builds the LOD-node wireframe boxes once (one box per leaf node), colored by the displayed LOD level.
240
+ * The color vertex buffer is created updatable so subsequent recolors can happen in place.
241
+ */
242
+ private _buildDebugMesh;
243
+ /**
244
+ * Recolors the existing wireframe in place from the current displayed LOD levels, without rebuilding geometry.
245
+ */
246
+ private _updateDebugColors;
247
+ /**
248
+ * Computes a cheap 32-bit rolling hash of every leaf's displayed LOD level, used to detect when the
249
+ * debug wireframe needs recoloring. Avoids per-frame string allocation in the render loop.
250
+ * @returns a numeric signature of the current displayed LOD levels
251
+ */
252
+ private _computeDebugSignature;
253
+ /**
254
+ * Disposes the LOD-node wireframe boxes and stops live debug updates.
255
+ */
256
+ private _clearDebugDisplay;
257
+ /**
258
+ * Walks the LOD tree and records every leaf that carries renderable LOD entries, capturing the set of
259
+ * available levels and the coarsest (base) level for each.
260
+ * @param node current tree node
261
+ */
262
+ private _collectLodEntries;
263
+ /**
264
+ * Streams the scene: learns every source file's splat count, allocates one unified GPU work buffer
265
+ * sized for all LOD files, decodes the environment and the coarsest LOD of every node as a permanent
266
+ * base layer, then installs the per-frame loop that streams finer LODs on demand.
267
+ */
268
+ private _streamAllAsync;
269
+ /**
270
+ * Collects the unique set of source file indices referenced by any LOD of any leaf, sorted ascending.
271
+ * @returns sorted unique file indices
272
+ */
273
+ private _collectAllFileIds;
274
+ /**
275
+ * Fetches the environment bundle and every referenced file's metadata to learn splat counts, caching
276
+ * each file's parsed metadata for the later on-demand decode. Metadata fetches run in parallel.
277
+ * @param fileIds file indices to fetch metadata for
278
+ * @returns the environment splat count (0 when there is no environment)
279
+ */
280
+ private _gatherCountsAsync;
281
+ /**
282
+ * Queues a file for on-demand decode if it isn't already decoded, in flight, or already queued.
283
+ * @param fileId file index to decode
284
+ */
285
+ private _enqueueDecode;
286
+ /**
287
+ * Starts up to {@link _maxDecodesPerFrame} queued decodes for this frame. Decodes run asynchronously
288
+ * and promote any waiting nodes once they complete.
289
+ */
290
+ private _pumpDecodeQueue;
291
+ /**
292
+ * Writes a decoded splat range's positions into the shared buffer, expands the bounds, and incrementally
293
+ * patches the sort worker.
294
+ * @param positions stride-4 positions for the range
295
+ * @param base first splat index of the range in the work buffer
296
+ * @param count number of splats in the range
297
+ */
298
+ private _applyPositions;
299
+ /**
300
+ * One-time validation of GPU position readback: reads a sample of the just-decoded range back from the work
301
+ * buffer and compares it to the CPU-decoded positions. Enables {@link _useGpuPositionReadback} only on an
302
+ * exact (within float tolerance) match, so an unsupported or incorrect readback (e.g. a backend without the
303
+ * required texture usage, or an orientation mismatch) safely keeps the CPU decode path.
304
+ * @param base first splat index of the validated range
305
+ * @param count number of splats in the range
306
+ * @param cpuPositions the CPU-decoded stride-4 positions for the range (ground truth)
307
+ */
308
+ private _probeReadbackAsync;
309
+ /**
310
+ * Resolves the decoded positions for a splat range and applies them. Once GPU readback has been validated,
311
+ * positions are read back from the work buffer (non-blocking) and `pack.positions` is empty; otherwise the
312
+ * CPU-decoded `pack.positions` are used, and — on the first such decode — the GPU readback is validated
313
+ * against them so subsequent decodes can use the fast path.
314
+ * @param pack the parsed SOG pack (its `positions` is populated only on the CPU path)
315
+ * @param base first splat index of the range in the work buffer
316
+ * @param count number of splats in the range
317
+ * @returns whether positions were applied
318
+ */
319
+ private _applyDecodedPositionsAsync;
320
+ /**
321
+ * Decodes the always-on environment bundle into its work-buffer block and activates its range.
322
+ */
323
+ private _decodeEnvironmentAsync;
324
+ /**
325
+ * Loads one LOD source file as GPU textures, decodes it into its fixed work-buffer block, records its
326
+ * CPU centers for sorting, frees the source textures, then promotes any nodes that were waiting for it.
327
+ * Concurrent or repeat requests for the same file are ignored.
328
+ * @param fileId file index to decode
329
+ */
330
+ private _decodeFileAsync;
331
+ /**
332
+ * Snaps a desired LOD level to the nearest level the node provides, while never selecting a level finer
333
+ * than {@link maxDetailLod} (i.e. with an index below the cap). Ties prefer the finer allowed level. If
334
+ * the node has no level at or coarser than the cap, its coarsest available level is used.
335
+ * @param node leaf node
336
+ * @param desired desired LOD level
337
+ * @returns the chosen available level
338
+ */
339
+ private _cappedLevelForNode;
340
+ /**
341
+ * Computes each node's {@link ISOGLODNode.targetLevel}: the distance-based optimal level snapped to an
342
+ * available level, capped so no node renders finer (more detailed) than {@link maxDetailLod}.
343
+ */
344
+ private _computeTargetLevels;
345
+ /**
346
+ * Applies each node's {@link ISOGLODNode.targetLevel}: switches a node to its target level when that
347
+ * level's file is already decoded, otherwise queues the file and leaves the node on its current LOD (so
348
+ * nothing ever disappears). Nodes within their post-switch cooldown are left untouched to damp oscillation.
349
+ * @returns true when at least one node changed LOD (callers should refresh the active ranges)
350
+ */
351
+ private _applyDesiredLods;
352
+ /**
353
+ * Per-frame LOD streaming loop. Ticks cooldowns and pumps the decode queue every frame, and runs the
354
+ * cheap per-node frustum test every frame so the off-screen LOD bias tracks camera rotation. The LOD
355
+ * re-evaluation is throttled to at most every {@link _lodUpdateInterval} frames once the camera has
356
+ * translated far enough, but also runs immediately whenever a node enters/leaves the frustum (so its
357
+ * detail upgrades/downgrades promptly) or a cap change forces it. Active ranges rebuild on any LOD change.
358
+ */
359
+ private _onLodFrame;
360
+ /**
361
+ * Updates each leaf node's {@link ISOGLODNode.inFrustum} flag from a per-node frustum test against the
362
+ * active camera. When {@link frustumCulling} is disabled (or there is no camera) every node is marked
363
+ * in-frustum. Bounds are static (from the LOD tree), so flags are valid for all nodes regardless of
364
+ * decode state. Returns true when any node's in-frustum state changed (so the LOD bias must be re-applied).
365
+ * @returns whether any node's in-frustum state changed
366
+ */
367
+ private _updateNodeFrustum;
368
+ /**
369
+ * Reads the splat count from SOG metadata.
370
+ * @param data SOG metadata
371
+ * @returns the splat count
372
+ */
373
+ private static _GetSplatCount;
374
+ /**
375
+ * Disposes all GPU source textures of a SOG pack (they are only needed for the one decode pass).
376
+ * @param pack the SOG texture pack
377
+ */
378
+ private static _DisposePack;
379
+ /**
380
+ * Expands the running splat-center bounds with a newly decoded file's centers and updates the
381
+ * mesh bounding info so the GS is correctly frustum-culled and pickable.
382
+ * @param positions stride-4 splat centers for the new file
383
+ * @param count number of splats
384
+ */
385
+ private _updateBounds;
386
+ /**
387
+ * Rebuilds the active interval set from the environment plus each node's currently-selected LOD entry,
388
+ * coalesces adjacent ranges, and pushes the result to the sort worker.
389
+ */
390
+ private _refreshActiveRanges;
391
+ /**
392
+ * Sorts and merges adjacent/overlapping ranges to keep the interval list compact.
393
+ * @param ranges raw ranges
394
+ * @returns coalesced ranges
395
+ */
396
+ private static _CoalesceRanges;
397
+ /**
398
+ * Unzips a `.sog` bundle into a name -> bytes map, loading fflate on demand.
399
+ * @param data zipped bytes
400
+ * @returns map of entry name to bytes
401
+ */
402
+ private _unzipAsync;
403
+ }
404
+ export {};