playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
20 lines (14 loc) • 474 B
JavaScript
// Compute-compatible splat identification struct and helper
// Uses uniforms.splatTextureSize (compute uniform struct) instead of uniform.splatTextureSize (vertex)
var computeSplatSource = /* wgsl */ `
struct Splat {
index: u32,
uv: vec2i
}
var<private> splat: Splat;
fn setSplat(idx: u32) {
splat.index = idx;
splat.uv = vec2i(i32(idx % uniforms.splatTextureSize), i32(idx / uniforms.splatTextureSize));
}
`;
export { computeSplatSource as default };