bgfx/3rdparty/glsl-optimizer/tests/fragment/unity-Self-Illumin_Bumped_Diffuse1-ir.txt
Branimir Karadzic dee3fe5266 Initial commit.
2012-04-03 20:30:07 -07:00

170 lines
3.4 KiB
Text

struct SurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
vec2 uv_Illum;
vec2 uv_BumpMap;
};
struct v2f_surf {
vec4 pos;
vec2 hip_pack0;
vec3 TtoV0;
vec3 TtoV1;
vec3 TtoV2;
};
uniform sampler2D _MainTex;
uniform sampler2D _Illum;
uniform vec4 _Color;
uniform sampler2D _BumpMap;
vec4 UnpackNormal (
in vec4 packednormal
)
{
vec4 normal;
vec2 tmpvar_1;
tmpvar_1 = ((packednormal.wy * 2.0) - 1.0);
normal.xy = tmpvar_1.xy.xy;
float tmpvar_2;
tmpvar_2 = sqrt (((1.0 - (normal.x * normal.x)) - (normal.y * normal.y)));
float tmpvar_3;
tmpvar_3 = tmpvar_2;
normal.z = vec3(tmpvar_3).z;
return normal;
}
void surf (
in Input IN,
inout SurfaceOutput o
)
{
vec4 c;
vec4 tex;
vec4 tmpvar_1;
tmpvar_1 = texture2D (_MainTex, IN.uv_MainTex);
vec4 tmpvar_2;
tmpvar_2 = tmpvar_1;
tex = tmpvar_2;
vec4 tmpvar_3;
tmpvar_3 = (tex * _Color);
c = tmpvar_3;
vec3 tmpvar_4;
tmpvar_4 = c.xyz;
o.Albedo = tmpvar_4;
vec4 tmpvar_5;
tmpvar_5 = texture2D (_Illum, IN.uv_Illum);
vec3 tmpvar_6;
tmpvar_6 = (c.xyz * tmpvar_5.w);
o.Emission = tmpvar_6;
float tmpvar_7;
tmpvar_7 = c.w;
o.Alpha = tmpvar_7;
vec4 tmpvar_8;
tmpvar_8 = texture2D (_BumpMap, IN.uv_BumpMap);
vec4 tmpvar_9;
tmpvar_9 = UnpackNormal (tmpvar_8);
vec3 tmpvar_10;
tmpvar_10 = tmpvar_9.xyz;
vec3 tmpvar_11;
tmpvar_11 = tmpvar_10;
o.Normal = tmpvar_11;
}
vec4 frag_surf (
in v2f_surf IN
)
{
vec4 res;
vec3 viewN;
SurfaceOutput o;
Input surfIN;
vec2 tmpvar_1;
tmpvar_1 = IN.hip_pack0.xy;
surfIN.uv_BumpMap = 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;
surf (surfIN, o);
float tmpvar_7;
tmpvar_7 = dot (IN.TtoV0, o.Normal);
float tmpvar_8;
tmpvar_8 = tmpvar_7;
viewN.x = tmpvar_8;
float tmpvar_9;
tmpvar_9 = dot (IN.TtoV1, o.Normal);
float tmpvar_10;
tmpvar_10 = tmpvar_9;
viewN.y = vec2(tmpvar_10).y;
float tmpvar_11;
tmpvar_11 = dot (IN.TtoV2, o.Normal);
float tmpvar_12;
tmpvar_12 = tmpvar_11;
viewN.z = vec3(tmpvar_12).z;
vec3 tmpvar_13;
tmpvar_13 = viewN;
o.Normal = tmpvar_13;
vec3 tmpvar_14;
tmpvar_14 = ((o.Normal * vec3(0.5, 0.5, -0.5)) + 0.5);
res.xyz = tmpvar_14.xyz.xyz;
float tmpvar_15;
tmpvar_15 = o.Specular;
res.w = vec4(tmpvar_15).w;
return res;
}
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;
vec2 tmpvar_2;
tmpvar_2 = gl_TexCoord[0].xy;
vec2 tmpvar_3;
tmpvar_3 = tmpvar_2;
xlt_IN.hip_pack0 = tmpvar_3;
vec3 tmpvar_4;
tmpvar_4 = gl_TexCoord[1].xyz;
vec3 tmpvar_5;
tmpvar_5 = tmpvar_4;
xlt_IN.TtoV0 = tmpvar_5;
vec3 tmpvar_6;
tmpvar_6 = gl_TexCoord[2].xyz;
vec3 tmpvar_7;
tmpvar_7 = tmpvar_6;
xlt_IN.TtoV1 = tmpvar_7;
vec3 tmpvar_8;
tmpvar_8 = gl_TexCoord[3].xyz;
vec3 tmpvar_9;
tmpvar_9 = tmpvar_8;
xlt_IN.TtoV2 = tmpvar_9;
vec4 tmpvar_10;
tmpvar_10 = frag_surf (xlt_IN);
vec4 tmpvar_11;
tmpvar_11 = tmpvar_10;
xl_retval = tmpvar_11;
vec4 tmpvar_12;
tmpvar_12 = xl_retval.xyzw;
vec4 tmpvar_13;
tmpvar_13 = tmpvar_12;
gl_FragData[0] = tmpvar_13;
}