UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

3 lines (2 loc) 1.58 kB
declare const _default: "\n\nvarying vUv0: vec2f;\n\nvar source: texture_2d<f32>;\nvar sourceSampler: sampler;\nuniform pixelOffset: vec2f;\n\nfn isUsed(pixel: vec4f) -> bool {\n #ifdef HDR\n return any(pixel.rgb > vec3f(0.0));\n #else\n return pixel.a > 0.0;\n #endif\n}\n\n@fragment\nfn fragmentMain(input: FragmentInput) -> FragmentOutput {\n var c: vec4f = textureSampleLevel(source, sourceSampler, input.vUv0, 0.0);\n c = select(textureSampleLevel(source, sourceSampler, input.vUv0 - uniform.pixelOffset, 0.0), c, isUsed(c));\n c = select(textureSampleLevel(source, sourceSampler, input.vUv0 + vec2f(0.0, -uniform.pixelOffset.y), 0.0), c, isUsed(c));\n c = select(textureSampleLevel(source, sourceSampler, input.vUv0 + vec2f(uniform.pixelOffset.x, -uniform.pixelOffset.y), 0.0), c, isUsed(c));\n c = select(textureSampleLevel(source, sourceSampler, input.vUv0 + vec2f(-uniform.pixelOffset.x, 0.0), 0.0), c, isUsed(c));\n c = select(textureSampleLevel(source, sourceSampler, input.vUv0 + vec2f(uniform.pixelOffset.x, 0.0), 0.0), c, isUsed(c));\n c = select(textureSampleLevel(source, sourceSampler, input.vUv0 + vec2f(-uniform.pixelOffset.x, uniform.pixelOffset.y), 0.0), c, isUsed(c));\n c = select(textureSampleLevel(source, sourceSampler, input.vUv0 + vec2f(0.0, uniform.pixelOffset.y), 0.0), c, isUsed(c));\n c = select(textureSampleLevel(source, sourceSampler, input.vUv0 + uniform.pixelOffset, 0.0), c, isUsed(c));\n\n var output: FragmentOutput;\n output.color = c;\n return output;\n}\n"; export default _default;