bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-Reflective_Bumped_Diffuse-ir.txt
2012-10-07 20:41:18 -07:00

199 lines
4.4 KiB
Text

struct SurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
vec2 uv_BumpMap;
vec3 worldRefl;
};
struct v2f_surf {
vec4 pos;
float fog;
vec4 hip_pack0;
vec3 lightDir;
vec2 _LightCoord;
};
varying vec4 xlv_FOG;
uniform vec4 _ReflectColor;
uniform sampler2D _MainTex;
uniform sampler2D _LightTexture0;
uniform vec4 _LightColor0;
uniform samplerCube _Cube;
uniform vec4 _Color;
uniform sampler2D _BumpMap;
vec4 UnpackNormal (
in vec4 packednormal_1
)
{
vec4 normal_2;
vec2 tmpvar_3;
tmpvar_3 = ((packednormal_1.wy * 2.0) - 1.0);
normal_2.xy = tmpvar_3.xy.xy;
float tmpvar_4;
tmpvar_4 = sqrt (((1.0 - (normal_2.x * normal_2.x)) - (normal_2.y * normal_2.y)));
float tmpvar_5;
tmpvar_5 = tmpvar_4;
normal_2.z = vec3(tmpvar_5).z;
return normal_2;
}
void surf (
in Input IN_6,
inout SurfaceOutput o_7
)
{
vec4 reflcol_8;
vec3 worldRefl_9;
vec4 c_10;
vec4 tex_11;
vec4 tmpvar_12;
tmpvar_12 = texture2D (_MainTex, IN_6.uv_MainTex);
vec4 tmpvar_13;
tmpvar_13 = tmpvar_12;
tex_11 = tmpvar_13;
vec4 tmpvar_14;
tmpvar_14 = (tex_11 * _Color);
c_10 = tmpvar_14;
vec3 tmpvar_15;
tmpvar_15 = c_10.xyz;
o_7.Albedo = tmpvar_15;
vec4 tmpvar_16;
tmpvar_16 = texture2D (_BumpMap, IN_6.uv_BumpMap);
vec4 tmpvar_17;
tmpvar_17 = UnpackNormal (tmpvar_16);
vec3 tmpvar_18;
tmpvar_18 = tmpvar_17.xyz;
vec3 tmpvar_19;
tmpvar_19 = tmpvar_18;
o_7.Normal = tmpvar_19;
vec3 tmpvar_20;
tmpvar_20 = IN_6.worldRefl;
worldRefl_9 = tmpvar_20;
vec4 tmpvar_21;
tmpvar_21 = textureCube (_Cube, worldRefl_9);
vec4 tmpvar_22;
tmpvar_22 = tmpvar_21;
reflcol_8 = tmpvar_22;
vec4 tmpvar_23;
tmpvar_23 = (reflcol_8 * tex_11.w);
reflcol_8 = tmpvar_23;
vec3 tmpvar_24;
tmpvar_24 = (reflcol_8.xyz * _ReflectColor.xyz);
o_7.Emission = tmpvar_24;
float tmpvar_25;
tmpvar_25 = (reflcol_8.w * _ReflectColor.w);
o_7.Alpha = tmpvar_25;
}
vec4 LightingLambert (
in SurfaceOutput s_26,
in vec3 lightDir_27,
in float atten_28
)
{
vec4 c_29;
float diff_30;
float tmpvar_31;
tmpvar_31 = dot (s_26.Normal, lightDir_27);
float tmpvar_32;
tmpvar_32 = max (0.0, tmpvar_31);
float tmpvar_33;
tmpvar_33 = tmpvar_32;
diff_30 = tmpvar_33;
vec3 tmpvar_34;
tmpvar_34 = ((s_26.Albedo * _LightColor0.xyz) * ((diff_30 * atten_28) * 2.0));
c_29.xyz = tmpvar_34.xyz.xyz;
float tmpvar_35;
tmpvar_35 = s_26.Alpha;
c_29.w = vec4(tmpvar_35).w;
return c_29;
}
vec4 frag_surf (
in v2f_surf IN_36
)
{
vec4 c_37;
vec3 lightDir_38;
SurfaceOutput o_39;
Input surfIN_40;
vec2 tmpvar_41;
tmpvar_41 = IN_36.hip_pack0.xy;
surfIN_40.uv_MainTex = tmpvar_41;
vec2 tmpvar_42;
tmpvar_42 = IN_36.hip_pack0.zw;
surfIN_40.uv_BumpMap = tmpvar_42;
vec3 tmpvar_43;
tmpvar_43 = vec3(0.0, 0.0, 0.0);
o_39.Albedo = tmpvar_43;
vec3 tmpvar_44;
tmpvar_44 = vec3(0.0, 0.0, 0.0);
o_39.Emission = tmpvar_44;
float tmpvar_45;
tmpvar_45 = 0.0;
o_39.Specular = tmpvar_45;
float tmpvar_46;
tmpvar_46 = 0.0;
o_39.Alpha = tmpvar_46;
float tmpvar_47;
tmpvar_47 = 0.0;
o_39.Gloss = tmpvar_47;
surf (surfIN_40, o_39);
vec3 tmpvar_48;
tmpvar_48 = IN_36.lightDir;
lightDir_38 = tmpvar_48;
vec4 tmpvar_49;
tmpvar_49 = texture2D (_LightTexture0, IN_36._LightCoord);
vec4 tmpvar_50;
tmpvar_50 = LightingLambert (o_39, lightDir_38, (tmpvar_49.w * 1.0));
vec4 tmpvar_51;
tmpvar_51 = tmpvar_50;
c_37 = tmpvar_51;
float tmpvar_52;
tmpvar_52 = 0.0;
c_37.w = vec4(tmpvar_52).w;
return c_37;
}
void main ()
{
v2f_surf xlt_IN_53;
vec4 xl_retval_54;
vec4 tmpvar_55;
tmpvar_55 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_53.pos = tmpvar_55;
float tmpvar_56;
tmpvar_56 = xlv_FOG.x;
xlt_IN_53.fog = tmpvar_56;
vec4 tmpvar_57;
tmpvar_57 = gl_TexCoord[0].xyzw;
vec4 tmpvar_58;
tmpvar_58 = tmpvar_57;
xlt_IN_53.hip_pack0 = tmpvar_58;
vec3 tmpvar_59;
tmpvar_59 = gl_TexCoord[1].xyz;
vec3 tmpvar_60;
tmpvar_60 = tmpvar_59;
xlt_IN_53.lightDir = tmpvar_60;
vec2 tmpvar_61;
tmpvar_61 = gl_TexCoord[2].xy;
vec2 tmpvar_62;
tmpvar_62 = tmpvar_61;
xlt_IN_53._LightCoord = tmpvar_62;
vec4 tmpvar_63;
tmpvar_63 = frag_surf (xlt_IN_53);
vec4 tmpvar_64;
tmpvar_64 = tmpvar_63;
xl_retval_54 = tmpvar_64;
vec4 tmpvar_65;
tmpvar_65 = xl_retval_54.xyzw;
vec4 tmpvar_66;
tmpvar_66 = tmpvar_65;
gl_FragData[0] = tmpvar_66;
}