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

163 lines
3.4 KiB
Text

struct SurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
};
struct v2f_surf {
vec4 pos;
float fog;
vec2 hip_pack0;
vec3 normal;
vec3 lightDir;
vec2 _LightCoord;
};
varying vec4 xlv_FOG;
uniform sampler2D _Ramp;
uniform sampler2D _MainTex;
uniform sampler2D _LightTexture0;
uniform vec4 _LightColor0;
uniform vec4 _Color;
void surf (
in Input IN_1,
inout SurfaceOutput o_2
)
{
vec4 c_3;
vec4 tmpvar_4;
tmpvar_4 = texture2D (_MainTex, IN_1.uv_MainTex);
vec4 tmpvar_5;
tmpvar_5 = (tmpvar_4 * _Color);
c_3 = tmpvar_5;
vec3 tmpvar_6;
tmpvar_6 = c_3.xyz;
o_2.Albedo = tmpvar_6;
float tmpvar_7;
tmpvar_7 = c_3.w;
o_2.Alpha = tmpvar_7;
}
vec4 LightingToonRamp (
in SurfaceOutput s_8,
in vec3 lightDir_9,
in float atten_10
)
{
vec4 c_11;
vec3 ramp_12;
float d_13;
float tmpvar_14;
tmpvar_14 = dot (s_8.Normal, lightDir_9);
float tmpvar_15;
tmpvar_15 = ((tmpvar_14 * 0.5) + 0.5);
d_13 = tmpvar_15;
vec2 tmpvar_16;
tmpvar_16.x = d_13;
tmpvar_16.y = d_13;
vec4 tmpvar_17;
tmpvar_17 = texture2D (_Ramp, tmpvar_16);
vec3 tmpvar_18;
tmpvar_18 = tmpvar_17.xyz;
ramp_12 = tmpvar_18;
vec3 tmpvar_19;
tmpvar_19 = (((s_8.Albedo * _LightColor0.xyz) * ramp_12) * (atten_10 * 2.0));
c_11.xyz = tmpvar_19.xyz.xyz;
float tmpvar_20;
tmpvar_20 = 0.0;
c_11.w = vec4(tmpvar_20).w;
return c_11;
}
vec4 frag_surf (
in v2f_surf IN_21
)
{
vec4 c_22;
vec3 lightDir_23;
SurfaceOutput o_24;
Input surfIN_25;
vec2 tmpvar_26;
tmpvar_26 = IN_21.hip_pack0.xy;
surfIN_25.uv_MainTex = tmpvar_26;
vec3 tmpvar_27;
tmpvar_27 = vec3(0.0, 0.0, 0.0);
o_24.Albedo = tmpvar_27;
vec3 tmpvar_28;
tmpvar_28 = vec3(0.0, 0.0, 0.0);
o_24.Emission = tmpvar_28;
float tmpvar_29;
tmpvar_29 = 0.0;
o_24.Specular = tmpvar_29;
float tmpvar_30;
tmpvar_30 = 0.0;
o_24.Alpha = tmpvar_30;
float tmpvar_31;
tmpvar_31 = 0.0;
o_24.Gloss = tmpvar_31;
vec3 tmpvar_32;
tmpvar_32 = IN_21.normal;
o_24.Normal = tmpvar_32;
surf (surfIN_25, o_24);
vec3 tmpvar_33;
tmpvar_33 = IN_21.lightDir;
lightDir_23 = tmpvar_33;
vec4 tmpvar_34;
tmpvar_34 = texture2D (_LightTexture0, IN_21._LightCoord);
vec4 tmpvar_35;
tmpvar_35 = LightingToonRamp (o_24, lightDir_23, (tmpvar_34.w * 1.0));
vec4 tmpvar_36;
tmpvar_36 = tmpvar_35;
c_22 = tmpvar_36;
float tmpvar_37;
tmpvar_37 = 0.0;
c_22.w = vec4(tmpvar_37).w;
return c_22;
}
void main ()
{
v2f_surf xlt_IN_38;
vec4 xl_retval_39;
vec4 tmpvar_40;
tmpvar_40 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_38.pos = tmpvar_40;
float tmpvar_41;
tmpvar_41 = xlv_FOG.x;
xlt_IN_38.fog = tmpvar_41;
vec2 tmpvar_42;
tmpvar_42 = gl_TexCoord[0].xy;
vec2 tmpvar_43;
tmpvar_43 = tmpvar_42;
xlt_IN_38.hip_pack0 = tmpvar_43;
vec3 tmpvar_44;
tmpvar_44 = gl_TexCoord[1].xyz;
vec3 tmpvar_45;
tmpvar_45 = tmpvar_44;
xlt_IN_38.normal = tmpvar_45;
vec3 tmpvar_46;
tmpvar_46 = gl_TexCoord[2].xyz;
vec3 tmpvar_47;
tmpvar_47 = tmpvar_46;
xlt_IN_38.lightDir = tmpvar_47;
vec2 tmpvar_48;
tmpvar_48 = gl_TexCoord[3].xy;
vec2 tmpvar_49;
tmpvar_49 = tmpvar_48;
xlt_IN_38._LightCoord = tmpvar_49;
vec4 tmpvar_50;
tmpvar_50 = frag_surf (xlt_IN_38);
vec4 tmpvar_51;
tmpvar_51 = tmpvar_50;
xl_retval_39 = tmpvar_51;
vec4 tmpvar_52;
tmpvar_52 = xl_retval_39.xyzw;
vec4 tmpvar_53;
tmpvar_53 = tmpvar_52;
gl_FragData[0] = tmpvar_53;
}