playcanvas
Version:
PlayCanvas WebGL game engine
3 lines (2 loc) • 655 B
TypeScript
declare const _default: "\n uniform usampler2D orderTexture;\n uniform sampler2D sourceTexture;\n uniform highp uint numSplats;\n\n void main(void) {\n uint w = uint(textureSize(sourceTexture, 0).x);\n uint idx = uint(gl_FragCoord.x) + uint(gl_FragCoord.y) * w;\n if (idx >= numSplats) discard;\n\n // fetch the source index and calculate source uv\n uint sidx = texelFetch(orderTexture, ivec2(gl_FragCoord.xy), 0).x;\n uvec2 suv = uvec2(sidx % w, sidx / w);\n\n // sample the source texture\n gl_FragColor = texelFetch(sourceTexture, ivec2(suv), 0);\n }\n";
export default _default;