mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
42 lines
1.3 KiB
Text
42 lines
1.3 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;
|
||
|
vec3 tmpvar_2;
|
||
|
tmpvar_2 = gl_TexCoord[5].xyz;
|
||
|
vec4 res_3;
|
||
|
float x_4;
|
||
|
x_4 = (fract(((tmpvar_2.y + (tmpvar_2.z * 0.1)) * 5.0)) - 0.5);
|
||
|
if ((x_4 < 0.0)) {
|
||
|
discard;
|
||
|
};
|
||
|
vec4 tmpvar_5;
|
||
|
tmpvar_5 = (vec4(greaterThanEqual (tmpvar_1.xxxx, _LightSplitsNear)) * vec4(lessThan (tmpvar_1.xxxx, _LightSplitsFar)));
|
||
|
vec4 tmpvar_6;
|
||
|
tmpvar_6.w = 1.0;
|
||
|
tmpvar_6.xyz = ((((gl_TexCoord[0].xyz * tmpvar_5.x) + (gl_TexCoord[1].xyz * tmpvar_5.y)) + (gl_TexCoord[2].xyz * tmpvar_5.z)) + (gl_TexCoord[3].xyz * tmpvar_5.w));
|
||
|
vec4 tmpvar_7;
|
||
|
tmpvar_7 = texture2D (_ShadowMapTexture, tmpvar_6.xy);
|
||
|
float tmpvar_8;
|
||
|
if ((tmpvar_7.x < tmpvar_6.z)) {
|
||
|
tmpvar_8 = _LightShadowData.x;
|
||
|
} else {
|
||
|
tmpvar_8 = 1.0;
|
||
|
};
|
||
|
res_3.x = clamp ((tmpvar_8 + clamp (tmpvar_1.y, 0.0, 1.0)), 0.0, 1.0);
|
||
|
res_3.y = 1.0;
|
||
|
vec2 enc_9;
|
||
|
vec2 tmpvar_10;
|
||
|
tmpvar_10 = fract((vec2(1.0, 255.0) * (1.0 - (tmpvar_1.xxxx * _ProjectionParams.w)).x));
|
||
|
enc_9.y = tmpvar_10.y;
|
||
|
enc_9.x = (tmpvar_10.x - (tmpvar_10.y * 0.00392157));
|
||
|
res_3.zw = enc_9;
|
||
|
gl_FragData[0] = res_3;
|
||
|
}
|
||
|
|