mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
42 lines
1.4 KiB
Text
42 lines
1.4 KiB
Text
uniform vec4 _ZBufferParams;
|
|
uniform mat4 _View2Shadow3;
|
|
uniform mat4 _View2Shadow2;
|
|
uniform mat4 _View2Shadow1;
|
|
uniform mat4 _View2Shadow;
|
|
uniform sampler2D _ShadowMapTexture;
|
|
uniform vec4 _LightSplitsNear;
|
|
uniform vec4 _LightSplitsFar;
|
|
uniform vec4 _LightShadowData;
|
|
uniform sampler2D _CameraDepthTexture;
|
|
void main ()
|
|
{
|
|
vec4 res_1;
|
|
float tmpvar_2;
|
|
tmpvar_2 = (1.0/(((_ZBufferParams.x * texture2D (_CameraDepthTexture, gl_TexCoord[0].xy).x) + _ZBufferParams.y)));
|
|
vec4 tmpvar_3;
|
|
tmpvar_3.w = 1.0;
|
|
tmpvar_3.xyz = (gl_TexCoord[1].xyz * tmpvar_2);
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = (vec4(greaterThanEqual (tmpvar_3.zzzz, _LightSplitsNear)) * vec4(lessThan (tmpvar_3.zzzz, _LightSplitsFar)));
|
|
vec4 tmpvar_5;
|
|
tmpvar_5.w = 1.0;
|
|
tmpvar_5.xyz = (((((_View2Shadow * tmpvar_3).xyz * tmpvar_4.x) + ((_View2Shadow1 * tmpvar_3).xyz * tmpvar_4.y)) + ((_View2Shadow2 * tmpvar_3).xyz * tmpvar_4.z)) + ((_View2Shadow3 * tmpvar_3).xyz * tmpvar_4.w));
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = texture2D (_ShadowMapTexture, tmpvar_5.xy);
|
|
float tmpvar_7;
|
|
if ((tmpvar_6.x < tmpvar_5.z)) {
|
|
tmpvar_7 = _LightShadowData.x;
|
|
} else {
|
|
tmpvar_7 = 1.0;
|
|
};
|
|
res_1.x = tmpvar_7;
|
|
res_1.y = 1.0;
|
|
vec2 enc_8;
|
|
vec2 tmpvar_9;
|
|
tmpvar_9 = fract((vec2(1.0, 255.0) * (1.0 - tmpvar_2)));
|
|
enc_8.y = tmpvar_9.y;
|
|
enc_8.x = (tmpvar_9.x - (tmpvar_9.y * 0.00392157));
|
|
res_1.zw = enc_8;
|
|
gl_FragData[0] = res_1;
|
|
}
|
|
|