bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-Transparent_Cutout_Specular-ir.txt
2014-02-10 23:06:13 -08:00

202 lines
4.2 KiB
Text

struct SurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
};
struct v2f_surf {
vec4 pos;
float fog;
vec2 hip_pack0;
vec3 normal;
vec3 lightDir;
vec3 viewDir;
};
uniform vec4 _Color;
uniform float _Cutoff;
uniform vec4 _LightColor0;
uniform sampler2D _MainTex;
uniform float _Shininess;
uniform vec4 _SpecColor;
varying vec4 xlv_FOG;
void xll_clip (
in float x_1
)
{
if ((x_1 < 0.0)) {
discard;
};
}
void surf (
in Input IN_2,
inout SurfaceOutput o_3
)
{
vec4 tex_4;
vec4 tmpvar_5;
tmpvar_5 = texture2D (_MainTex, IN_2.uv_MainTex);
vec4 tmpvar_6;
tmpvar_6 = tmpvar_5;
tex_4 = tmpvar_6;
vec3 tmpvar_7;
tmpvar_7 = (tex_4.xyz * _Color.xyz);
o_3.Albedo = tmpvar_7;
float tmpvar_8;
tmpvar_8 = tex_4.w;
o_3.Gloss = tmpvar_8;
float tmpvar_9;
tmpvar_9 = (tex_4.w * _Color.w);
o_3.Alpha = tmpvar_9;
float tmpvar_10;
tmpvar_10 = _Shininess;
o_3.Specular = tmpvar_10;
}
vec4 LightingBlinnPhong (
in SurfaceOutput s_11,
in vec3 lightDir_12,
in vec3 viewDir_13,
in float atten_14
)
{
vec4 c_15;
float spec_16;
float nh_17;
float diff_18;
vec3 h_19;
vec3 tmpvar_20;
tmpvar_20 = normalize ((lightDir_12 + viewDir_13));
vec3 tmpvar_21;
tmpvar_21 = tmpvar_20;
h_19 = tmpvar_21;
float tmpvar_22;
tmpvar_22 = dot (s_11.Normal, lightDir_12);
float tmpvar_23;
tmpvar_23 = max (0.0, tmpvar_22);
float tmpvar_24;
tmpvar_24 = tmpvar_23;
diff_18 = tmpvar_24;
float tmpvar_25;
tmpvar_25 = dot (s_11.Normal, h_19);
float tmpvar_26;
tmpvar_26 = max (0.0, tmpvar_25);
float tmpvar_27;
tmpvar_27 = tmpvar_26;
nh_17 = tmpvar_27;
float tmpvar_28;
tmpvar_28 = pow (nh_17, (s_11.Specular * 128.0));
float tmpvar_29;
tmpvar_29 = (tmpvar_28 * s_11.Gloss);
spec_16 = tmpvar_29;
vec3 tmpvar_30;
tmpvar_30 = (((
(s_11.Albedo * _LightColor0.xyz)
* diff_18) + (
(_LightColor0.xyz * _SpecColor.xyz)
* spec_16)) * (atten_14 * 2.0));
c_15.xyz = tmpvar_30.xyz.xyz;
float tmpvar_31;
tmpvar_31 = (s_11.Alpha + ((
(_LightColor0.w * _SpecColor.w)
* spec_16) * atten_14));
c_15.w = vec4(tmpvar_31).w;
return c_15;
}
vec4 frag_surf (
in v2f_surf IN_32
)
{
vec4 c_33;
vec3 lightDir_34;
SurfaceOutput o_35;
Input surfIN_36;
vec2 tmpvar_37;
tmpvar_37 = IN_32.hip_pack0.xy;
surfIN_36.uv_MainTex = tmpvar_37;
vec3 tmpvar_38;
tmpvar_38 = vec3(0.0, 0.0, 0.0);
o_35.Albedo = tmpvar_38;
vec3 tmpvar_39;
tmpvar_39 = vec3(0.0, 0.0, 0.0);
o_35.Emission = tmpvar_39;
float tmpvar_40;
tmpvar_40 = 0.0;
o_35.Specular = tmpvar_40;
float tmpvar_41;
tmpvar_41 = 0.0;
o_35.Alpha = tmpvar_41;
float tmpvar_42;
tmpvar_42 = 0.0;
o_35.Gloss = tmpvar_42;
vec3 tmpvar_43;
tmpvar_43 = IN_32.normal;
o_35.Normal = tmpvar_43;
surf (surfIN_36, o_35);
xll_clip ((o_35.Alpha - _Cutoff));
vec3 tmpvar_44;
tmpvar_44 = IN_32.lightDir;
lightDir_34 = tmpvar_44;
vec3 tmpvar_45;
tmpvar_45 = IN_32.viewDir.xyz;
vec3 tmpvar_46;
tmpvar_46 = normalize (tmpvar_45);
vec4 tmpvar_47;
tmpvar_47 = LightingBlinnPhong (o_35, lightDir_34, tmpvar_46, 1.0);
vec4 tmpvar_48;
tmpvar_48 = tmpvar_47;
c_33 = tmpvar_48;
float tmpvar_49;
tmpvar_49 = o_35.Alpha;
c_33.w = vec4(tmpvar_49).w;
return c_33;
}
void main ()
{
v2f_surf xlt_IN_50;
vec4 xl_retval_51;
vec4 tmpvar_52;
tmpvar_52 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_50.pos = tmpvar_52;
float tmpvar_53;
tmpvar_53 = xlv_FOG.x;
xlt_IN_50.fog = tmpvar_53;
vec2 tmpvar_54;
tmpvar_54 = gl_TexCoord[0].xy;
vec2 tmpvar_55;
tmpvar_55 = tmpvar_54;
xlt_IN_50.hip_pack0 = tmpvar_55;
vec3 tmpvar_56;
tmpvar_56 = gl_TexCoord[1].xyz;
vec3 tmpvar_57;
tmpvar_57 = tmpvar_56;
xlt_IN_50.normal = tmpvar_57;
vec3 tmpvar_58;
tmpvar_58 = gl_TexCoord[2].xyz;
vec3 tmpvar_59;
tmpvar_59 = tmpvar_58;
xlt_IN_50.lightDir = tmpvar_59;
vec3 tmpvar_60;
tmpvar_60 = gl_TexCoord[3].xyz;
vec3 tmpvar_61;
tmpvar_61 = tmpvar_60;
xlt_IN_50.viewDir = tmpvar_61;
vec4 tmpvar_62;
tmpvar_62 = frag_surf (xlt_IN_50);
vec4 tmpvar_63;
tmpvar_63 = tmpvar_62;
xl_retval_51 = tmpvar_63;
vec4 tmpvar_64;
tmpvar_64 = xl_retval_51.xyzw;
vec4 tmpvar_65;
tmpvar_65 = tmpvar_64;
gl_FragData[0] = tmpvar_65;
}