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

178 lines
3.9 KiB
Text

struct SurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
vec2 uv_BumpMap;
vec2 uv2_LightMap;
};
struct v2f_surf {
vec4 pos;
float fog;
vec4 hip_pack0;
vec4 hip_screen;
};
varying vec4 xlv_FOG;
uniform vec4 unity_Ambient;
uniform sampler2D _MainTex;
uniform sampler2D _LightMap;
uniform sampler2D _LightBuffer;
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 lm_8;
vec4 tmpvar_9;
tmpvar_9 = texture2D (_MainTex, IN_6.uv_MainTex);
vec3 tmpvar_10;
tmpvar_10 = _Color.xyz;
vec3 tmpvar_11;
tmpvar_11 = (tmpvar_9.xyz * tmpvar_10);
o_7.Albedo = tmpvar_11;
vec4 tmpvar_12;
tmpvar_12 = texture2D (_LightMap, IN_6.uv2_LightMap);
vec4 tmpvar_13;
tmpvar_13 = tmpvar_12;
lm_8 = tmpvar_13;
vec3 tmpvar_14;
tmpvar_14 = (lm_8.xyz * o_7.Albedo.xyz);
o_7.Emission = tmpvar_14;
float tmpvar_15;
tmpvar_15 = (lm_8.w * _Color.w);
o_7.Alpha = tmpvar_15;
vec4 tmpvar_16;
tmpvar_16 = texture2D (_BumpMap, IN_6.uv_BumpMap);
vec4 tmpvar_17;
tmpvar_17 = UnpackNormal (tmpvar_16);
vec3 tmpvar_18;
tmpvar_18 = tmpvar_17.xyz;
vec3 tmpvar_19;
tmpvar_19 = tmpvar_18;
o_7.Normal = tmpvar_19;
}
vec4 LightingLambert_PrePass (
in SurfaceOutput s_20,
in vec4 light_21
)
{
vec4 c_22;
vec3 tmpvar_23;
tmpvar_23 = (s_20.Albedo * light_21.xyz);
c_22.xyz = tmpvar_23.xyz.xyz;
float tmpvar_24;
tmpvar_24 = s_20.Alpha;
c_22.w = vec4(tmpvar_24).w;
return c_22;
}
vec4 frag_surf (
in v2f_surf IN_25
)
{
vec4 col_26;
vec4 light_27;
SurfaceOutput o_28;
Input surfIN_29;
vec2 tmpvar_30;
tmpvar_30 = IN_25.hip_pack0.xy;
surfIN_29.uv_MainTex = tmpvar_30;
vec2 tmpvar_31;
tmpvar_31 = IN_25.hip_pack0.zw;
surfIN_29.uv2_LightMap = tmpvar_31;
vec3 tmpvar_32;
tmpvar_32 = vec3(0.0, 0.0, 0.0);
o_28.Albedo = tmpvar_32;
vec3 tmpvar_33;
tmpvar_33 = vec3(0.0, 0.0, 0.0);
o_28.Emission = tmpvar_33;
float tmpvar_34;
tmpvar_34 = 0.0;
o_28.Specular = tmpvar_34;
float tmpvar_35;
tmpvar_35 = 0.0;
o_28.Alpha = tmpvar_35;
float tmpvar_36;
tmpvar_36 = 0.0;
o_28.Gloss = tmpvar_36;
surf (surfIN_29, o_28);
vec4 tmpvar_37;
tmpvar_37 = texture2DProj (_LightBuffer, IN_25.hip_screen);
vec4 tmpvar_38;
tmpvar_38 = tmpvar_37;
light_27 = tmpvar_38;
vec4 tmpvar_39;
tmpvar_39 = log2 (light_27);
vec4 tmpvar_40;
tmpvar_40 = -(tmpvar_39);
light_27 = tmpvar_40;
vec3 tmpvar_41;
tmpvar_41 = (light_27.xyz + unity_Ambient.xyz);
light_27.xyz = tmpvar_41.xyz.xyz;
vec4 tmpvar_42;
tmpvar_42 = LightingLambert_PrePass (o_28, light_27);
vec4 tmpvar_43;
tmpvar_43 = tmpvar_42;
col_26 = tmpvar_43;
vec3 tmpvar_44;
tmpvar_44 = (col_26.xyz + o_28.Emission);
col_26.xyz = tmpvar_44.xyz.xyz;
return col_26;
}
void main ()
{
v2f_surf xlt_IN_45;
vec4 xl_retval_46;
vec4 tmpvar_47;
tmpvar_47 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_45.pos = tmpvar_47;
float tmpvar_48;
tmpvar_48 = xlv_FOG.x;
xlt_IN_45.fog = tmpvar_48;
vec4 tmpvar_49;
tmpvar_49 = gl_TexCoord[0].xyzw;
vec4 tmpvar_50;
tmpvar_50 = tmpvar_49;
xlt_IN_45.hip_pack0 = tmpvar_50;
vec4 tmpvar_51;
tmpvar_51 = gl_TexCoord[1].xyzw;
vec4 tmpvar_52;
tmpvar_52 = tmpvar_51;
xlt_IN_45.hip_screen = tmpvar_52;
vec4 tmpvar_53;
tmpvar_53 = frag_surf (xlt_IN_45);
vec4 tmpvar_54;
tmpvar_54 = tmpvar_53;
xl_retval_46 = tmpvar_54;
vec4 tmpvar_55;
tmpvar_55 = xl_retval_46.xyzw;
vec4 tmpvar_56;
tmpvar_56 = tmpvar_55;
gl_FragData[0] = tmpvar_56;
}