mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
189 lines
4.2 KiB
Text
189 lines
4.2 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;
|
||
|
vec4 hip_screen;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform vec4 unity_Ambient;
|
||
|
uniform sampler2D _Splat3;
|
||
|
uniform sampler2D _Splat2;
|
||
|
uniform sampler2D _Splat1;
|
||
|
uniform sampler2D _Splat0;
|
||
|
uniform sampler2D _LightBuffer;
|
||
|
uniform sampler2D _Control;
|
||
|
void surf (
|
||
|
in Input IN_1,
|
||
|
inout SurfaceOutput o_2
|
||
|
)
|
||
|
{
|
||
|
vec3 col_3;
|
||
|
vec4 splat_control_4;
|
||
|
vec4 tmpvar_5;
|
||
|
tmpvar_5 = texture2D (_Control, IN_1.uv_Control);
|
||
|
vec4 tmpvar_6;
|
||
|
tmpvar_6 = tmpvar_5;
|
||
|
splat_control_4 = tmpvar_6;
|
||
|
vec4 tmpvar_7;
|
||
|
tmpvar_7 = texture2D (_Splat0, IN_1.uv_Splat0);
|
||
|
vec3 tmpvar_8;
|
||
|
tmpvar_8 = (splat_control_4.x * tmpvar_7.xyz);
|
||
|
col_3 = tmpvar_8;
|
||
|
vec4 tmpvar_9;
|
||
|
tmpvar_9 = texture2D (_Splat1, IN_1.uv_Splat1);
|
||
|
vec3 tmpvar_10;
|
||
|
tmpvar_10 = (col_3 + (splat_control_4.y * tmpvar_9.xyz));
|
||
|
col_3 = tmpvar_10;
|
||
|
vec4 tmpvar_11;
|
||
|
tmpvar_11 = texture2D (_Splat2, IN_1.uv_Splat2);
|
||
|
vec3 tmpvar_12;
|
||
|
tmpvar_12 = (col_3 + (splat_control_4.z * tmpvar_11.xyz));
|
||
|
col_3 = tmpvar_12;
|
||
|
vec4 tmpvar_13;
|
||
|
tmpvar_13 = texture2D (_Splat3, IN_1.uv_Splat3);
|
||
|
vec3 tmpvar_14;
|
||
|
tmpvar_14 = (col_3 + (splat_control_4.w * tmpvar_13.xyz));
|
||
|
col_3 = tmpvar_14;
|
||
|
vec3 tmpvar_15;
|
||
|
tmpvar_15 = col_3;
|
||
|
o_2.Albedo = tmpvar_15;
|
||
|
float tmpvar_16;
|
||
|
tmpvar_16 = 0.0;
|
||
|
o_2.Alpha = tmpvar_16;
|
||
|
}
|
||
|
|
||
|
vec4 LightingLambert_PrePass (
|
||
|
in SurfaceOutput s_17,
|
||
|
in vec4 light_18
|
||
|
)
|
||
|
{
|
||
|
vec4 c_19;
|
||
|
vec3 tmpvar_20;
|
||
|
tmpvar_20 = (s_17.Albedo * light_18.xyz);
|
||
|
c_19.xyz = tmpvar_20.xyz.xyz;
|
||
|
float tmpvar_21;
|
||
|
tmpvar_21 = s_17.Alpha;
|
||
|
c_19.w = vec4(tmpvar_21).w;
|
||
|
return c_19;
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_22
|
||
|
)
|
||
|
{
|
||
|
vec4 col_23;
|
||
|
vec4 light_24;
|
||
|
SurfaceOutput o_25;
|
||
|
Input surfIN_26;
|
||
|
vec2 tmpvar_27;
|
||
|
tmpvar_27 = IN_22.hip_pack0.xy;
|
||
|
surfIN_26.uv_Control = tmpvar_27;
|
||
|
vec2 tmpvar_28;
|
||
|
tmpvar_28 = IN_22.hip_pack0.zw;
|
||
|
surfIN_26.uv_Splat0 = tmpvar_28;
|
||
|
vec2 tmpvar_29;
|
||
|
tmpvar_29 = IN_22.hip_pack1.xy;
|
||
|
surfIN_26.uv_Splat1 = tmpvar_29;
|
||
|
vec2 tmpvar_30;
|
||
|
tmpvar_30 = IN_22.hip_pack1.zw;
|
||
|
surfIN_26.uv_Splat2 = tmpvar_30;
|
||
|
vec2 tmpvar_31;
|
||
|
tmpvar_31 = IN_22.hip_pack2.xy;
|
||
|
surfIN_26.uv_Splat3 = tmpvar_31;
|
||
|
vec3 tmpvar_32;
|
||
|
tmpvar_32 = vec3(0.0, 0.0, 0.0);
|
||
|
o_25.Albedo = tmpvar_32;
|
||
|
vec3 tmpvar_33;
|
||
|
tmpvar_33 = vec3(0.0, 0.0, 0.0);
|
||
|
o_25.Emission = tmpvar_33;
|
||
|
float tmpvar_34;
|
||
|
tmpvar_34 = 0.0;
|
||
|
o_25.Specular = tmpvar_34;
|
||
|
float tmpvar_35;
|
||
|
tmpvar_35 = 0.0;
|
||
|
o_25.Alpha = tmpvar_35;
|
||
|
float tmpvar_36;
|
||
|
tmpvar_36 = 0.0;
|
||
|
o_25.Gloss = tmpvar_36;
|
||
|
surf (surfIN_26, o_25);
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = texture2DProj (_LightBuffer, IN_22.hip_screen);
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
light_24 = tmpvar_38;
|
||
|
vec4 tmpvar_39;
|
||
|
tmpvar_39 = log2 (light_24);
|
||
|
vec4 tmpvar_40;
|
||
|
tmpvar_40 = -(tmpvar_39);
|
||
|
light_24 = tmpvar_40;
|
||
|
vec3 tmpvar_41;
|
||
|
tmpvar_41 = (light_24.xyz + unity_Ambient.xyz);
|
||
|
light_24.xyz = tmpvar_41.xyz.xyz;
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = LightingLambert_PrePass (o_25, light_24);
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = tmpvar_42;
|
||
|
col_23 = tmpvar_43;
|
||
|
return col_23;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_44;
|
||
|
vec4 xl_retval_45;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_44.pos = tmpvar_46;
|
||
|
float tmpvar_47;
|
||
|
tmpvar_47 = xlv_FOG.x;
|
||
|
xlt_IN_44.fog = tmpvar_47;
|
||
|
vec4 tmpvar_48;
|
||
|
tmpvar_48 = gl_TexCoord[0].xyzw;
|
||
|
vec4 tmpvar_49;
|
||
|
tmpvar_49 = tmpvar_48;
|
||
|
xlt_IN_44.hip_pack0 = tmpvar_49;
|
||
|
vec4 tmpvar_50;
|
||
|
tmpvar_50 = gl_TexCoord[1].xyzw;
|
||
|
vec4 tmpvar_51;
|
||
|
tmpvar_51 = tmpvar_50;
|
||
|
xlt_IN_44.hip_pack1 = tmpvar_51;
|
||
|
vec2 tmpvar_52;
|
||
|
tmpvar_52 = gl_TexCoord[2].xy;
|
||
|
vec2 tmpvar_53;
|
||
|
tmpvar_53 = tmpvar_52;
|
||
|
xlt_IN_44.hip_pack2 = tmpvar_53;
|
||
|
vec4 tmpvar_54;
|
||
|
tmpvar_54 = gl_TexCoord[3].xyzw;
|
||
|
vec4 tmpvar_55;
|
||
|
tmpvar_55 = tmpvar_54;
|
||
|
xlt_IN_44.hip_screen = tmpvar_55;
|
||
|
vec4 tmpvar_56;
|
||
|
tmpvar_56 = frag_surf (xlt_IN_44);
|
||
|
vec4 tmpvar_57;
|
||
|
tmpvar_57 = tmpvar_56;
|
||
|
xl_retval_45 = tmpvar_57;
|
||
|
vec4 tmpvar_58;
|
||
|
tmpvar_58 = xl_retval_45.xyzw;
|
||
|
vec4 tmpvar_59;
|
||
|
tmpvar_59 = tmpvar_58;
|
||
|
gl_FragData[0] = tmpvar_59;
|
||
|
}
|
||
|
|