playcanvas
Version:
PlayCanvas WebGL game engine
3 lines (2 loc) • 865 B
TypeScript
declare const _default: "\n var orderTexture: texture_2d<u32>;\n var sourceTexture: texture_2d<f32>;\n uniform numSplats: u32;\n\n @fragment\n fn fragmentMain(input: FragmentInput) -> FragmentOutput {\n var output: FragmentOutput;\n\n let w: u32 = textureDimensions(sourceTexture, 0).x;\n let idx: u32 = u32(pcPosition.x) + u32(pcPosition.y) * w;\n if (idx >= uniform.numSplats) {\n discard;\n return output;\n }\n\n // fetch the source index and calculate source uv\n let sidx: u32 = textureLoad(orderTexture, vec2<i32>(input.position.xy), 0).x;\n let suv: vec2<u32> = vec2<u32>(sidx % w, sidx / w);\n\n // sample the source texture\n output.color = textureLoad(sourceTexture, vec2<i32>(suv), 0);\n return output;\n }\n";
export default _default;