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

215 lines
4.9 KiB
Text

struct SurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
vec2 uv_BumpMap;
};
struct v2f_surf {
vec4 pos;
float fog;
vec4 hip_pack0;
vec3 lightDir;
vec3 viewDir;
vec2 _LightCoord;
};
varying vec4 xlv_FOG;
uniform vec4 _SpecColor;
uniform float _Shininess;
uniform sampler2D _MainTex;
uniform sampler2D _LightTexture0;
uniform vec4 _LightColor0;
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 tex_8;
vec4 tmpvar_9;
tmpvar_9 = texture2D (_MainTex, IN_6.uv_MainTex);
vec4 tmpvar_10;
tmpvar_10 = tmpvar_9;
tex_8 = tmpvar_10;
vec3 tmpvar_11;
tmpvar_11 = (tex_8.xyz * _Color.xyz);
o_7.Albedo = tmpvar_11;
float tmpvar_12;
tmpvar_12 = tex_8.w;
o_7.Gloss = tmpvar_12;
float tmpvar_13;
tmpvar_13 = (tex_8.w * _Color.w);
o_7.Alpha = tmpvar_13;
float tmpvar_14;
tmpvar_14 = _Shininess;
o_7.Specular = tmpvar_14;
vec4 tmpvar_15;
tmpvar_15 = texture2D (_BumpMap, IN_6.uv_BumpMap);
vec4 tmpvar_16;
tmpvar_16 = UnpackNormal (tmpvar_15);
vec3 tmpvar_17;
tmpvar_17 = tmpvar_16.xyz;
vec3 tmpvar_18;
tmpvar_18 = tmpvar_17;
o_7.Normal = tmpvar_18;
}
vec4 LightingBlinnPhong (
in SurfaceOutput s_19,
in vec3 lightDir_20,
in vec3 viewDir_21,
in float atten_22
)
{
vec4 c_23;
float spec_24;
float nh_25;
float diff_26;
vec3 h_27;
vec3 tmpvar_28;
tmpvar_28 = normalize ((lightDir_20 + viewDir_21));
vec3 tmpvar_29;
tmpvar_29 = tmpvar_28;
h_27 = tmpvar_29;
float tmpvar_30;
tmpvar_30 = dot (s_19.Normal, lightDir_20);
float tmpvar_31;
tmpvar_31 = max (0.0, tmpvar_30);
float tmpvar_32;
tmpvar_32 = tmpvar_31;
diff_26 = tmpvar_32;
float tmpvar_33;
tmpvar_33 = dot (s_19.Normal, h_27);
float tmpvar_34;
tmpvar_34 = max (0.0, tmpvar_33);
float tmpvar_35;
tmpvar_35 = tmpvar_34;
nh_25 = tmpvar_35;
float tmpvar_36;
tmpvar_36 = pow (nh_25, (s_19.Specular * 128.0));
float tmpvar_37;
tmpvar_37 = (tmpvar_36 * s_19.Gloss);
spec_24 = tmpvar_37;
vec3 tmpvar_38;
tmpvar_38 = ((((s_19.Albedo * _LightColor0.xyz) * diff_26) + ((_LightColor0.xyz * _SpecColor.xyz) * spec_24)) * (atten_22 * 2.0));
c_23.xyz = tmpvar_38.xyz.xyz;
float tmpvar_39;
tmpvar_39 = (s_19.Alpha + (((_LightColor0.w * _SpecColor.w) * spec_24) * atten_22));
c_23.w = vec4(tmpvar_39).w;
return c_23;
}
vec4 frag_surf (
in v2f_surf IN_40
)
{
vec4 c_41;
vec3 lightDir_42;
SurfaceOutput o_43;
Input surfIN_44;
vec2 tmpvar_45;
tmpvar_45 = IN_40.hip_pack0.xy;
surfIN_44.uv_MainTex = tmpvar_45;
vec2 tmpvar_46;
tmpvar_46 = IN_40.hip_pack0.zw;
surfIN_44.uv_BumpMap = tmpvar_46;
vec3 tmpvar_47;
tmpvar_47 = vec3(0.0, 0.0, 0.0);
o_43.Albedo = tmpvar_47;
vec3 tmpvar_48;
tmpvar_48 = vec3(0.0, 0.0, 0.0);
o_43.Emission = tmpvar_48;
float tmpvar_49;
tmpvar_49 = 0.0;
o_43.Specular = tmpvar_49;
float tmpvar_50;
tmpvar_50 = 0.0;
o_43.Alpha = tmpvar_50;
float tmpvar_51;
tmpvar_51 = 0.0;
o_43.Gloss = tmpvar_51;
surf (surfIN_44, o_43);
vec3 tmpvar_52;
tmpvar_52 = IN_40.lightDir;
lightDir_42 = tmpvar_52;
vec3 tmpvar_53;
tmpvar_53 = IN_40.viewDir.xyz;
vec3 tmpvar_54;
tmpvar_54 = normalize (tmpvar_53);
vec4 tmpvar_55;
tmpvar_55 = texture2D (_LightTexture0, IN_40._LightCoord);
vec4 tmpvar_56;
tmpvar_56 = LightingBlinnPhong (o_43, lightDir_42, tmpvar_54, (tmpvar_55.w * 1.0));
vec4 tmpvar_57;
tmpvar_57 = tmpvar_56;
c_41 = tmpvar_57;
float tmpvar_58;
tmpvar_58 = 0.0;
c_41.w = vec4(tmpvar_58).w;
return c_41;
}
void main ()
{
v2f_surf xlt_IN_59;
vec4 xl_retval_60;
vec4 tmpvar_61;
tmpvar_61 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_59.pos = tmpvar_61;
float tmpvar_62;
tmpvar_62 = xlv_FOG.x;
xlt_IN_59.fog = tmpvar_62;
vec4 tmpvar_63;
tmpvar_63 = gl_TexCoord[0].xyzw;
vec4 tmpvar_64;
tmpvar_64 = tmpvar_63;
xlt_IN_59.hip_pack0 = tmpvar_64;
vec3 tmpvar_65;
tmpvar_65 = gl_TexCoord[1].xyz;
vec3 tmpvar_66;
tmpvar_66 = tmpvar_65;
xlt_IN_59.lightDir = tmpvar_66;
vec3 tmpvar_67;
tmpvar_67 = gl_TexCoord[2].xyz;
vec3 tmpvar_68;
tmpvar_68 = tmpvar_67;
xlt_IN_59.viewDir = tmpvar_68;
vec2 tmpvar_69;
tmpvar_69 = gl_TexCoord[3].xy;
vec2 tmpvar_70;
tmpvar_70 = tmpvar_69;
xlt_IN_59._LightCoord = tmpvar_70;
vec4 tmpvar_71;
tmpvar_71 = frag_surf (xlt_IN_59);
vec4 tmpvar_72;
tmpvar_72 = tmpvar_71;
xl_retval_60 = tmpvar_72;
vec4 tmpvar_73;
tmpvar_73 = xl_retval_60.xyzw;
vec4 tmpvar_74;
tmpvar_74 = tmpvar_73;
gl_FragData[0] = tmpvar_74;
}