mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
193 lines
4 KiB
Text
193 lines
4 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;
|
||
|
vec4 _ShadowCoord;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform vec4 _WorldSpaceLightPos0;
|
||
|
uniform sampler2D _ShadowMapTexture;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform vec4 _LightColor0;
|
||
|
uniform float _Cutoff;
|
||
|
void xll_clip (
|
||
|
in float x_1
|
||
|
)
|
||
|
{
|
||
|
if ((x_1 < 0.0)) {
|
||
|
discard;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
float unitySampleShadow (
|
||
|
in vec4 shadowCoord_2
|
||
|
)
|
||
|
{
|
||
|
float shadow_3;
|
||
|
vec4 tmpvar_4;
|
||
|
tmpvar_4 = texture2DProj (_ShadowMapTexture, shadowCoord_2);
|
||
|
float tmpvar_5;
|
||
|
tmpvar_5 = tmpvar_4.x;
|
||
|
shadow_3 = tmpvar_5;
|
||
|
return shadow_3;
|
||
|
}
|
||
|
|
||
|
void surf (
|
||
|
in Input IN_6,
|
||
|
inout SurfaceOutput o_7
|
||
|
)
|
||
|
{
|
||
|
vec4 c_8;
|
||
|
vec4 tmpvar_9;
|
||
|
tmpvar_9 = texture2D (_MainTex, IN_6.uv_MainTex);
|
||
|
vec4 tmpvar_10;
|
||
|
tmpvar_10 = (tmpvar_9 * IN_6.color);
|
||
|
c_8 = tmpvar_10;
|
||
|
vec3 tmpvar_11;
|
||
|
tmpvar_11 = c_8.xyz;
|
||
|
o_7.Albedo = tmpvar_11;
|
||
|
float tmpvar_12;
|
||
|
tmpvar_12 = c_8.w;
|
||
|
o_7.Alpha = tmpvar_12;
|
||
|
}
|
||
|
|
||
|
vec4 LightingLambert (
|
||
|
in SurfaceOutput s_13,
|
||
|
in vec3 lightDir_14,
|
||
|
in float atten_15
|
||
|
)
|
||
|
{
|
||
|
vec4 c_16;
|
||
|
float diff_17;
|
||
|
float tmpvar_18;
|
||
|
tmpvar_18 = dot (s_13.Normal, lightDir_14);
|
||
|
float tmpvar_19;
|
||
|
tmpvar_19 = max (0.0, tmpvar_18);
|
||
|
float tmpvar_20;
|
||
|
tmpvar_20 = tmpvar_19;
|
||
|
diff_17 = tmpvar_20;
|
||
|
vec3 tmpvar_21;
|
||
|
tmpvar_21 = ((s_13.Albedo * _LightColor0.xyz) * ((diff_17 * atten_15) * 2.0));
|
||
|
c_16.xyz = tmpvar_21.xyz.xyz;
|
||
|
float tmpvar_22;
|
||
|
tmpvar_22 = s_13.Alpha;
|
||
|
c_16.w = vec4(tmpvar_22).w;
|
||
|
return c_16;
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_23
|
||
|
)
|
||
|
{
|
||
|
vec4 c_24;
|
||
|
float atten_25;
|
||
|
SurfaceOutput o_26;
|
||
|
Input surfIN_27;
|
||
|
vec2 tmpvar_28;
|
||
|
tmpvar_28 = IN_23.hip_pack0.xy;
|
||
|
surfIN_27.uv_MainTex = tmpvar_28;
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29 = IN_23.lop_color;
|
||
|
surfIN_27.color = tmpvar_29;
|
||
|
vec3 tmpvar_30;
|
||
|
tmpvar_30 = vec3(0.0, 0.0, 0.0);
|
||
|
o_26.Albedo = tmpvar_30;
|
||
|
vec3 tmpvar_31;
|
||
|
tmpvar_31 = vec3(0.0, 0.0, 0.0);
|
||
|
o_26.Emission = tmpvar_31;
|
||
|
float tmpvar_32;
|
||
|
tmpvar_32 = 0.0;
|
||
|
o_26.Specular = tmpvar_32;
|
||
|
float tmpvar_33;
|
||
|
tmpvar_33 = 0.0;
|
||
|
o_26.Alpha = tmpvar_33;
|
||
|
float tmpvar_34;
|
||
|
tmpvar_34 = 0.0;
|
||
|
o_26.Gloss = tmpvar_34;
|
||
|
vec3 tmpvar_35;
|
||
|
tmpvar_35 = IN_23.normal;
|
||
|
o_26.Normal = tmpvar_35;
|
||
|
surf (surfIN_27, o_26);
|
||
|
xll_clip ((o_26.Alpha - _Cutoff));
|
||
|
float tmpvar_36;
|
||
|
tmpvar_36 = unitySampleShadow (IN_23._ShadowCoord);
|
||
|
float tmpvar_37;
|
||
|
tmpvar_37 = tmpvar_36;
|
||
|
atten_25 = tmpvar_37;
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = LightingLambert (o_26, _WorldSpaceLightPos0.xyz, atten_25);
|
||
|
vec4 tmpvar_39;
|
||
|
tmpvar_39 = tmpvar_38;
|
||
|
c_24 = tmpvar_39;
|
||
|
vec3 tmpvar_40;
|
||
|
tmpvar_40 = (c_24.xyz + (o_26.Albedo * IN_23.vlight));
|
||
|
c_24.xyz = tmpvar_40.xyz.xyz;
|
||
|
float tmpvar_41;
|
||
|
tmpvar_41 = o_26.Alpha;
|
||
|
c_24.w = vec4(tmpvar_41).w;
|
||
|
return c_24;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_42;
|
||
|
vec4 xl_retval_43;
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_42.pos = tmpvar_44;
|
||
|
float tmpvar_45;
|
||
|
tmpvar_45 = xlv_FOG.x;
|
||
|
xlt_IN_42.fog = tmpvar_45;
|
||
|
vec2 tmpvar_46;
|
||
|
tmpvar_46 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_47;
|
||
|
tmpvar_47 = tmpvar_46;
|
||
|
xlt_IN_42.hip_pack0 = tmpvar_47;
|
||
|
vec4 tmpvar_48;
|
||
|
tmpvar_48 = gl_Color.xyzw;
|
||
|
vec4 tmpvar_49;
|
||
|
tmpvar_49 = tmpvar_48;
|
||
|
xlt_IN_42.lop_color = tmpvar_49;
|
||
|
vec3 tmpvar_50;
|
||
|
tmpvar_50 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_51;
|
||
|
tmpvar_51 = tmpvar_50;
|
||
|
xlt_IN_42.normal = tmpvar_51;
|
||
|
vec3 tmpvar_52;
|
||
|
tmpvar_52 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_53;
|
||
|
tmpvar_53 = tmpvar_52;
|
||
|
xlt_IN_42.vlight = tmpvar_53;
|
||
|
vec4 tmpvar_54;
|
||
|
tmpvar_54 = gl_TexCoord[3].xyzw;
|
||
|
vec4 tmpvar_55;
|
||
|
tmpvar_55 = tmpvar_54;
|
||
|
xlt_IN_42._ShadowCoord = tmpvar_55;
|
||
|
vec4 tmpvar_56;
|
||
|
tmpvar_56 = frag_surf (xlt_IN_42);
|
||
|
vec4 tmpvar_57;
|
||
|
tmpvar_57 = tmpvar_56;
|
||
|
xl_retval_43 = tmpvar_57;
|
||
|
vec4 tmpvar_58;
|
||
|
tmpvar_58 = xl_retval_43.xyzw;
|
||
|
vec4 tmpvar_59;
|
||
|
tmpvar_59 = tmpvar_58;
|
||
|
gl_FragData[0] = tmpvar_59;
|
||
|
}
|
||
|
|