mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
48 lines
1.5 KiB
Text
48 lines
1.5 KiB
Text
|
uniform sampler2D _ShadowMapTexture;
|
||
|
uniform vec4 _ProjectionParams;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform vec4 _LightSplitsNear;
|
||
|
uniform vec4 _LightSplitsFar;
|
||
|
uniform vec4 _LightShadowData;
|
||
|
uniform float _Cutoff;
|
||
|
uniform sampler2D _BumpMap;
|
||
|
void main ()
|
||
|
{
|
||
|
vec2 tmpvar_1;
|
||
|
tmpvar_1 = gl_TexCoord[4].xy;
|
||
|
vec2 tmpvar_2;
|
||
|
tmpvar_2 = gl_TexCoord[5].xy;
|
||
|
vec4 res_3;
|
||
|
vec4 normal_4;
|
||
|
normal_4.xy = ((texture2D (_BumpMap, tmpvar_2).wy * 2.0) - 1.0);
|
||
|
normal_4.z = sqrt(((1.0 - (normal_4.x * normal_4.x)) - (normal_4.y * normal_4.y)));
|
||
|
float x_5;
|
||
|
x_5 = ((texture2D (_MainTex, tmpvar_2).w * gl_Color.w) - _Cutoff);
|
||
|
if ((x_5 < 0.0)) {
|
||
|
discard;
|
||
|
};
|
||
|
vec4 tmpvar_6;
|
||
|
tmpvar_6 = (vec4(greaterThanEqual (tmpvar_1.xxxx, _LightSplitsNear)) * vec4(lessThan (tmpvar_1.xxxx, _LightSplitsFar)));
|
||
|
vec4 tmpvar_7;
|
||
|
tmpvar_7.w = 1.0;
|
||
|
tmpvar_7.xyz = ((((gl_TexCoord[0].xyz * tmpvar_6.x) + (gl_TexCoord[1].xyz * tmpvar_6.y)) + (gl_TexCoord[2].xyz * tmpvar_6.z)) + (gl_TexCoord[3].xyz * tmpvar_6.w));
|
||
|
vec4 tmpvar_8;
|
||
|
tmpvar_8 = texture2D (_ShadowMapTexture, tmpvar_7.xy);
|
||
|
float tmpvar_9;
|
||
|
if ((tmpvar_8.x < tmpvar_7.z)) {
|
||
|
tmpvar_9 = _LightShadowData.x;
|
||
|
} else {
|
||
|
tmpvar_9 = 1.0;
|
||
|
};
|
||
|
res_3.x = clamp ((tmpvar_9 + clamp (tmpvar_1.y, 0.0, 1.0)), 0.0, 1.0);
|
||
|
res_3.y = 1.0;
|
||
|
vec2 enc_10;
|
||
|
vec2 tmpvar_11;
|
||
|
tmpvar_11 = fract((vec2(1.0, 255.0) * (1.0 - (tmpvar_1.xxxx * _ProjectionParams.w)).x));
|
||
|
enc_10.y = tmpvar_11.y;
|
||
|
enc_10.x = (tmpvar_11.x - (tmpvar_11.y * 0.00392157));
|
||
|
res_3.zw = enc_10;
|
||
|
gl_FragData[0] = res_3;
|
||
|
}
|
||
|
|