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 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;
|
|
float tmpvar_1;
|
|
tmpvar_1 = (1.0/(((_ZBufferParams.x * texture2D (_CameraDepthTexture, gl_TexCoord[0].xy).x) + _ZBufferParams.y)));
|
|
vec4 tmpvar_2;
|
|
tmpvar_2.w = 1.0;
|
|
tmpvar_2.xyz = (gl_TexCoord[1].xyz * tmpvar_1);
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = (vec4(greaterThanEqual (tmpvar_2.zzzz, _LightSplitsNear)) * vec4(lessThan (tmpvar_2.zzzz, _LightSplitsFar)));
|
|
vec4 tmpvar_4;
|
|
tmpvar_4.w = 1.0;
|
|
tmpvar_4.xyz = (((((_View2Shadow * tmpvar_2).xyz * tmpvar_3.x) + ((_View2Shadow1 * tmpvar_2).xyz * tmpvar_3.y)) + ((_View2Shadow2 * tmpvar_2).xyz * tmpvar_3.z)) + ((_View2Shadow3 * tmpvar_2).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 = tmpvar_6;
|
|
res.y = 1.0;
|
|
vec2 enc;
|
|
vec2 tmpvar_7;
|
|
tmpvar_7 = fract ((vec2(1.0, 255.0) * (1.0 - tmpvar_1)));
|
|
enc = tmpvar_7;
|
|
enc.x = (tmpvar_7.x - (tmpvar_7.y * 0.00392157));
|
|
res.zw = enc;
|
|
gl_FragData[0] = res;
|
|
}
|
|
|