mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
36 lines
1.1 KiB
Text
36 lines
1.1 KiB
Text
uniform sampler2D _ShadowMapTexture;
|
|
uniform vec4 _ProjectionParams;
|
|
uniform vec4 _LightSplitsNear;
|
|
uniform vec4 _LightSplitsFar;
|
|
uniform vec4 _LightShadowData;
|
|
void main ()
|
|
{
|
|
vec2 tmpvar_1;
|
|
tmpvar_1 = gl_TexCoord[4].xy;
|
|
vec4 res;
|
|
vec4 tmpvar_2;
|
|
tmpvar_2 = tmpvar_1.xxxx;
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = (vec4(greaterThanEqual (tmpvar_2, _LightSplitsNear)) * vec4(lessThan (tmpvar_2, _LightSplitsFar)));
|
|
vec4 tmpvar_4;
|
|
tmpvar_4.w = 1.0;
|
|
tmpvar_4.xyz = ((((gl_TexCoord[0].xyz * tmpvar_3.x) + (gl_TexCoord[1].xyz * tmpvar_3.y)) + (gl_TexCoord[2].xyz * tmpvar_3.z)) + (gl_TexCoord[3].xyz * tmpvar_3.w));
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = texture2D (_ShadowMapTexture, tmpvar_4.xy);
|
|
float tmpvar_6;
|
|
if ((tmpvar_5.x < tmpvar_4.z)) {
|
|
tmpvar_6 = _LightShadowData.x;
|
|
} else {
|
|
tmpvar_6 = 1.0;
|
|
};
|
|
res.x = clamp ((tmpvar_6 + clamp (tmpvar_1.y, 0.0, 1.0)), 0.0, 1.0);
|
|
res.y = 1.0;
|
|
vec2 enc;
|
|
vec2 tmpvar_7;
|
|
tmpvar_7 = fract ((vec2(1.0, 255.0) * (1.0 - (tmpvar_1.xxxx * _ProjectionParams.w)).x));
|
|
enc = tmpvar_7;
|
|
enc.x = (tmpvar_7.x - (tmpvar_7.y * 0.00392157));
|
|
res.zw = enc;
|
|
gl_FragData[0] = res;
|
|
}
|
|
|