mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
221 lines
5 KiB
Text
221 lines
5 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec2 uv_Control;
|
|
vec2 uv_Splat0;
|
|
vec2 uv_Splat1;
|
|
vec2 uv_Splat2;
|
|
vec2 uv_Splat3;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec4 hip_pack0;
|
|
vec4 hip_pack1;
|
|
vec2 hip_pack2;
|
|
vec3 normal;
|
|
vec3 vlight;
|
|
vec4 _ShadowCoord;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
uniform vec4 _WorldSpaceLightPos0;
|
|
uniform sampler2D _Splat3;
|
|
uniform sampler2D _Splat2;
|
|
uniform sampler2D _Splat1;
|
|
uniform sampler2D _Splat0;
|
|
uniform sampler2D _ShadowMapTexture;
|
|
uniform vec4 _LightColor0;
|
|
uniform sampler2D _Control;
|
|
float unitySampleShadow (
|
|
in vec4 shadowCoord_1
|
|
)
|
|
{
|
|
float shadow_2;
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = texture2DProj (_ShadowMapTexture, shadowCoord_1);
|
|
float tmpvar_4;
|
|
tmpvar_4 = tmpvar_3.x;
|
|
shadow_2 = tmpvar_4;
|
|
return shadow_2;
|
|
}
|
|
|
|
void surf (
|
|
in Input IN_5,
|
|
inout SurfaceOutput o_6
|
|
)
|
|
{
|
|
vec3 col_7;
|
|
vec4 splat_control_8;
|
|
vec4 tmpvar_9;
|
|
tmpvar_9 = texture2D (_Control, IN_5.uv_Control);
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = tmpvar_9;
|
|
splat_control_8 = tmpvar_10;
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = texture2D (_Splat0, IN_5.uv_Splat0);
|
|
vec3 tmpvar_12;
|
|
tmpvar_12 = (splat_control_8.x * tmpvar_11.xyz);
|
|
col_7 = tmpvar_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = texture2D (_Splat1, IN_5.uv_Splat1);
|
|
vec3 tmpvar_14;
|
|
tmpvar_14 = (col_7 + (splat_control_8.y * tmpvar_13.xyz));
|
|
col_7 = tmpvar_14;
|
|
vec4 tmpvar_15;
|
|
tmpvar_15 = texture2D (_Splat2, IN_5.uv_Splat2);
|
|
vec3 tmpvar_16;
|
|
tmpvar_16 = (col_7 + (splat_control_8.z * tmpvar_15.xyz));
|
|
col_7 = tmpvar_16;
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = texture2D (_Splat3, IN_5.uv_Splat3);
|
|
vec3 tmpvar_18;
|
|
tmpvar_18 = (col_7 + (splat_control_8.w * tmpvar_17.xyz));
|
|
col_7 = tmpvar_18;
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = col_7;
|
|
o_6.Albedo = tmpvar_19;
|
|
float tmpvar_20;
|
|
tmpvar_20 = 0.0;
|
|
o_6.Alpha = tmpvar_20;
|
|
}
|
|
|
|
vec4 LightingLambert (
|
|
in SurfaceOutput s_21,
|
|
in vec3 lightDir_22,
|
|
in float atten_23
|
|
)
|
|
{
|
|
vec4 c_24;
|
|
float diff_25;
|
|
float tmpvar_26;
|
|
tmpvar_26 = dot (s_21.Normal, lightDir_22);
|
|
float tmpvar_27;
|
|
tmpvar_27 = max (0.0, tmpvar_26);
|
|
float tmpvar_28;
|
|
tmpvar_28 = tmpvar_27;
|
|
diff_25 = tmpvar_28;
|
|
vec3 tmpvar_29;
|
|
tmpvar_29 = ((s_21.Albedo * _LightColor0.xyz) * ((diff_25 * atten_23) * 2.0));
|
|
c_24.xyz = tmpvar_29.xyz.xyz;
|
|
float tmpvar_30;
|
|
tmpvar_30 = s_21.Alpha;
|
|
c_24.w = vec4(tmpvar_30).w;
|
|
return c_24;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_31
|
|
)
|
|
{
|
|
vec4 c_32;
|
|
float atten_33;
|
|
SurfaceOutput o_34;
|
|
Input surfIN_35;
|
|
vec2 tmpvar_36;
|
|
tmpvar_36 = IN_31.hip_pack0.xy;
|
|
surfIN_35.uv_Control = tmpvar_36;
|
|
vec2 tmpvar_37;
|
|
tmpvar_37 = IN_31.hip_pack0.zw;
|
|
surfIN_35.uv_Splat0 = tmpvar_37;
|
|
vec2 tmpvar_38;
|
|
tmpvar_38 = IN_31.hip_pack1.xy;
|
|
surfIN_35.uv_Splat1 = tmpvar_38;
|
|
vec2 tmpvar_39;
|
|
tmpvar_39 = IN_31.hip_pack1.zw;
|
|
surfIN_35.uv_Splat2 = tmpvar_39;
|
|
vec2 tmpvar_40;
|
|
tmpvar_40 = IN_31.hip_pack2.xy;
|
|
surfIN_35.uv_Splat3 = tmpvar_40;
|
|
vec3 tmpvar_41;
|
|
tmpvar_41 = vec3(0.0, 0.0, 0.0);
|
|
o_34.Albedo = tmpvar_41;
|
|
vec3 tmpvar_42;
|
|
tmpvar_42 = vec3(0.0, 0.0, 0.0);
|
|
o_34.Emission = tmpvar_42;
|
|
float tmpvar_43;
|
|
tmpvar_43 = 0.0;
|
|
o_34.Specular = tmpvar_43;
|
|
float tmpvar_44;
|
|
tmpvar_44 = 0.0;
|
|
o_34.Alpha = tmpvar_44;
|
|
float tmpvar_45;
|
|
tmpvar_45 = 0.0;
|
|
o_34.Gloss = tmpvar_45;
|
|
vec3 tmpvar_46;
|
|
tmpvar_46 = IN_31.normal;
|
|
o_34.Normal = tmpvar_46;
|
|
surf (surfIN_35, o_34);
|
|
float tmpvar_47;
|
|
tmpvar_47 = unitySampleShadow (IN_31._ShadowCoord);
|
|
float tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
atten_33 = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = LightingLambert (o_34, _WorldSpaceLightPos0.xyz, atten_33);
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
c_32 = tmpvar_50;
|
|
vec3 tmpvar_51;
|
|
tmpvar_51 = (c_32.xyz + (o_34.Albedo * IN_31.vlight));
|
|
c_32.xyz = tmpvar_51.xyz.xyz;
|
|
return c_32;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_52;
|
|
vec4 xl_retval_53;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_52.pos = tmpvar_54;
|
|
float tmpvar_55;
|
|
tmpvar_55 = xlv_FOG.x;
|
|
xlt_IN_52.fog = tmpvar_55;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = gl_TexCoord[0].xyzw;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57 = tmpvar_56;
|
|
xlt_IN_52.hip_pack0 = tmpvar_57;
|
|
vec4 tmpvar_58;
|
|
tmpvar_58 = gl_TexCoord[1].xyzw;
|
|
vec4 tmpvar_59;
|
|
tmpvar_59 = tmpvar_58;
|
|
xlt_IN_52.hip_pack1 = tmpvar_59;
|
|
vec2 tmpvar_60;
|
|
tmpvar_60 = gl_TexCoord[2].xy;
|
|
vec2 tmpvar_61;
|
|
tmpvar_61 = tmpvar_60;
|
|
xlt_IN_52.hip_pack2 = tmpvar_61;
|
|
vec3 tmpvar_62;
|
|
tmpvar_62 = gl_TexCoord[3].xyz;
|
|
vec3 tmpvar_63;
|
|
tmpvar_63 = tmpvar_62;
|
|
xlt_IN_52.normal = tmpvar_63;
|
|
vec3 tmpvar_64;
|
|
tmpvar_64 = gl_TexCoord[4].xyz;
|
|
vec3 tmpvar_65;
|
|
tmpvar_65 = tmpvar_64;
|
|
xlt_IN_52.vlight = tmpvar_65;
|
|
vec4 tmpvar_66;
|
|
tmpvar_66 = gl_TexCoord[5].xyzw;
|
|
vec4 tmpvar_67;
|
|
tmpvar_67 = tmpvar_66;
|
|
xlt_IN_52._ShadowCoord = tmpvar_67;
|
|
vec4 tmpvar_68;
|
|
tmpvar_68 = frag_surf (xlt_IN_52);
|
|
vec4 tmpvar_69;
|
|
tmpvar_69 = tmpvar_68;
|
|
xl_retval_53 = tmpvar_69;
|
|
vec4 tmpvar_70;
|
|
tmpvar_70 = xl_retval_53.xyzw;
|
|
vec4 tmpvar_71;
|
|
tmpvar_71 = tmpvar_70;
|
|
gl_FragData[0] = tmpvar_71;
|
|
}
|
|
|