export declare const fragmentShader = "\nvarying vec2 vUv;\nvarying vec2 vUv2;\nvarying vec2 vOffset;\n\nuniform vec2 repeat;\n\nuniform sampler2D map;\nuniform sampler2D mask;\nuniform sampler2D alphaMap;\nuniform sampler2D lightMap;\nuniform sampler2D reflectionMap;\nuniform sampler2D reflectionRoughMap;\nuniform sampler2D aoMap;\nuniform sampler2D iorMap;\nuniform sampler2D iorRoughMap;\nuniform sampler2D bloomMap;\n\nuniform float reflectionMapIntensity;\nuniform float reflectionRoughMapIntensity;\nuniform float iorMapIntensity;\nuniform float iorRoughMapIntensity;\nuniform float aoMapIntensity;\n\nuniform float sceneLightMapIntensity;\nuniform float sceneBloomMapIntensity;\nuniform float sceneReflectionMapIntensity;\nuniform float sceneReflectionRoughMapIntensity;\nuniform float sceneIorMapIntensity;\nuniform float sceneIorRoughMapIntensity;\n\nvec3 HSLToRGB(in vec3 c) {\n\tvec3 rgb = clamp(abs(mod(c.x * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);\n\treturn c.z + c.y * (rgb - 0.5) * (1.0 - abs(2.0 * c.z - 1.0));\n}\n\nvec3 RGBToHSL(in vec3 c) {\n\tfloat h = 0.0;\n\tfloat s = 0.0;\n\tfloat l = 0.0;\n\tfloat r = c.r;\n\tfloat g = c.g;\n\tfloat b = c.b;\n\tfloat cMin = min(r, min(g, b));\n\tfloat cMax = max(r, max(g, b));\n\n\tl = (cMax + cMin) / 2.0;\n\tif(cMax > cMin) {\n\t\tfloat cDelta = cMax - cMin;\n\n        //s = l < .05 ? cDelta / ( cMax + cMin ) : cDelta / ( 2.0 - ( cMax + cMin ) ); Original\n\t\ts = l < .0 ? cDelta / (cMax + cMin) : cDelta / (2.0 - (cMax + cMin));\n\n\t\tif(r == cMax) {\n\t\t\th = (g - b) / cDelta;\n\t\t} else if(g == cMax) {\n\t\t\th = 2.0 + (b - r) / cDelta;\n\t\t} else {\n\t\t\th = 4.0 + (r - g) / cDelta;\n\t\t}\n\n\t\tif(h < 0.0) {\n\t\t\th += 6.0;\n\t\t}\n\t\th = h / 6.0;\n\t}\n\treturn vec3(h, s, l);\n}\n\nvec3 BlendColor(vec3 base, vec3 blend) {\n\tvec3 blendHSL = RGBToHSL(blend);\n\tvec3 baseHSL = RGBToHSL(base);\n\treturn HSLToRGB(vec3(blendHSL.x, blendHSL.y, baseHSL.z));\n}\n\nvoid main() {\n\n\tvec2 uvRO = vUv * repeat + vOffset;\n\n\tvec4 mapColor = texture(map, uvRO);\n\tvec4 maskColor = texture(mask, uvRO);\n\tvec3 maskColorHSL = RGBToHSL(maskColor.rbg);\n\tvec4 blackMaskColor = vec4(HSLToRGB(vec3(maskColorHSL.x, 0, maskColorHSL.z)), maskColor.a);\n\n\tvec4 alphaColor = texture(alphaMap, vUv2);\n\tvec4 lightColor = texture(lightMap, vUv2) * sceneLightMapIntensity;\n\tvec4 reflectRough = texture(reflectionRoughMap, vUv2) * reflectionRoughMapIntensity * sceneReflectionRoughMapIntensity;\n\tvec4 reflect = texture(reflectionMap, vUv2) * reflectionMapIntensity * sceneReflectionMapIntensity;\n\tvec4 reflectionColor = blackMaskColor * (reflect + reflectRough);\n\tvec4 aoColor = clamp(texture(aoMap, vUv2) + aoMapIntensity, 0.0f, 1.0f);\n\tvec4 iorColor = texture(iorMap, vUv2);\n\tvec4 iorRoughColor = texture(iorRoughMap, vUv2);\n\tvec4 bloomColor = texture(bloomMap, vUv2) * sceneBloomMapIntensity;\n\n\tvec4 iorColorTotal = clamp((iorColor + (iorMapIntensity * sceneIorMapIntensity)), 0.0f, 1.0f);\n\tvec4 iorRoughColorTotal = clamp((iorRoughColor + (iorRoughMapIntensity * sceneIorRoughMapIntensity)), 0.0f, 1.0f);\n\n\tvec4 lightIn = reflectionColor * (iorColorTotal + iorRoughColorTotal);\n\tvec4 refTotalColor = vec4(BlendColor(lightIn.rgb, maskColor.rgb), maskColor.a);\n\tvec4 totalColor = (((mapColor * lightColor) + refTotalColor) * aoColor + bloomColor);\n\ttotalColor = clamp(totalColor, 0.0f, 1.0f);\n\n\tvec4 texelColor = totalColor;\n\ttexelColor.a *= alphaColor.g;\n\n\tgl_FragColor = texelColor;\n}\n";
