bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-Transparent_Bumped_Specular-ir.txt

230 lines
5.3 KiB
Text
Raw Normal View History

2012-10-07 23:41:18 -04:00
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;
vec3 _LightCoord;
};
varying vec4 xlv_FOG;
uniform vec4 _SpecColor;
uniform float _Shininess;
uniform sampler2D _MainTex;
uniform sampler2D _LightTextureB0;
uniform samplerCube _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 = normalize (lightDir_42);
vec3 tmpvar_54;
tmpvar_54 = tmpvar_53;
lightDir_42 = tmpvar_54;
vec3 tmpvar_55;
tmpvar_55 = IN_40.viewDir.xyz;
vec3 tmpvar_56;
tmpvar_56 = normalize (tmpvar_55);
float tmpvar_57;
tmpvar_57 = dot (IN_40._LightCoord, IN_40._LightCoord);
vec2 tmpvar_58;
tmpvar_58 = vec2(tmpvar_57);
vec2 tmpvar_59;
tmpvar_59 = tmpvar_58.xy;
vec4 tmpvar_60;
tmpvar_60 = texture2D (_LightTextureB0, tmpvar_59);
vec4 tmpvar_61;
tmpvar_61 = textureCube (_LightTexture0, IN_40._LightCoord);
vec4 tmpvar_62;
tmpvar_62 = LightingBlinnPhong (o_43, lightDir_42, tmpvar_56, (tmpvar_60.w * tmpvar_61.w));
vec4 tmpvar_63;
tmpvar_63 = tmpvar_62;
c_41 = tmpvar_63;
float tmpvar_64;
tmpvar_64 = o_43.Alpha;
c_41.w = vec4(tmpvar_64).w;
return c_41;
}
void main ()
{
v2f_surf xlt_IN_65;
vec4 xl_retval_66;
vec4 tmpvar_67;
tmpvar_67 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_65.pos = tmpvar_67;
float tmpvar_68;
tmpvar_68 = xlv_FOG.x;
xlt_IN_65.fog = tmpvar_68;
vec4 tmpvar_69;
tmpvar_69 = gl_TexCoord[0].xyzw;
vec4 tmpvar_70;
tmpvar_70 = tmpvar_69;
xlt_IN_65.hip_pack0 = tmpvar_70;
vec3 tmpvar_71;
tmpvar_71 = gl_TexCoord[1].xyz;
vec3 tmpvar_72;
tmpvar_72 = tmpvar_71;
xlt_IN_65.lightDir = tmpvar_72;
vec3 tmpvar_73;
tmpvar_73 = gl_TexCoord[2].xyz;
vec3 tmpvar_74;
tmpvar_74 = tmpvar_73;
xlt_IN_65.viewDir = tmpvar_74;
vec3 tmpvar_75;
tmpvar_75 = gl_TexCoord[3].xyz;
vec3 tmpvar_76;
tmpvar_76 = tmpvar_75;
xlt_IN_65._LightCoord = tmpvar_76;
vec4 tmpvar_77;
tmpvar_77 = frag_surf (xlt_IN_65);
vec4 tmpvar_78;
tmpvar_78 = tmpvar_77;
xl_retval_66 = tmpvar_78;
vec4 tmpvar_79;
tmpvar_79 = xl_retval_66.xyzw;
vec4 tmpvar_80;
tmpvar_80 = tmpvar_79;
gl_FragData[0] = tmpvar_80;
}