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

237 lines
5.3 KiB
Text

struct SurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
vec2 uv_Illum;
};
struct v2f_surf {
vec4 pos;
float fog;
vec2 hip_pack0;
vec3 normal;
vec3 lightDir;
vec3 viewDir;
vec4 _LightCoord;
};
varying vec4 xlv_FOG;
uniform vec4 _SpecColor;
uniform float _Shininess;
uniform sampler2D _MainTex;
uniform sampler2D _LightTextureB0;
uniform sampler2D _LightTexture0;
uniform vec4 _LightColor0;
uniform sampler2D _Illum;
uniform vec4 _Color;
void surf (
in Input IN_1,
inout SurfaceOutput o_2
)
{
vec4 c_3;
vec4 tex_4;
vec4 tmpvar_5;
tmpvar_5 = texture2D (_MainTex, IN_1.uv_MainTex);
vec4 tmpvar_6;
tmpvar_6 = tmpvar_5;
tex_4 = tmpvar_6;
vec4 tmpvar_7;
tmpvar_7 = (tex_4 * _Color);
c_3 = tmpvar_7;
vec3 tmpvar_8;
tmpvar_8 = c_3.xyz;
o_2.Albedo = tmpvar_8;
vec4 tmpvar_9;
tmpvar_9 = texture2D (_Illum, IN_1.uv_Illum);
vec3 tmpvar_10;
tmpvar_10 = (c_3.xyz * tmpvar_9.w);
o_2.Emission = tmpvar_10;
float tmpvar_11;
tmpvar_11 = tex_4.w;
o_2.Gloss = tmpvar_11;
float tmpvar_12;
tmpvar_12 = c_3.w;
o_2.Alpha = tmpvar_12;
float tmpvar_13;
tmpvar_13 = _Shininess;
o_2.Specular = tmpvar_13;
}
float UnitySpotCookie (
in vec4 LightCoord_14
)
{
vec4 tmpvar_15;
tmpvar_15 = texture2D (_LightTexture0, ((LightCoord_14.xy / LightCoord_14.w) + 0.5));
return tmpvar_15.w;
}
float UnitySpotAttenuate (
in vec3 LightCoord_16
)
{
float tmpvar_17;
tmpvar_17 = dot (LightCoord_16, LightCoord_16);
vec2 tmpvar_18;
tmpvar_18 = vec2(tmpvar_17);
vec2 tmpvar_19;
tmpvar_19 = tmpvar_18.xy;
vec4 tmpvar_20;
tmpvar_20 = texture2D (_LightTextureB0, tmpvar_19);
return tmpvar_20.w;
}
vec4 LightingBlinnPhong (
in SurfaceOutput s_21,
in vec3 lightDir_22,
in vec3 viewDir_23,
in float atten_24
)
{
vec4 c_25;
float spec_26;
float nh_27;
float diff_28;
vec3 h_29;
vec3 tmpvar_30;
tmpvar_30 = normalize ((lightDir_22 + viewDir_23));
vec3 tmpvar_31;
tmpvar_31 = tmpvar_30;
h_29 = tmpvar_31;
float tmpvar_32;
tmpvar_32 = dot (s_21.Normal, lightDir_22);
float tmpvar_33;
tmpvar_33 = max (0.0, tmpvar_32);
float tmpvar_34;
tmpvar_34 = tmpvar_33;
diff_28 = tmpvar_34;
float tmpvar_35;
tmpvar_35 = dot (s_21.Normal, h_29);
float tmpvar_36;
tmpvar_36 = max (0.0, tmpvar_35);
float tmpvar_37;
tmpvar_37 = tmpvar_36;
nh_27 = tmpvar_37;
float tmpvar_38;
tmpvar_38 = pow (nh_27, (s_21.Specular * 128.0));
float tmpvar_39;
tmpvar_39 = (tmpvar_38 * s_21.Gloss);
spec_26 = tmpvar_39;
vec3 tmpvar_40;
tmpvar_40 = ((((s_21.Albedo * _LightColor0.xyz) * diff_28) + ((_LightColor0.xyz * _SpecColor.xyz) * spec_26)) * (atten_24 * 2.0));
c_25.xyz = tmpvar_40.xyz.xyz;
float tmpvar_41;
tmpvar_41 = (s_21.Alpha + (((_LightColor0.w * _SpecColor.w) * spec_26) * atten_24));
c_25.w = vec4(tmpvar_41).w;
return c_25;
}
vec4 frag_surf (
in v2f_surf IN_42
)
{
vec4 c_43;
vec3 lightDir_44;
SurfaceOutput o_45;
Input surfIN_46;
vec2 tmpvar_47;
tmpvar_47 = IN_42.hip_pack0.xy;
surfIN_46.uv_MainTex = tmpvar_47;
vec3 tmpvar_48;
tmpvar_48 = vec3(0.0, 0.0, 0.0);
o_45.Albedo = tmpvar_48;
vec3 tmpvar_49;
tmpvar_49 = vec3(0.0, 0.0, 0.0);
o_45.Emission = tmpvar_49;
float tmpvar_50;
tmpvar_50 = 0.0;
o_45.Specular = tmpvar_50;
float tmpvar_51;
tmpvar_51 = 0.0;
o_45.Alpha = tmpvar_51;
float tmpvar_52;
tmpvar_52 = 0.0;
o_45.Gloss = tmpvar_52;
vec3 tmpvar_53;
tmpvar_53 = IN_42.normal;
o_45.Normal = tmpvar_53;
surf (surfIN_46, o_45);
vec3 tmpvar_54;
tmpvar_54 = IN_42.lightDir;
lightDir_44 = tmpvar_54;
vec3 tmpvar_55;
tmpvar_55 = normalize (lightDir_44);
vec3 tmpvar_56;
tmpvar_56 = tmpvar_55;
lightDir_44 = tmpvar_56;
vec3 tmpvar_57;
tmpvar_57 = IN_42.viewDir.xyz;
vec3 tmpvar_58;
tmpvar_58 = normalize (tmpvar_57);
float tmpvar_59;
tmpvar_59 = UnitySpotCookie (IN_42._LightCoord);
float tmpvar_60;
tmpvar_60 = UnitySpotAttenuate (IN_42._LightCoord.xyz);
vec4 tmpvar_61;
tmpvar_61 = LightingBlinnPhong (o_45, lightDir_44, tmpvar_58, ((float((IN_42._LightCoord.z > 0.0)) * tmpvar_59) * tmpvar_60));
vec4 tmpvar_62;
tmpvar_62 = tmpvar_61;
c_43 = tmpvar_62;
float tmpvar_63;
tmpvar_63 = 0.0;
c_43.w = vec4(tmpvar_63).w;
return c_43;
}
void main ()
{
v2f_surf xlt_IN_64;
vec4 xl_retval_65;
vec4 tmpvar_66;
tmpvar_66 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_64.pos = tmpvar_66;
float tmpvar_67;
tmpvar_67 = xlv_FOG.x;
xlt_IN_64.fog = tmpvar_67;
vec2 tmpvar_68;
tmpvar_68 = gl_TexCoord[0].xy;
vec2 tmpvar_69;
tmpvar_69 = tmpvar_68;
xlt_IN_64.hip_pack0 = tmpvar_69;
vec3 tmpvar_70;
tmpvar_70 = gl_TexCoord[1].xyz;
vec3 tmpvar_71;
tmpvar_71 = tmpvar_70;
xlt_IN_64.normal = tmpvar_71;
vec3 tmpvar_72;
tmpvar_72 = gl_TexCoord[2].xyz;
vec3 tmpvar_73;
tmpvar_73 = tmpvar_72;
xlt_IN_64.lightDir = tmpvar_73;
vec3 tmpvar_74;
tmpvar_74 = gl_TexCoord[3].xyz;
vec3 tmpvar_75;
tmpvar_75 = tmpvar_74;
xlt_IN_64.viewDir = tmpvar_75;
vec4 tmpvar_76;
tmpvar_76 = gl_TexCoord[4].xyzw;
vec4 tmpvar_77;
tmpvar_77 = tmpvar_76;
xlt_IN_64._LightCoord = tmpvar_77;
vec4 tmpvar_78;
tmpvar_78 = frag_surf (xlt_IN_64);
vec4 tmpvar_79;
tmpvar_79 = tmpvar_78;
xl_retval_65 = tmpvar_79;
vec4 tmpvar_80;
tmpvar_80 = xl_retval_65.xyzw;
vec4 tmpvar_81;
tmpvar_81 = tmpvar_80;
gl_FragData[0] = tmpvar_81;
}