mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
184 lines
3.8 KiB
Text
184 lines
3.8 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 vlight;
|
||
|
vec4 _ShadowCoord;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform vec4 _WorldSpaceLightPos0;
|
||
|
uniform sampler2D _ShadowMapTexture;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform vec4 _LightColor0;
|
||
|
uniform float _Cutoff;
|
||
|
uniform vec4 _Color;
|
||
|
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 * _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;
|
||
|
vec3 tmpvar_29;
|
||
|
tmpvar_29 = vec3(0.0, 0.0, 0.0);
|
||
|
o_26.Albedo = tmpvar_29;
|
||
|
vec3 tmpvar_30;
|
||
|
tmpvar_30 = vec3(0.0, 0.0, 0.0);
|
||
|
o_26.Emission = tmpvar_30;
|
||
|
float tmpvar_31;
|
||
|
tmpvar_31 = 0.0;
|
||
|
o_26.Specular = tmpvar_31;
|
||
|
float tmpvar_32;
|
||
|
tmpvar_32 = 0.0;
|
||
|
o_26.Alpha = tmpvar_32;
|
||
|
float tmpvar_33;
|
||
|
tmpvar_33 = 0.0;
|
||
|
o_26.Gloss = tmpvar_33;
|
||
|
vec3 tmpvar_34;
|
||
|
tmpvar_34 = IN_23.normal;
|
||
|
o_26.Normal = tmpvar_34;
|
||
|
surf (surfIN_27, o_26);
|
||
|
xll_clip ((o_26.Alpha - _Cutoff));
|
||
|
float tmpvar_35;
|
||
|
tmpvar_35 = unitySampleShadow (IN_23._ShadowCoord);
|
||
|
float tmpvar_36;
|
||
|
tmpvar_36 = tmpvar_35;
|
||
|
atten_25 = tmpvar_36;
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = LightingLambert (o_26, _WorldSpaceLightPos0.xyz, atten_25);
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
c_24 = tmpvar_38;
|
||
|
vec3 tmpvar_39;
|
||
|
tmpvar_39 = (c_24.xyz + (o_26.Albedo * IN_23.vlight));
|
||
|
c_24.xyz = tmpvar_39.xyz.xyz;
|
||
|
float tmpvar_40;
|
||
|
tmpvar_40 = o_26.Alpha;
|
||
|
c_24.w = vec4(tmpvar_40).w;
|
||
|
return c_24;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_41;
|
||
|
vec4 xl_retval_42;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_41.pos = tmpvar_43;
|
||
|
float tmpvar_44;
|
||
|
tmpvar_44 = xlv_FOG.x;
|
||
|
xlt_IN_41.fog = tmpvar_44;
|
||
|
vec2 tmpvar_45;
|
||
|
tmpvar_45 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_46;
|
||
|
tmpvar_46 = tmpvar_45;
|
||
|
xlt_IN_41.hip_pack0 = tmpvar_46;
|
||
|
vec3 tmpvar_47;
|
||
|
tmpvar_47 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_48;
|
||
|
tmpvar_48 = tmpvar_47;
|
||
|
xlt_IN_41.normal = tmpvar_48;
|
||
|
vec3 tmpvar_49;
|
||
|
tmpvar_49 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_50;
|
||
|
tmpvar_50 = tmpvar_49;
|
||
|
xlt_IN_41.vlight = tmpvar_50;
|
||
|
vec4 tmpvar_51;
|
||
|
tmpvar_51 = gl_TexCoord[3].xyzw;
|
||
|
vec4 tmpvar_52;
|
||
|
tmpvar_52 = tmpvar_51;
|
||
|
xlt_IN_41._ShadowCoord = tmpvar_52;
|
||
|
vec4 tmpvar_53;
|
||
|
tmpvar_53 = frag_surf (xlt_IN_41);
|
||
|
vec4 tmpvar_54;
|
||
|
tmpvar_54 = tmpvar_53;
|
||
|
xl_retval_42 = tmpvar_54;
|
||
|
vec4 tmpvar_55;
|
||
|
tmpvar_55 = xl_retval_42.xyzw;
|
||
|
vec4 tmpvar_56;
|
||
|
tmpvar_56 = tmpvar_55;
|
||
|
gl_FragData[0] = tmpvar_56;
|
||
|
}
|
||
|
|