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

297 lines
6.8 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;
vec3 worldRefl;
vec3 viewDir;
};
struct v2f_surf {
vec4 pos;
float fog;
vec4 hip_pack0;
vec3 viewDir;
vec3 lightDir;
vec3 _LightCoord;
};
uniform sampler2D _BumpMap;
2014-02-11 02:06:13 -05:00
uniform vec4 _Color;
uniform samplerCube _Cube;
uniform vec4 _LightColor0;
uniform sampler2D _LightTexture0;
uniform sampler2D _MainTex;
uniform float _Parallax;
uniform sampler2D _ParallaxMap;
uniform vec4 _ReflectColor;
uniform float _Shininess;
uniform vec4 _SpecColor;
varying vec4 xlv_FOG;
2012-10-07 23:41:18 -04:00
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;
}
vec2 ParallaxOffset (
in float h_6,
in float height_7,
in vec3 viewDir_8
)
{
vec3 v_9;
float tmpvar_10;
tmpvar_10 = ((h_6 * height_7) - (height_7 / 2.0));
h_6 = tmpvar_10;
vec3 tmpvar_11;
tmpvar_11 = normalize (viewDir_8);
vec3 tmpvar_12;
tmpvar_12 = tmpvar_11;
v_9 = tmpvar_12;
float tmpvar_13;
tmpvar_13 = (v_9.z + 0.42);
v_9.z = vec3(tmpvar_13).z;
return (h_6 * (v_9.xy / v_9.z));
}
void surf (
in Input IN_14,
inout SurfaceOutput o_15
)
{
vec4 reflcol_16;
vec3 worldRefl_17;
vec4 tex_18;
vec2 offset_19;
float h_20;
vec4 tmpvar_21;
tmpvar_21 = texture2D (_ParallaxMap, IN_14.uv_BumpMap);
float tmpvar_22;
tmpvar_22 = tmpvar_21.w;
h_20 = tmpvar_22;
vec2 tmpvar_23;
tmpvar_23 = ParallaxOffset (h_20, _Parallax, IN_14.viewDir);
vec2 tmpvar_24;
tmpvar_24 = tmpvar_23;
offset_19 = tmpvar_24;
vec2 tmpvar_25;
tmpvar_25 = (IN_14.uv_MainTex + offset_19);
IN_14.uv_MainTex = tmpvar_25;
vec2 tmpvar_26;
tmpvar_26 = (IN_14.uv_BumpMap + offset_19);
IN_14.uv_BumpMap = tmpvar_26;
vec4 tmpvar_27;
tmpvar_27 = texture2D (_MainTex, IN_14.uv_MainTex);
vec4 tmpvar_28;
tmpvar_28 = tmpvar_27;
tex_18 = tmpvar_28;
vec3 tmpvar_29;
tmpvar_29 = (tex_18.xyz * _Color.xyz);
o_15.Albedo = tmpvar_29;
float tmpvar_30;
tmpvar_30 = tex_18.w;
o_15.Gloss = tmpvar_30;
float tmpvar_31;
tmpvar_31 = _Shininess;
o_15.Specular = tmpvar_31;
vec4 tmpvar_32;
tmpvar_32 = texture2D (_BumpMap, IN_14.uv_BumpMap);
vec4 tmpvar_33;
tmpvar_33 = UnpackNormal (tmpvar_32);
vec3 tmpvar_34;
tmpvar_34 = tmpvar_33.xyz;
vec3 tmpvar_35;
tmpvar_35 = tmpvar_34;
o_15.Normal = tmpvar_35;
vec3 tmpvar_36;
tmpvar_36 = IN_14.worldRefl;
worldRefl_17 = tmpvar_36;
vec4 tmpvar_37;
tmpvar_37 = textureCube (_Cube, worldRefl_17);
vec4 tmpvar_38;
tmpvar_38 = tmpvar_37;
reflcol_16 = tmpvar_38;
vec4 tmpvar_39;
tmpvar_39 = (reflcol_16 * tex_18.w);
reflcol_16 = tmpvar_39;
vec3 tmpvar_40;
tmpvar_40 = (reflcol_16.xyz * _ReflectColor.xyz);
o_15.Emission = tmpvar_40;
float tmpvar_41;
tmpvar_41 = (reflcol_16.w * _ReflectColor.w);
o_15.Alpha = tmpvar_41;
}
vec4 LightingBlinnPhong (
in SurfaceOutput s_42,
in vec3 lightDir_43,
in vec3 viewDir_44,
in float atten_45
)
{
vec4 c_46;
float spec_47;
float nh_48;
float diff_49;
vec3 h_50;
vec3 tmpvar_51;
tmpvar_51 = normalize ((lightDir_43 + viewDir_44));
vec3 tmpvar_52;
tmpvar_52 = tmpvar_51;
h_50 = tmpvar_52;
float tmpvar_53;
tmpvar_53 = dot (s_42.Normal, lightDir_43);
float tmpvar_54;
tmpvar_54 = max (0.0, tmpvar_53);
float tmpvar_55;
tmpvar_55 = tmpvar_54;
diff_49 = tmpvar_55;
float tmpvar_56;
tmpvar_56 = dot (s_42.Normal, h_50);
float tmpvar_57;
tmpvar_57 = max (0.0, tmpvar_56);
float tmpvar_58;
tmpvar_58 = tmpvar_57;
nh_48 = tmpvar_58;
float tmpvar_59;
tmpvar_59 = pow (nh_48, (s_42.Specular * 128.0));
float tmpvar_60;
tmpvar_60 = (tmpvar_59 * s_42.Gloss);
spec_47 = tmpvar_60;
vec3 tmpvar_61;
2014-02-11 02:06:13 -05:00
tmpvar_61 = (((
(s_42.Albedo * _LightColor0.xyz)
* diff_49) + (
(_LightColor0.xyz * _SpecColor.xyz)
* spec_47)) * (atten_45 * 2.0));
2012-10-07 23:41:18 -04:00
c_46.xyz = tmpvar_61.xyz.xyz;
float tmpvar_62;
2014-02-11 02:06:13 -05:00
tmpvar_62 = (s_42.Alpha + ((
(_LightColor0.w * _SpecColor.w)
* spec_47) * atten_45));
2012-10-07 23:41:18 -04:00
c_46.w = vec4(tmpvar_62).w;
return c_46;
}
vec4 frag_surf (
in v2f_surf IN_63
)
{
vec4 c_64;
vec3 lightDir_65;
SurfaceOutput o_66;
Input surfIN_67;
vec2 tmpvar_68;
tmpvar_68 = IN_63.hip_pack0.xy;
surfIN_67.uv_MainTex = tmpvar_68;
vec2 tmpvar_69;
tmpvar_69 = IN_63.hip_pack0.zw;
surfIN_67.uv_BumpMap = tmpvar_69;
vec3 tmpvar_70;
tmpvar_70 = IN_63.viewDir;
surfIN_67.viewDir = tmpvar_70;
vec3 tmpvar_71;
tmpvar_71 = vec3(0.0, 0.0, 0.0);
o_66.Albedo = tmpvar_71;
vec3 tmpvar_72;
tmpvar_72 = vec3(0.0, 0.0, 0.0);
o_66.Emission = tmpvar_72;
float tmpvar_73;
tmpvar_73 = 0.0;
o_66.Specular = tmpvar_73;
float tmpvar_74;
tmpvar_74 = 0.0;
o_66.Alpha = tmpvar_74;
float tmpvar_75;
tmpvar_75 = 0.0;
o_66.Gloss = tmpvar_75;
surf (surfIN_67, o_66);
vec3 tmpvar_76;
tmpvar_76 = IN_63.lightDir;
lightDir_65 = tmpvar_76;
vec3 tmpvar_77;
tmpvar_77 = normalize (lightDir_65);
vec3 tmpvar_78;
tmpvar_78 = tmpvar_77;
lightDir_65 = tmpvar_78;
vec3 tmpvar_79;
tmpvar_79 = IN_63.viewDir.xyz;
vec3 tmpvar_80;
tmpvar_80 = normalize (tmpvar_79);
float tmpvar_81;
tmpvar_81 = dot (IN_63._LightCoord, IN_63._LightCoord);
vec2 tmpvar_82;
tmpvar_82 = vec2(tmpvar_81);
vec2 tmpvar_83;
tmpvar_83 = tmpvar_82.xy;
vec4 tmpvar_84;
tmpvar_84 = texture2D (_LightTexture0, tmpvar_83);
vec4 tmpvar_85;
tmpvar_85 = LightingBlinnPhong (o_66, lightDir_65, tmpvar_80, tmpvar_84.w);
vec4 tmpvar_86;
tmpvar_86 = tmpvar_85;
c_64 = tmpvar_86;
float tmpvar_87;
tmpvar_87 = 0.0;
c_64.w = vec4(tmpvar_87).w;
return c_64;
}
void main ()
{
v2f_surf xlt_IN_88;
vec4 xl_retval_89;
vec4 tmpvar_90;
tmpvar_90 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_88.pos = tmpvar_90;
float tmpvar_91;
tmpvar_91 = xlv_FOG.x;
xlt_IN_88.fog = tmpvar_91;
vec4 tmpvar_92;
tmpvar_92 = gl_TexCoord[0].xyzw;
vec4 tmpvar_93;
tmpvar_93 = tmpvar_92;
xlt_IN_88.hip_pack0 = tmpvar_93;
vec3 tmpvar_94;
tmpvar_94 = gl_TexCoord[1].xyz;
vec3 tmpvar_95;
tmpvar_95 = tmpvar_94;
xlt_IN_88.viewDir = tmpvar_95;
vec3 tmpvar_96;
tmpvar_96 = gl_TexCoord[2].xyz;
vec3 tmpvar_97;
tmpvar_97 = tmpvar_96;
xlt_IN_88.lightDir = tmpvar_97;
vec3 tmpvar_98;
tmpvar_98 = gl_TexCoord[3].xyz;
vec3 tmpvar_99;
tmpvar_99 = tmpvar_98;
xlt_IN_88._LightCoord = tmpvar_99;
vec4 tmpvar_100;
tmpvar_100 = frag_surf (xlt_IN_88);
vec4 tmpvar_101;
tmpvar_101 = tmpvar_100;
xl_retval_89 = tmpvar_101;
vec4 tmpvar_102;
tmpvar_102 = xl_retval_89.xyzw;
vec4 tmpvar_103;
tmpvar_103 = tmpvar_102;
gl_FragData[0] = tmpvar_103;
}