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

51 lines
1.6 KiB
Text

uniform sampler2D unity_LightmapInd;
uniform sampler2D unity_Lightmap;
uniform vec4 _ReflectColor;
uniform sampler2D _MainTex;
uniform sampler2D _LightBuffer;
uniform samplerCube _Cube;
uniform vec4 _Color;
uniform sampler2D _BumpMap;
void main ()
{
vec4 tmpvar_1;
tmpvar_1 = gl_TexCoord[0];
vec4 tmpvar_2;
tmpvar_2 = gl_TexCoord[2];
vec4 tmpvar_3;
tmpvar_3 = gl_TexCoord[3];
vec4 tmpvar_4;
tmpvar_4 = gl_TexCoord[4];
vec3 tmpvar_5;
tmpvar_5 = gl_TexCoord[5].xyz;
vec4 col;
vec4 light;
vec3 tmpvar_6;
tmpvar_6.x = tmpvar_2.w;
tmpvar_6.y = tmpvar_3.w;
tmpvar_6.z = tmpvar_4.w;
vec4 tmpvar_7;
tmpvar_7 = texture2D (_MainTex, tmpvar_1.xy);
vec4 normal;
normal.xy = ((texture2D (_BumpMap, tmpvar_1.zw).wy * 2.0) - 1.0);
normal.z = sqrt (((1.0 - (normal.x * normal.x)) - (normal.y * normal.y)));
vec3 tmpvar_8;
tmpvar_8 = normal.xyz;
vec3 tmpvar_9;
tmpvar_9.x = dot (tmpvar_2.xyz, tmpvar_8);
tmpvar_9.y = dot (tmpvar_3.xyz, tmpvar_8);
tmpvar_9.z = dot (tmpvar_4.xyz, tmpvar_8);
vec4 tmpvar_10;
tmpvar_10 = (textureCube (_Cube, reflect (tmpvar_6, tmpvar_9)) * tmpvar_7.w);
vec4 tmpvar_11;
tmpvar_11 = -(log2 (texture2DProj (_LightBuffer, gl_TexCoord[1])));
light = tmpvar_11;
light.xyz = (tmpvar_11.xyz + mix ((2.0 * texture2D (unity_LightmapInd, tmpvar_5.xy).xyz), (2.0 * texture2D (unity_Lightmap, tmpvar_5.xy).xyz), vec3(clamp (tmpvar_5.z, 0.0, 1.0))));
vec4 c_i0;
c_i0.xyz = ((tmpvar_7 * _Color).xyz * light.xyz);
c_i0.w = (tmpvar_10.w * _ReflectColor.w);
col = c_i0;
col.xyz = (c_i0.xyz + (tmpvar_10.xyz * _ReflectColor.xyz));
gl_FragData[0] = col;
}