@babylonjs/loaders 9.11.0 → 9.12.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.
Files changed (77) 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 +341 -0
  56. package/SPLAT/gaussianSplattingStream.js +976 -0
  57. package/SPLAT/gaussianSplattingStream.js.map +1 -0
  58. package/SPLAT/gaussianSplattingWorkBuffer.d.ts +51 -0
  59. package/SPLAT/gaussianSplattingWorkBuffer.js +159 -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.js +18 -16
  68. package/SPLAT/sog.js.map +1 -1
  69. package/SPLAT/splatFileLoader.d.ts +8 -0
  70. package/SPLAT/splatFileLoader.js +49 -0
  71. package/SPLAT/splatFileLoader.js.map +1 -1
  72. package/dynamic.js +9 -0
  73. package/dynamic.js.map +1 -1
  74. package/index.d.ts +1 -0
  75. package/index.js +1 -0
  76. package/index.js.map +1 -1
  77. 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,CAAC,EAAE,CAAC,EAAE,CAAC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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,IAAI,CAAC,CAAC;AAClD,CAAC;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O,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,341 @@
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
+ /**
6
+ * A single LOD variant of a tree node: a contiguous splat range inside one streamed SOG file.
7
+ */
8
+ interface ISOGLODEntry {
9
+ /** Index into {@link ISOGLODMetadata.filenames}. */
10
+ file: number;
11
+ /** First splat index inside that file. */
12
+ offset: number;
13
+ /** Number of splats. */
14
+ count: number;
15
+ }
16
+ /**
17
+ * A node of the PlayCanvas-style SOG LOD octree. Internal nodes have `children`; leaves have `lods`.
18
+ */
19
+ interface ISOGLODNode {
20
+ bound: {
21
+ min: number[];
22
+ max: number[];
23
+ };
24
+ children?: ISOGLODNode[];
25
+ lods?: {
26
+ [level: string]: ISOGLODEntry;
27
+ };
28
+ /** LOD level currently streamed/rendered for this node, or undefined until its base LOD is ready. */
29
+ activeLod?: number;
30
+ /** Distance-based ideal LOD level for this node, recomputed per frame. */
31
+ optimalLod?: number;
32
+ /** Available LOD levels for this leaf, sorted ascending (0 = finest). Set during the tree walk. */
33
+ availableLevels?: number[];
34
+ /** Coarsest available level (= max key), always streamed as the permanent base layer. */
35
+ baseLod?: number;
36
+ /** Final LOD level the node should stream/render (distance optimal, capped by maxDetailLod). */
37
+ targetLevel?: number;
38
+ /** Frames remaining before this node may switch LOD again (oscillation damping). */
39
+ lodCooldown?: number;
40
+ }
41
+ /**
42
+ * Parsed contents of a PlayCanvas-style `lod-meta.json` file.
43
+ */
44
+ export interface ISOGLODMetadata {
45
+ /** Number of LOD levels (0 = highest detail). */
46
+ lodLevels: number;
47
+ /** SOG `meta.json` paths, relative to the metadata file, indexed by `ISOGLODEntry.file`. */
48
+ filenames: string[];
49
+ /** Optional always-on environment `.sog` bundle, relative to the metadata file. */
50
+ environment?: string;
51
+ /** Root of the LOD octree. */
52
+ tree: ISOGLODNode;
53
+ }
54
+ /**
55
+ * Selects which LOD value drives the {@link GaussianSplattingStream} debug wireframe colors.
56
+ */
57
+ export type GaussianSplattingStreamDebugLodSource = "optimal" | "current";
58
+ /**
59
+ * Options for {@link GaussianSplattingStream}.
60
+ */
61
+ export interface IGaussianSplattingStreamOptions {
62
+ /** URL of the fflate UMD module used to unzip `.sog` environment bundles. */
63
+ deflateURL?: string;
64
+ /** Pre-loaded fflate module. */
65
+ fflate?: any;
66
+ /** When true, renders a wireframe box per LOD node, colored by the node's LOD level. */
67
+ debugDisplay?: boolean;
68
+ /** Which LOD value drives the debug wireframe colors. Defaults to `"optimal"`. */
69
+ debugLodSource?: GaussianSplattingStreamDebugLodSource;
70
+ /** Distance (in local units) of the first LOD transition. PlayCanvas default `5`. */
71
+ lodBaseDistance?: number;
72
+ /** Geometric ratio between successive LOD transition distances. PlayCanvas default `3`. */
73
+ lodMultiplier?: number;
74
+ /** Distance multiplier applied to nodes behind the camera (`1` = no penalty). PlayCanvas default `1`. */
75
+ lodBehindPenalty?: number;
76
+ /** Lowest LOD index the optimal-LOD heuristic may select. Defaults to `0`. */
77
+ lodRangeMin?: number;
78
+ /** Highest LOD index the optimal-LOD heuristic may select. Defaults to `lodLevels - 1`. */
79
+ lodRangeMax?: number;
80
+ /** Maximum number of LOD source files to GPU-decode per frame (spreads work to avoid hitches). Defaults to `1`. */
81
+ maxDecodesPerFrame?: number;
82
+ /** Frames a node must wait after switching LOD before it may switch again (oscillation damping). Defaults to `10`. */
83
+ lodCooldownFrames?: number;
84
+ /** Minimum number of frames between LOD re-evaluations (throttles per-frame work during motion). Defaults to `4`. */
85
+ lodUpdateInterval?: number;
86
+ /** Minimum camera movement (world units) required to re-evaluate LODs. Defaults to `0.5`. */
87
+ lodUpdateDistance?: number;
88
+ /**
89
+ * Finest (most detailed) LOD level any node is allowed to render. `0` allows full detail (level 0);
90
+ * `1` caps detail at the next-coarser level, and so on. Higher values force a coarser maximum detail.
91
+ */
92
+ maxDetailLod?: number;
93
+ }
94
+ /**
95
+ * Streams a PlayCanvas-style SOG LOD scene (`lod-meta.json`) into a single Gaussian Splatting mesh.
96
+ *
97
+ * Each selected SOG file (plus the environment) is loaded directly as GPU textures and decoded on the
98
+ * GPU into one unified, PlayCanvas-style square work buffer (no CPU splat decode or `updateData`). Only
99
+ * the splats of each node's currently-selected LOD are rendered/sorted via the mesh's interval filter.
100
+ *
101
+ * The coarsest (least-detail) LOD of every node is streamed first as a permanent base layer so the whole
102
+ * scene is visible quickly with no holes. A distance-based "optimal" LOD is then computed per node (see
103
+ * {@link evaluateOptimalLods}); finer LOD source files are streamed on demand and a node only switches to
104
+ * a finer LOD once that file is decoded, so transitions never flash or leave gaps.
105
+ *
106
+ * @experimental
107
+ */
108
+ export declare class GaussianSplattingStream extends GaussianSplattingMesh {
109
+ private readonly _metadata;
110
+ private readonly _rootUrl;
111
+ private readonly _streamOptions;
112
+ private readonly _leafNodes;
113
+ private _lodBaseDistance;
114
+ private _lodMultiplier;
115
+ private _lodBehindPenalty;
116
+ private _lodRangeMin;
117
+ private _lodRangeMax;
118
+ private _maxDecodesPerFrame;
119
+ private _lodCooldownFrames;
120
+ private _lodUpdateInterval;
121
+ private _lodUpdateDistance;
122
+ private _maxDetailLod;
123
+ private _workBuffer;
124
+ private readonly _fileBaseSplat;
125
+ private readonly _fileCounts;
126
+ private readonly _fileMeta;
127
+ private readonly _decodedFiles;
128
+ private readonly _loadingFiles;
129
+ private readonly _decodeQueue;
130
+ private _environmentRange;
131
+ private _environmentFiles;
132
+ private _lodObserver;
133
+ private _baseLayerReady;
134
+ private _framesSinceLodUpdate;
135
+ private readonly _lastLodCamPos;
136
+ private _forceLodUpdate;
137
+ private readonly _boundsMin;
138
+ private readonly _boundsMax;
139
+ private _debugDisplay;
140
+ private _debugLodSource;
141
+ private _debugMesh;
142
+ private _debugObserver;
143
+ private _debugColorData;
144
+ private _debugSignature;
145
+ private _disposed;
146
+ /**
147
+ * Returns true when the parsed JSON looks like a PlayCanvas-style `lod-meta.json` payload.
148
+ * @param data parsed JSON
149
+ * @returns whether the data is SOG LOD metadata
150
+ */
151
+ static IsLODMetadata(data: unknown): data is ISOGLODMetadata;
152
+ /**
153
+ * Creates a new SOG LOD streaming mesh and immediately starts streaming (non-blocking).
154
+ * @param name mesh name
155
+ * @param metadata parsed `lod-meta.json`
156
+ * @param rootUrl base URL the metadata's relative paths resolve against
157
+ * @param scene hosting scene
158
+ * @param options streaming options
159
+ */
160
+ constructor(name: string, metadata: ISOGLODMetadata, rootUrl: string, scene: Scene, options?: IGaussianSplattingStreamOptions);
161
+ getClassName(): string;
162
+ /**
163
+ * Finest (most detailed) LOD level any node is allowed to render. `0` allows full detail (level 0);
164
+ * `1` caps detail at the next-coarser level, and so on. Nodes already coarser than this cap (by
165
+ * distance) are unaffected. Changes take effect in real time.
166
+ */
167
+ get maxDetailLod(): number;
168
+ set maxDetailLod(value: number);
169
+ /**
170
+ * Coarsest LOD level index in the scene (number of LOD levels minus one). Useful as the upper bound
171
+ * for {@link maxDetailLod}.
172
+ */
173
+ get maxLodLevel(): number;
174
+ /**
175
+ * When true, renders a wireframe box per LOD node, colored by the LOD level selected by {@link debugLodSource}.
176
+ */
177
+ get debugDisplay(): boolean;
178
+ set debugDisplay(value: boolean);
179
+ /**
180
+ * Selects which LOD value drives the debug wireframe colors: the distance-based `"optimal"` LOD
181
+ * (default, recomputed as the camera moves) or the `"current"` streamed/rendered LOD.
182
+ */
183
+ get debugLodSource(): GaussianSplattingStreamDebugLodSource;
184
+ set debugLodSource(value: GaussianSplattingStreamDebugLodSource);
185
+ dispose(doNotRecurse?: boolean): void;
186
+ /**
187
+ * Re-evaluates the optimal LOD for every node based on the camera position. The result is stored in
188
+ * each node's `optimalLod`. Rendering is unaffected; this currently drives only diagnostics and the
189
+ * debug wireframe display.
190
+ * @param camera camera to evaluate against (defaults to the scene's active camera)
191
+ */
192
+ evaluateOptimalLods(camera?: Nullable<Camera>): void;
193
+ /**
194
+ * The LOD level used to color a node's debug box, per {@link debugLodSource}.
195
+ * @param node leaf node
196
+ * @returns the displayed LOD level
197
+ */
198
+ private _displayedLodLevel;
199
+ /**
200
+ * Rebuilds the debug wireframe (evaluating the optimal LOD first when needed) and wires up the per-frame
201
+ * recolor observer. The observer runs for both LOD sources: "optimal" colors track the camera, and
202
+ * "current" colors track LOD levels as they stream in/out.
203
+ */
204
+ private _refreshDebugDisplay;
205
+ /**
206
+ * Per-frame debug update: recolors the existing wireframe in place whenever the displayed LOD levels
207
+ * change. For the "optimal" source the optimal LOD is recomputed first (it tracks the camera); for the
208
+ * "current" source the levels are driven by the streaming loop, so no recomputation is needed here. The
209
+ * geometry is never rebuilt, which avoids the dispose/recreate flicker while the camera moves.
210
+ */
211
+ private _onDebugFrame;
212
+ /**
213
+ * Builds the LOD-node wireframe boxes once (one box per leaf node), colored by the displayed LOD level.
214
+ * The color vertex buffer is created updatable so subsequent recolors can happen in place.
215
+ */
216
+ private _buildDebugMesh;
217
+ /**
218
+ * Recolors the existing wireframe in place from the current displayed LOD levels, without rebuilding geometry.
219
+ */
220
+ private _updateDebugColors;
221
+ /**
222
+ * Computes a cheap 32-bit rolling hash of every leaf's displayed LOD level, used to detect when the
223
+ * debug wireframe needs recoloring. Avoids per-frame string allocation in the render loop.
224
+ * @returns a numeric signature of the current displayed LOD levels
225
+ */
226
+ private _computeDebugSignature;
227
+ /**
228
+ * Disposes the LOD-node wireframe boxes and stops live debug updates.
229
+ */
230
+ private _clearDebugDisplay;
231
+ /**
232
+ * Walks the LOD tree and records every leaf that carries renderable LOD entries, capturing the set of
233
+ * available levels and the coarsest (base) level for each.
234
+ * @param node current tree node
235
+ */
236
+ private _collectLodEntries;
237
+ /**
238
+ * Streams the scene: learns every source file's splat count, allocates one unified GPU work buffer
239
+ * sized for all LOD files, decodes the environment and the coarsest LOD of every node as a permanent
240
+ * base layer, then installs the per-frame loop that streams finer LODs on demand.
241
+ */
242
+ private _streamAllAsync;
243
+ /**
244
+ * Collects the unique set of source file indices referenced by any LOD of any leaf, sorted ascending.
245
+ * @returns sorted unique file indices
246
+ */
247
+ private _collectAllFileIds;
248
+ /**
249
+ * Fetches the environment bundle and every referenced file's metadata to learn splat counts, caching
250
+ * each file's parsed metadata for the later on-demand decode. Metadata fetches run in parallel.
251
+ * @param fileIds file indices to fetch metadata for
252
+ * @returns the environment splat count (0 when there is no environment)
253
+ */
254
+ private _gatherCountsAsync;
255
+ /**
256
+ * Queues a file for on-demand decode if it isn't already decoded, in flight, or already queued.
257
+ * @param fileId file index to decode
258
+ */
259
+ private _enqueueDecode;
260
+ /**
261
+ * Starts up to {@link _maxDecodesPerFrame} queued decodes for this frame. Decodes run asynchronously
262
+ * and promote any waiting nodes once they complete.
263
+ */
264
+ private _pumpDecodeQueue;
265
+ /**
266
+ * Decodes the always-on environment bundle into its work-buffer block and activates its range.
267
+ */
268
+ private _decodeEnvironmentAsync;
269
+ /**
270
+ * Loads one LOD source file as GPU textures, decodes it into its fixed work-buffer block, records its
271
+ * CPU centers for sorting, frees the source textures, then promotes any nodes that were waiting for it.
272
+ * Concurrent or repeat requests for the same file are ignored.
273
+ * @param fileId file index to decode
274
+ */
275
+ private _decodeFileAsync;
276
+ /**
277
+ * Snaps a desired LOD level to the nearest level the node provides, while never selecting a level finer
278
+ * than {@link maxDetailLod} (i.e. with an index below the cap). Ties prefer the finer allowed level. If
279
+ * the node has no level at or coarser than the cap, its coarsest available level is used.
280
+ * @param node leaf node
281
+ * @param desired desired LOD level
282
+ * @returns the chosen available level
283
+ */
284
+ private _cappedLevelForNode;
285
+ /**
286
+ * Computes each node's {@link ISOGLODNode.targetLevel}: the distance-based optimal level snapped to an
287
+ * available level, capped so no node renders finer (more detailed) than {@link maxDetailLod}.
288
+ */
289
+ private _computeTargetLevels;
290
+ /**
291
+ * Applies each node's {@link ISOGLODNode.targetLevel}: switches a node to its target level when that
292
+ * level's file is already decoded, otherwise queues the file and leaves the node on its current LOD (so
293
+ * nothing ever disappears). Nodes within their post-switch cooldown are left untouched to damp oscillation.
294
+ * @returns true when at least one node changed LOD (callers should refresh the active ranges)
295
+ */
296
+ private _applyDesiredLods;
297
+ /**
298
+ * Per-frame LOD streaming loop. Ticks cooldowns and pumps the decode queue every frame, but throttles
299
+ * the expensive LOD re-evaluation (optimal-LOD computation, budget balancing, desired-LOD application
300
+ * and interval rebuild) to run at most every {@link _lodUpdateInterval} frames and only after the camera
301
+ * has moved far enough, so continuous camera motion no longer rebuilds the interval set every frame. A
302
+ * budget change forces a single immediate update regardless of the throttle.
303
+ */
304
+ private _onLodFrame;
305
+ /**
306
+ * Reads the splat count from SOG metadata.
307
+ * @param data SOG metadata
308
+ * @returns the splat count
309
+ */
310
+ private static _GetSplatCount;
311
+ /**
312
+ * Disposes all GPU source textures of a SOG pack (they are only needed for the one decode pass).
313
+ * @param pack the SOG texture pack
314
+ */
315
+ private static _DisposePack;
316
+ /**
317
+ * Expands the running splat-center bounds with a newly decoded file's centers and updates the
318
+ * mesh bounding info so the GS is correctly frustum-culled and pickable.
319
+ * @param positions stride-4 splat centers for the new file
320
+ * @param count number of splats
321
+ */
322
+ private _updateBounds;
323
+ /**
324
+ * Rebuilds the active interval set from the environment plus each node's currently-selected LOD entry,
325
+ * coalesces adjacent ranges, and pushes the result to the sort worker.
326
+ */
327
+ private _refreshActiveRanges;
328
+ /**
329
+ * Sorts and merges adjacent/overlapping ranges to keep the interval list compact.
330
+ * @param ranges raw ranges
331
+ * @returns coalesced ranges
332
+ */
333
+ private static _CoalesceRanges;
334
+ /**
335
+ * Unzips a `.sog` bundle into a name -> bytes map, loading fflate on demand.
336
+ * @param data zipped bytes
337
+ * @returns map of entry name to bytes
338
+ */
339
+ private _unzipAsync;
340
+ }
341
+ export {};