bgfx/3rdparty/glsl-optimizer/tests/fragment/unity-Hidden_Internal-PrePassLighting-out.txt
Branimir Karadzic dee3fe5266 Initial commit.
2012-04-03 20:30:07 -07:00

68 lines
2.3 KiB
Text

uniform vec4 unity_LightmapFade;
uniform vec4 _ZBufferParams;
uniform mat4 _ViewToCookie;
uniform mat4 _View2Shadow;
uniform samplerCube _ShadowMapTexture;
uniform vec4 _ProjectionParams;
uniform sampler2D _LightTextureB0;
uniform samplerCube _LightTexture0;
uniform vec4 _LightShadowData;
uniform vec4 _LightPositionRange;
uniform vec4 _LightPos;
uniform vec4 _LightColor;
uniform sampler2D _CameraNormalsTexture;
uniform sampler2D _CameraDepthTexture;
void main ()
{
vec4 tmpvar_1;
tmpvar_1 = gl_TexCoord[0];
vec3 tmpvar_2;
tmpvar_2 = gl_TexCoord[1].xyz;
vec4 res;
float atten;
vec3 lightDir;
vec3 normal;
vec2 tmpvar_3;
tmpvar_3 = (tmpvar_1.xy / tmpvar_1.w);
vec4 tmpvar_4;
tmpvar_4 = texture2D (_CameraNormalsTexture, tmpvar_3);
normal = normalize (((tmpvar_4.xyz * 2.0) - 1.0));
vec3 tmpvar_5;
tmpvar_5 = ((tmpvar_2 * (_ProjectionParams.z / tmpvar_2.z)) * (1.0/(((_ZBufferParams.x * texture2D (_CameraDepthTexture, tmpvar_3).x) + _ZBufferParams.y))));
vec3 tmpvar_6;
tmpvar_6 = (_LightPos.xyz - tmpvar_5);
lightDir = normalize (tmpvar_6);
atten = texture2D (_LightTextureB0, vec2((dot (tmpvar_6, tmpvar_6) * _LightPos.w))).w;
vec3 vec;
vec = -(tmpvar_6);
mat3 tmpvar_7;
tmpvar_7[0] = _View2Shadow[0].xyz;
tmpvar_7[1] = _View2Shadow[1].xyz;
tmpvar_7[2] = _View2Shadow[2].xyz;
vec3 tmpvar_8;
tmpvar_8 = (tmpvar_7 * vec);
vec = tmpvar_8;
float tmpvar_9;
tmpvar_9 = ((length (tmpvar_8) * _LightPositionRange.w) * 0.97);
float tmpvar_10;
tmpvar_10 = dot (textureCube (_ShadowMapTexture, tmpvar_8), vec4(1.0, 0.00392157, 1.53787e-05, 0.0));
float tmpvar_11;
if ((tmpvar_10 < tmpvar_9)) {
tmpvar_11 = _LightShadowData.x;
} else {
tmpvar_11 = 1.0;
};
vec4 tmpvar_12;
tmpvar_12.w = 1.0;
tmpvar_12.xyz = tmpvar_5;
float tmpvar_13;
tmpvar_13 = ((atten * tmpvar_11) * textureCube (_LightTexture0, (_ViewToCookie * tmpvar_12).xyz).w);
atten = tmpvar_13;
res.xyz = (_LightColor.xyz * (max (0.0, dot (lightDir, normal)) * tmpvar_13));
res.w = ((pow (max (0.0, dot (normalize ((lightDir - normalize (tmpvar_5))), normal)), (tmpvar_4.w * 128.0)) * clamp (tmpvar_13, 0.0, 1.0)) * dot (_LightColor.xyz, vec3(0.22, 0.707, 0.071)));
vec4 tmpvar_14;
tmpvar_14 = (res * clamp ((1.0 - ((tmpvar_5.z * unity_LightmapFade.z) + unity_LightmapFade.w)), 0.0, 1.0));
res = tmpvar_14;
gl_FragData[0] = exp2 (-(tmpvar_14));
}