bgfx/3rdparty/glsl-optimizer/tests/fragment/unity-Legacy_Shaders_Lightmapped_Diffuse-ir.txt

197 lines
4 KiB
Text
Raw Normal View History

2012-04-03 23:30:07 -04:00
struct SurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
vec2 uv2_LightMap;
};
struct v2f_surf {
vec4 pos;
float fog;
vec2 hip_pack0;
vec3 normal;
vec3 lightDir;
vec4 _LightCoord;
};
varying vec4 xlv_FOG;
uniform sampler2D _MainTex;
uniform sampler2D _LightTextureB0;
uniform sampler2D _LightTexture0;
uniform sampler2D _LightMap;
uniform vec4 _LightColor0;
uniform vec4 _Color;
void surf (
in Input IN,
inout SurfaceOutput o
)
{
vec4 lm;
vec4 tmpvar_1;
tmpvar_1 = texture2D (_MainTex, IN.uv_MainTex);
vec3 tmpvar_2;
tmpvar_2 = _Color.xyz;
vec3 tmpvar_3;
tmpvar_3 = (tmpvar_1.xyz * tmpvar_2);
o.Albedo = tmpvar_3;
vec4 tmpvar_4;
tmpvar_4 = texture2D (_LightMap, IN.uv2_LightMap);
vec4 tmpvar_5;
tmpvar_5 = tmpvar_4;
lm = tmpvar_5;
vec3 tmpvar_6;
tmpvar_6 = (lm.xyz * o.Albedo.xyz);
o.Emission = tmpvar_6;
float tmpvar_7;
tmpvar_7 = (lm.w * _Color.w);
o.Alpha = tmpvar_7;
}
float UnitySpotCookie (
in vec4 LightCoord
)
{
vec4 tmpvar_1;
tmpvar_1 = texture2D (_LightTexture0, ((LightCoord.xy / LightCoord.w) + 0.5));
return tmpvar_1.w;
}
float UnitySpotAttenuate (
in vec3 LightCoord
)
{
float tmpvar_1;
tmpvar_1 = dot (LightCoord, LightCoord);
vec2 tmpvar_2;
tmpvar_2 = vec2(tmpvar_1);
vec2 tmpvar_3;
tmpvar_3 = tmpvar_2.xy;
vec4 tmpvar_4;
tmpvar_4 = texture2D (_LightTextureB0, tmpvar_3);
return tmpvar_4.w;
}
vec4 LightingLambert (
in SurfaceOutput s,
in vec3 lightDir,
in float atten
)
{
vec4 c;
float diff;
float tmpvar_1;
tmpvar_1 = dot (s.Normal, lightDir);
float tmpvar_2;
tmpvar_2 = max (0.0, tmpvar_1);
float tmpvar_3;
tmpvar_3 = tmpvar_2;
diff = tmpvar_3;
vec3 tmpvar_4;
tmpvar_4 = ((s.Albedo * _LightColor0.xyz) * ((diff * atten) * 2.0));
c.xyz = tmpvar_4.xyz.xyz;
float tmpvar_5;
tmpvar_5 = s.Alpha;
c.w = vec4(tmpvar_5).w;
return c;
}
vec4 frag_surf (
in v2f_surf IN
)
{
vec4 c;
vec3 lightDir;
SurfaceOutput o;
Input surfIN;
vec2 tmpvar_1;
tmpvar_1 = IN.hip_pack0.xy;
surfIN.uv_MainTex = tmpvar_1;
vec3 tmpvar_2;
tmpvar_2 = vec3(0.0, 0.0, 0.0);
o.Albedo = tmpvar_2;
vec3 tmpvar_3;
tmpvar_3 = vec3(0.0, 0.0, 0.0);
o.Emission = tmpvar_3;
float tmpvar_4;
tmpvar_4 = 0.0;
o.Specular = tmpvar_4;
float tmpvar_5;
tmpvar_5 = 0.0;
o.Alpha = tmpvar_5;
float tmpvar_6;
tmpvar_6 = 0.0;
o.Gloss = tmpvar_6;
vec3 tmpvar_7;
tmpvar_7 = IN.normal;
o.Normal = tmpvar_7;
surf (surfIN, o);
vec3 tmpvar_8;
tmpvar_8 = IN.lightDir;
lightDir = tmpvar_8;
vec3 tmpvar_9;
tmpvar_9 = normalize (lightDir);
vec3 tmpvar_10;
tmpvar_10 = tmpvar_9;
lightDir = tmpvar_10;
float tmpvar_11;
tmpvar_11 = UnitySpotCookie (IN._LightCoord);
float tmpvar_12;
tmpvar_12 = UnitySpotAttenuate (IN._LightCoord.xyz);
vec4 tmpvar_13;
tmpvar_13 = LightingLambert (o, lightDir, ((float((IN._LightCoord.z > 0.0)) * tmpvar_11) * tmpvar_12));
vec4 tmpvar_14;
tmpvar_14 = tmpvar_13;
c = tmpvar_14;
float tmpvar_15;
tmpvar_15 = 0.0;
c.w = vec4(tmpvar_15).w;
return c;
}
void main ()
{
v2f_surf xlt_IN;
vec4 xl_retval;
vec4 tmpvar_1;
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN.pos = tmpvar_1;
float tmpvar_2;
tmpvar_2 = xlv_FOG.x;
xlt_IN.fog = tmpvar_2;
vec2 tmpvar_3;
tmpvar_3 = gl_TexCoord[0].xy;
vec2 tmpvar_4;
tmpvar_4 = tmpvar_3;
xlt_IN.hip_pack0 = tmpvar_4;
vec3 tmpvar_5;
tmpvar_5 = gl_TexCoord[1].xyz;
vec3 tmpvar_6;
tmpvar_6 = tmpvar_5;
xlt_IN.normal = tmpvar_6;
vec3 tmpvar_7;
tmpvar_7 = gl_TexCoord[2].xyz;
vec3 tmpvar_8;
tmpvar_8 = tmpvar_7;
xlt_IN.lightDir = tmpvar_8;
vec4 tmpvar_9;
tmpvar_9 = gl_TexCoord[3].xyzw;
vec4 tmpvar_10;
tmpvar_10 = tmpvar_9;
xlt_IN._LightCoord = tmpvar_10;
vec4 tmpvar_11;
tmpvar_11 = frag_surf (xlt_IN);
vec4 tmpvar_12;
tmpvar_12 = tmpvar_11;
xl_retval = tmpvar_12;
vec4 tmpvar_13;
tmpvar_13 = xl_retval.xyzw;
vec4 tmpvar_14;
tmpvar_14 = tmpvar_13;
gl_FragData[0] = tmpvar_14;
}