UNPKG

@playcanvas/splat-transform

Version:

Library and CLI tool for 3D Gaussian splat format conversion and transformation

18 lines (17 loc) 1.79 kB
/** * Equirect emit-pairs tile walk with ±π longitude seam wrap. * * Reads: sX, sY, radius, tsz, gox, goy, cap, i, * uniforms.groupTilesX, uniforms.groupTilesY * Defines: writes (tileKeys, splatValues) pairs for this splat's bbox * Returns: early if the bbox is empty * * Recomputes the raw X range (possibly wrapping past the seam) — must * match the project shader's `tile-aabb-equirect` coverage computation * exactly. Each emitted tx is wrapped into [0, groupTilesX-1] via * modular arithmetic. The rasterize-binned shader compensates by * wrapping its per-pixel dx into [-W/2, W/2], so a wrapped tile pulls * the splat's footprint from the correct copy across the seam. */ declare const tileWalkEquirect = "\n let minTXraw = i32(floor((sX - radius - gox) / tsz));\n let maxTXraw = i32(floor((sX + radius - gox) / tsz));\n let txCountRaw = maxTXraw - minTXraw + 1;\n let groupTilesX_i = i32(uniforms.groupTilesX);\n let txCount = min(txCountRaw, groupTilesX_i);\n let minTY = max(0, i32(floor((sY - radius - goy) / tsz)));\n let maxTY = min(i32(uniforms.groupTilesY) - 1, i32(floor((sY + radius - goy) / tsz)));\n if (txCount <= 0 || maxTY < minTY) { return; }\n\n var slot = emitOffset[i];\n let end = slot + cap;\n for (var ty: i32 = minTY; ty <= maxTY; ty = ty + 1) {\n if (slot >= end) { break; }\n for (var k: i32 = 0; k < txCount; k = k + 1) {\n if (slot >= end) { break; }\n var tx = (minTXraw + k) % groupTilesX_i;\n if (tx < 0) { tx = tx + groupTilesX_i; }\n let t = u32(ty) * uniforms.groupTilesX + u32(tx);\n tileKeys[slot] = t;\n splatValues[slot] = i;\n slot = slot + 1u;\n }\n }\n"; export { tileWalkEquirect };