UNPKG

@playcanvas/splat-transform

Version:

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

16 lines (15 loc) 1.39 kB
/** * Pinhole emit-pairs tile walk. * * 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 * * Walks the clamped per-splat tile bbox row-major and writes (tile, * splat) pair entries until either the bbox is exhausted or the * `coverage[i]` cap is hit. Mirrors the bbox computed by the pinhole * project shader's `tile-aabb-pinhole` chunk. */ declare const tileWalkPinhole = "\n let minTX = max(0, i32(floor((sX - radius - gox) / tsz)));\n let maxTX = min(i32(uniforms.groupTilesX) - 1, i32(floor((sX + radius - gox) / tsz)));\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 (maxTX < minTX || 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 tx: i32 = minTX; tx <= maxTX; tx = tx + 1) {\n if (slot >= end) { break; }\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 { tileWalkPinhole };