playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
3 lines (2 loc) • 1.3 kB
TypeScript
declare const _default: "\n\n#ifdef PICK_MODE\n #include \"pickPS\"\n #include \"floatAsUintPS\"\n var pickIdTexture: texture_2d<u32>;\n var pickDepthTexture: texture_2d<f32>;\n#else\n #include \"tonemappingPS\"\n #include \"gammaPS\"\n var source: texture_2d<f32>;\n#endif\n\nvarying vUv0: vec2f;\n\n@fragment fn fragmentMain(input: FragmentInput) -> FragmentOutput {\n var output: FragmentOutput;\n\n #ifdef PICK_MODE\n let texSize = vec2f(textureDimensions(pickIdTexture));\n let coord = vec2u(input.vUv0 * texSize);\n let pickId = textureLoad(pickIdTexture, coord, 0).r;\n if (pickId == 0xFFFFFFFFu) {\n discard;\n return output;\n }\n output.color = encodePickOutput(pickId);\n\n let depthData = textureLoad(pickDepthTexture, coord, 0);\n let normalizedDepth = select(depthData.r / depthData.g, 1.0, depthData.g < 1e-6);\n output.color1 = float2uint(normalizedDepth);\n #else\n let texSize = vec2f(textureDimensions(source));\n let coord = vec2u(input.vUv0 * texSize);\n let linear = textureLoad(source, coord, 0);\n output.color = vec4f(gammaCorrectOutput(toneMap(linear.rgb)), linear.a);\n #endif\n\n return output;\n}\n";
export default _default;