MCPcopy Create free account
hub / github.com/sparkjsdev/spark / encodeExtSplat

Function encodeExtSplat

src/utils.ts:400–428  ·  view source on GitHub ↗
(
  extArrays: [Uint32Array, Uint32Array],
  index: number,
  x: number,
  y: number,
  z: number,
  scaleX: number,
  scaleY: number,
  scaleZ: number,
  quatX: number,
  quatY: number,
  quatZ: number,
  quatW: number,
  opacity: number,
  r: number,
  g: number,
  b: number,
)

Source from the content-addressed store, hash-verified

398}
399
400export function encodeExtSplat(
401 extArrays: [Uint32Array, Uint32Array],
402 index: number,
403 x: number,
404 y: number,
405 z: number,
406 scaleX: number,
407 scaleY: number,
408 scaleZ: number,
409 quatX: number,
410 quatY: number,
411 quatZ: number,
412 quatW: number,
413 opacity: number,
414 r: number,
415 g: number,
416 b: number,
417) {
418 const i4 = index * 4;
419 const [extA, extB] = extArrays;
420 extA[i4] = floatBitsToUint(x);
421 extA[i4 + 1] = floatBitsToUint(y);
422 extA[i4 + 2] = floatBitsToUint(z);
423 extA[i4 + 3] = toHalf(opacity);
424 extB[i4] = toHalf(r) | (toHalf(g) << 16);
425 extB[i4 + 1] = toHalf(b) | (toHalf(Math.log(scaleX)) << 16);
426 extB[i4 + 2] = toHalf(Math.log(scaleY)) | (toHalf(Math.log(scaleZ)) << 16);
427 extB[i4 + 3] = encodeQuatOctXy1010R12(quatX, quatY, quatZ, quatW);
428}
429
430export function decodeExtSplat(
431 extArrays: [Uint32Array, Uint32Array],

Callers 2

setSplatMethod · 0.90
pushSplatMethod · 0.90

Calls 2

encodeQuatOctXy1010R12Function · 0.85
floatBitsToUintFunction · 0.70

Tested by

no test coverage detected