2020-12-16 21:46:09 +00:00
|
|
|
#version 120
|
2021-10-05 12:37:08 +00:00
|
|
|
#pragma import_defines(FORCE_OPAQUE)
|
2020-12-16 21:46:09 +00:00
|
|
|
|
|
|
|
#if @useGPUShader4
|
|
|
|
#extension GL_EXT_gpu_shader4: require
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if @diffuseMap
|
|
|
|
uniform sampler2D diffuseMap;
|
|
|
|
varying vec2 diffuseMapUV;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
varying float euclideanDepth;
|
|
|
|
varying float linearDepth;
|
|
|
|
|
|
|
|
uniform bool useFalloff;
|
2022-06-06 20:40:38 +00:00
|
|
|
uniform vec2 screenRes;
|
2020-12-16 21:46:09 +00:00
|
|
|
|
|
|
|
varying float passFalloff;
|
|
|
|
|
|
|
|
#include "vertexcolors.glsl"
|
|
|
|
#include "alpha.glsl"
|
2022-06-06 20:40:38 +00:00
|
|
|
#include "fog.glsl"
|
2020-12-16 21:46:09 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
#if @diffuseMap
|
|
|
|
gl_FragData[0] = texture2D(diffuseMap, diffuseMapUV);
|
|
|
|
gl_FragData[0].a *= coveragePreservingAlphaScale(diffuseMap, diffuseMapUV);
|
|
|
|
#else
|
|
|
|
gl_FragData[0] = vec4(1.0);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
gl_FragData[0] *= getDiffuseColor();
|
|
|
|
|
|
|
|
if (useFalloff)
|
|
|
|
gl_FragData[0].a *= passFalloff;
|
|
|
|
|
|
|
|
alphaTest();
|
|
|
|
|
2021-10-06 06:05:10 +00:00
|
|
|
#if defined(FORCE_OPAQUE) && FORCE_OPAQUE
|
2021-10-05 12:37:08 +00:00
|
|
|
gl_FragData[0].a = 1.0;
|
2020-12-16 21:46:09 +00:00
|
|
|
#endif
|
|
|
|
|
2022-06-06 20:40:38 +00:00
|
|
|
gl_FragData[0] = applyFogAtDist(gl_FragData[0], euclideanDepth, linearDepth);
|
2020-12-16 21:46:09 +00:00
|
|
|
}
|