mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 11:05:36 -05:00
170 lines
3.5 KiB
Text
170 lines
3.5 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec2 uv_MainTex;
|
|
vec4 color;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 hip_pack0;
|
|
vec4 lop_color;
|
|
vec3 normal;
|
|
vec3 vlight;
|
|
};
|
|
uniform float _Cutoff;
|
|
uniform vec4 _LightColor0;
|
|
uniform sampler2D _MainTex;
|
|
uniform vec4 _WorldSpaceLightPos0;
|
|
varying vec4 xlv_FOG;
|
|
void xll_clip (
|
|
in float x_1
|
|
)
|
|
{
|
|
if ((x_1 < 0.0)) {
|
|
discard;
|
|
};
|
|
}
|
|
|
|
void surf (
|
|
in Input IN_2,
|
|
inout SurfaceOutput o_3
|
|
)
|
|
{
|
|
vec4 c_4;
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = texture2D (_MainTex, IN_2.uv_MainTex);
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = (tmpvar_5 * IN_2.color);
|
|
c_4 = tmpvar_6;
|
|
vec3 tmpvar_7;
|
|
tmpvar_7 = c_4.xyz;
|
|
o_3.Albedo = tmpvar_7;
|
|
float tmpvar_8;
|
|
tmpvar_8 = c_4.w;
|
|
o_3.Alpha = tmpvar_8;
|
|
}
|
|
|
|
vec4 LightingLambert (
|
|
in SurfaceOutput s_9,
|
|
in vec3 lightDir_10,
|
|
in float atten_11
|
|
)
|
|
{
|
|
vec4 c_12;
|
|
float diff_13;
|
|
float tmpvar_14;
|
|
tmpvar_14 = dot (s_9.Normal, lightDir_10);
|
|
float tmpvar_15;
|
|
tmpvar_15 = max (0.0, tmpvar_14);
|
|
float tmpvar_16;
|
|
tmpvar_16 = tmpvar_15;
|
|
diff_13 = tmpvar_16;
|
|
vec3 tmpvar_17;
|
|
tmpvar_17 = ((s_9.Albedo * _LightColor0.xyz) * ((diff_13 * atten_11) * 2.0));
|
|
c_12.xyz = tmpvar_17.xyz.xyz;
|
|
float tmpvar_18;
|
|
tmpvar_18 = s_9.Alpha;
|
|
c_12.w = vec4(tmpvar_18).w;
|
|
return c_12;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_19
|
|
)
|
|
{
|
|
vec4 c_20;
|
|
float atten_21;
|
|
SurfaceOutput o_22;
|
|
Input surfIN_23;
|
|
float tmpvar_24;
|
|
tmpvar_24 = 1.0;
|
|
atten_21 = tmpvar_24;
|
|
vec2 tmpvar_25;
|
|
tmpvar_25 = IN_19.hip_pack0.xy;
|
|
surfIN_23.uv_MainTex = tmpvar_25;
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = IN_19.lop_color;
|
|
surfIN_23.color = tmpvar_26;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = vec3(0.0, 0.0, 0.0);
|
|
o_22.Albedo = tmpvar_27;
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = vec3(0.0, 0.0, 0.0);
|
|
o_22.Emission = tmpvar_28;
|
|
float tmpvar_29;
|
|
tmpvar_29 = 0.0;
|
|
o_22.Specular = tmpvar_29;
|
|
float tmpvar_30;
|
|
tmpvar_30 = 0.0;
|
|
o_22.Alpha = tmpvar_30;
|
|
float tmpvar_31;
|
|
tmpvar_31 = 0.0;
|
|
o_22.Gloss = tmpvar_31;
|
|
vec3 tmpvar_32;
|
|
tmpvar_32 = IN_19.normal;
|
|
o_22.Normal = tmpvar_32;
|
|
surf (surfIN_23, o_22);
|
|
xll_clip ((o_22.Alpha - _Cutoff));
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = LightingLambert (o_22, _WorldSpaceLightPos0.xyz, atten_21);
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = tmpvar_33;
|
|
c_20 = tmpvar_34;
|
|
vec3 tmpvar_35;
|
|
tmpvar_35 = (c_20.xyz + (o_22.Albedo * IN_19.vlight));
|
|
c_20.xyz = tmpvar_35.xyz.xyz;
|
|
float tmpvar_36;
|
|
tmpvar_36 = o_22.Alpha;
|
|
c_20.w = vec4(tmpvar_36).w;
|
|
return c_20;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_37;
|
|
vec4 xl_retval_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_37.pos = tmpvar_39;
|
|
float tmpvar_40;
|
|
tmpvar_40 = xlv_FOG.x;
|
|
xlt_IN_37.fog = tmpvar_40;
|
|
vec2 tmpvar_41;
|
|
tmpvar_41 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_42;
|
|
tmpvar_42 = tmpvar_41;
|
|
xlt_IN_37.hip_pack0 = tmpvar_42;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = gl_Color.xyzw;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xlt_IN_37.lop_color = tmpvar_44;
|
|
vec3 tmpvar_45;
|
|
tmpvar_45 = gl_TexCoord[1].xyz;
|
|
vec3 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
xlt_IN_37.normal = tmpvar_46;
|
|
vec3 tmpvar_47;
|
|
tmpvar_47 = gl_TexCoord[2].xyz;
|
|
vec3 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
xlt_IN_37.vlight = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = frag_surf (xlt_IN_37);
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
xl_retval_38 = tmpvar_50;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = xl_retval_38.xyzw;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
gl_FragData[0] = tmpvar_52;
|
|
}
|
|
|