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

285 lines
6.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;
vec3 worldRefl;
vec3 viewDir;
};
struct v2f_surf {
vec4 pos;
float fog;
vec4 hip_pack0;
vec3 viewDir;
vec3 lightDir;
vec4 _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 _LightTextureB0;
uniform sampler2D _MainTex;
uniform float _Parallax;
uniform sampler2D _ParallaxMap;
uniform vec4 _ReflectColor;
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 c_18;
vec4 tex_19;
vec2 offset_20;
float h_21;
vec4 tmpvar_22;
tmpvar_22 = texture2D (_ParallaxMap, IN_14.uv_BumpMap);
float tmpvar_23;
tmpvar_23 = tmpvar_22.w;
h_21 = tmpvar_23;
vec2 tmpvar_24;
tmpvar_24 = ParallaxOffset (h_21, _Parallax, IN_14.viewDir);
vec2 tmpvar_25;
tmpvar_25 = tmpvar_24;
offset_20 = tmpvar_25;
vec2 tmpvar_26;
tmpvar_26 = (IN_14.uv_MainTex + offset_20);
IN_14.uv_MainTex = tmpvar_26;
vec2 tmpvar_27;
tmpvar_27 = (IN_14.uv_BumpMap + offset_20);
IN_14.uv_BumpMap = tmpvar_27;
vec4 tmpvar_28;
tmpvar_28 = texture2D (_MainTex, IN_14.uv_MainTex);
vec4 tmpvar_29;
tmpvar_29 = tmpvar_28;
tex_19 = tmpvar_29;
vec4 tmpvar_30;
tmpvar_30 = (tex_19 * _Color);
c_18 = tmpvar_30;
vec3 tmpvar_31;
tmpvar_31 = c_18.xyz;
o_15.Albedo = 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_19.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;
}
float UnitySpotCookie (
in vec4 LightCoord_42
)
{
vec4 tmpvar_43;
tmpvar_43 = texture2D (_LightTexture0, ((LightCoord_42.xy / LightCoord_42.w) + 0.5));
return tmpvar_43.w;
}
float UnitySpotAttenuate (
in vec3 LightCoord_44
)
{
float tmpvar_45;
tmpvar_45 = dot (LightCoord_44, LightCoord_44);
vec2 tmpvar_46;
tmpvar_46 = vec2(tmpvar_45);
vec2 tmpvar_47;
tmpvar_47 = tmpvar_46.xy;
vec4 tmpvar_48;
tmpvar_48 = texture2D (_LightTextureB0, tmpvar_47);
return tmpvar_48.w;
}
vec4 LightingLambert (
in SurfaceOutput s_49,
in vec3 lightDir_50,
in float atten_51
)
{
vec4 c_52;
float diff_53;
float tmpvar_54;
tmpvar_54 = dot (s_49.Normal, lightDir_50);
float tmpvar_55;
tmpvar_55 = max (0.0, tmpvar_54);
float tmpvar_56;
tmpvar_56 = tmpvar_55;
diff_53 = tmpvar_56;
vec3 tmpvar_57;
tmpvar_57 = ((s_49.Albedo * _LightColor0.xyz) * ((diff_53 * atten_51) * 2.0));
c_52.xyz = tmpvar_57.xyz.xyz;
float tmpvar_58;
tmpvar_58 = s_49.Alpha;
c_52.w = vec4(tmpvar_58).w;
return c_52;
}
vec4 frag_surf (
in v2f_surf IN_59
)
{
vec4 c_60;
vec3 lightDir_61;
SurfaceOutput o_62;
Input surfIN_63;
vec2 tmpvar_64;
tmpvar_64 = IN_59.hip_pack0.xy;
surfIN_63.uv_MainTex = tmpvar_64;
vec2 tmpvar_65;
tmpvar_65 = IN_59.hip_pack0.zw;
surfIN_63.uv_BumpMap = tmpvar_65;
vec3 tmpvar_66;
tmpvar_66 = IN_59.viewDir;
surfIN_63.viewDir = tmpvar_66;
vec3 tmpvar_67;
tmpvar_67 = vec3(0.0, 0.0, 0.0);
o_62.Albedo = tmpvar_67;
vec3 tmpvar_68;
tmpvar_68 = vec3(0.0, 0.0, 0.0);
o_62.Emission = tmpvar_68;
float tmpvar_69;
tmpvar_69 = 0.0;
o_62.Specular = tmpvar_69;
float tmpvar_70;
tmpvar_70 = 0.0;
o_62.Alpha = tmpvar_70;
float tmpvar_71;
tmpvar_71 = 0.0;
o_62.Gloss = tmpvar_71;
surf (surfIN_63, o_62);
vec3 tmpvar_72;
tmpvar_72 = IN_59.lightDir;
lightDir_61 = tmpvar_72;
vec3 tmpvar_73;
tmpvar_73 = normalize (lightDir_61);
vec3 tmpvar_74;
tmpvar_74 = tmpvar_73;
lightDir_61 = tmpvar_74;
float tmpvar_75;
tmpvar_75 = UnitySpotCookie (IN_59._LightCoord);
float tmpvar_76;
tmpvar_76 = UnitySpotAttenuate (IN_59._LightCoord.xyz);
vec4 tmpvar_77;
2014-02-11 02:06:13 -05:00
tmpvar_77 = LightingLambert (o_62, lightDir_61, ((float(
(IN_59._LightCoord.z > 0.0)
) * tmpvar_75) * tmpvar_76));
2012-10-07 23:41:18 -04:00
vec4 tmpvar_78;
tmpvar_78 = tmpvar_77;
c_60 = tmpvar_78;
float tmpvar_79;
tmpvar_79 = 0.0;
c_60.w = vec4(tmpvar_79).w;
return c_60;
}
void main ()
{
v2f_surf xlt_IN_80;
vec4 xl_retval_81;
vec4 tmpvar_82;
tmpvar_82 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_80.pos = tmpvar_82;
float tmpvar_83;
tmpvar_83 = xlv_FOG.x;
xlt_IN_80.fog = tmpvar_83;
vec4 tmpvar_84;
tmpvar_84 = gl_TexCoord[0].xyzw;
vec4 tmpvar_85;
tmpvar_85 = tmpvar_84;
xlt_IN_80.hip_pack0 = tmpvar_85;
vec3 tmpvar_86;
tmpvar_86 = gl_TexCoord[1].xyz;
vec3 tmpvar_87;
tmpvar_87 = tmpvar_86;
xlt_IN_80.viewDir = tmpvar_87;
vec3 tmpvar_88;
tmpvar_88 = gl_TexCoord[2].xyz;
vec3 tmpvar_89;
tmpvar_89 = tmpvar_88;
xlt_IN_80.lightDir = tmpvar_89;
vec4 tmpvar_90;
tmpvar_90 = gl_TexCoord[3].xyzw;
vec4 tmpvar_91;
tmpvar_91 = tmpvar_90;
xlt_IN_80._LightCoord = tmpvar_91;
vec4 tmpvar_92;
tmpvar_92 = frag_surf (xlt_IN_80);
vec4 tmpvar_93;
tmpvar_93 = tmpvar_92;
xl_retval_81 = tmpvar_93;
vec4 tmpvar_94;
tmpvar_94 = xl_retval_81.xyzw;
vec4 tmpvar_95;
tmpvar_95 = tmpvar_94;
gl_FragData[0] = tmpvar_95;
}