mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-12 09:11:18 -05:00
65 lines
2 KiB
Text
65 lines
2 KiB
Text
uniform sampler2D _CameraDepthTexture;
|
|
uniform vec4 _LightShadowData;
|
|
uniform vec4 _LightSplitsFar;
|
|
uniform vec4 _LightSplitsNear;
|
|
uniform sampler2D _ShadowMapTexture;
|
|
uniform mat4 _View2Shadow;
|
|
uniform mat4 _View2Shadow1;
|
|
uniform mat4 _View2Shadow2;
|
|
uniform mat4 _View2Shadow3;
|
|
uniform vec4 _ZBufferParams;
|
|
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 weights_4;
|
|
weights_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 * weights_4.x)
|
|
+
|
|
((_View2Shadow1 * tmpvar_3).xyz * weights_4.y)
|
|
) + (
|
|
(_View2Shadow2 * tmpvar_3)
|
|
.xyz * weights_4.z)) + ((_View2Shadow3 * tmpvar_3).xyz * weights_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;
|
|
enc_8 = (vec2(1.0, 255.0) * (1.0 - tmpvar_2));
|
|
vec2 tmpvar_9;
|
|
tmpvar_9 = fract(enc_8);
|
|
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;
|
|
}
|
|
|
|
|
|
// stats: 30 alu 2 tex 1 flow
|
|
// inputs: 1
|
|
// #0: gl_TexCoord (high float) 4x1 [2] loc 4
|
|
// uniforms: 8 (total size: 0)
|
|
// #0: _LightShadowData (high float) 4x1 [-1]
|
|
// #1: _LightSplitsFar (high float) 4x1 [-1]
|
|
// #2: _LightSplitsNear (high float) 4x1 [-1]
|
|
// #3: _View2Shadow (high float) 4x4 [-1]
|
|
// #4: _View2Shadow1 (high float) 4x4 [-1]
|
|
// #5: _View2Shadow2 (high float) 4x4 [-1]
|
|
// #6: _View2Shadow3 (high float) 4x4 [-1]
|
|
// #7: _ZBufferParams (high float) 4x1 [-1]
|
|
// textures: 2
|
|
// #0: _CameraDepthTexture (high 2d) 0x0 [-1]
|
|
// #1: _ShadowMapTexture (high 2d) 0x0 [-1]
|