MCPcopy Index your code
hub / github.com/sparkjsdev/spark / fetchSplat

Method fetchSplat

src/ExtSplats.ts:270–296  ·  view source on GitHub ↗
({
    index,
    viewOrigin,
  }: { index: DynoVal<"int">; viewOrigin?: DynoVal<"vec3"> })

Source from the content-addressed store, hash-verified

268 }
269
270 fetchSplat({
271 index,
272 viewOrigin,
273 }: { index: DynoVal<"int">; viewOrigin?: DynoVal<"vec3"> }): DynoVal<
274 typeof Gsplat
275 > {
276 let gsplat = readExtSplat(this.dyno, index);
277
278 if (this.hasRgbDir() && viewOrigin) {
279 const splatCenter = splitGsplat(gsplat).outputs.center;
280 const viewDir = normalize(sub(splatCenter, viewOrigin));
281 const { sh1Texture, sh2Texture, sh3TextureA, sh3TextureB } =
282 this.ensureShTextures();
283 let { rgb } = evaluateExtSH({
284 coord: splatTexCoord(index),
285 viewDir,
286 numSh: this.dynoNumSh,
287 sh1Texture,
288 sh2Texture,
289 sh3TextureA,
290 sh3TextureB,
291 });
292 rgb = add(rgb, splitGsplat(gsplat).outputs.rgb);
293 gsplat = combineGsplat({ gsplat, rgb });
294 }
295 return gsplat;
296 }
297
298 private ensureShTextures(): {
299 sh1Texture?: DynoUsampler2DArray<"sh1", THREE.DataArrayTexture>;

Callers

nothing calls this directly

Calls 10

hasRgbDirMethod · 0.95
ensureShTexturesMethod · 0.95
readExtSplatFunction · 0.90
splitGsplatFunction · 0.90
normalizeFunction · 0.90
subFunction · 0.90
splatTexCoordFunction · 0.90
addFunction · 0.90
combineGsplatFunction · 0.90
evaluateExtSHFunction · 0.85

Tested by

no test coverage detected