mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
135 lines
2.8 KiB
Text
135 lines
2.8 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec4 screenPos;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec4 hip_screenPos;
|
|
vec4 hip_screen;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
uniform vec4 unity_Ambient;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _LightBuffer;
|
|
void surf (
|
|
in Input IN_1,
|
|
inout SurfaceOutput o_2
|
|
)
|
|
{
|
|
vec2 uv_3;
|
|
vec2 tmpvar_4;
|
|
tmpvar_4 = (IN_1.screenPos.xy / IN_1.screenPos.w);
|
|
uv_3 = tmpvar_4;
|
|
vec2 tmpvar_5;
|
|
tmpvar_5 = (uv_3 * vec2(2.0, 1.0));
|
|
uv_3 = tmpvar_5;
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = texture2D (_MainTex, uv_3);
|
|
vec3 tmpvar_7;
|
|
tmpvar_7 = tmpvar_6.xyz;
|
|
o_2.Albedo = tmpvar_7;
|
|
}
|
|
|
|
vec4 LightingLambert_PrePass (
|
|
in SurfaceOutput s_8,
|
|
in vec4 light_9
|
|
)
|
|
{
|
|
vec4 c_10;
|
|
vec3 tmpvar_11;
|
|
tmpvar_11 = (s_8.Albedo * light_9.xyz);
|
|
c_10.xyz = tmpvar_11.xyz.xyz;
|
|
float tmpvar_12;
|
|
tmpvar_12 = s_8.Alpha;
|
|
c_10.w = vec4(tmpvar_12).w;
|
|
return c_10;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_13
|
|
)
|
|
{
|
|
vec4 col_14;
|
|
vec4 light_15;
|
|
SurfaceOutput o_16;
|
|
Input surfIN_17;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = IN_13.hip_screenPos;
|
|
surfIN_17.screenPos = tmpvar_18;
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = vec3(0.0, 0.0, 0.0);
|
|
o_16.Albedo = tmpvar_19;
|
|
vec3 tmpvar_20;
|
|
tmpvar_20 = vec3(0.0, 0.0, 0.0);
|
|
o_16.Emission = tmpvar_20;
|
|
float tmpvar_21;
|
|
tmpvar_21 = 0.0;
|
|
o_16.Specular = tmpvar_21;
|
|
float tmpvar_22;
|
|
tmpvar_22 = 0.0;
|
|
o_16.Alpha = tmpvar_22;
|
|
float tmpvar_23;
|
|
tmpvar_23 = 0.0;
|
|
o_16.Gloss = tmpvar_23;
|
|
surf (surfIN_17, o_16);
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = texture2DProj (_LightBuffer, IN_13.hip_screen);
|
|
vec4 tmpvar_25;
|
|
tmpvar_25 = tmpvar_24;
|
|
light_15 = tmpvar_25;
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = log2 (light_15);
|
|
vec4 tmpvar_27;
|
|
tmpvar_27 = -(tmpvar_26);
|
|
light_15 = tmpvar_27;
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = (light_15.xyz + unity_Ambient.xyz);
|
|
light_15.xyz = tmpvar_28.xyz.xyz;
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = LightingLambert_PrePass (o_16, light_15);
|
|
vec4 tmpvar_30;
|
|
tmpvar_30 = tmpvar_29;
|
|
col_14 = tmpvar_30;
|
|
return col_14;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_31;
|
|
vec4 xl_retval_32;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_31.pos = tmpvar_33;
|
|
float tmpvar_34;
|
|
tmpvar_34 = xlv_FOG.x;
|
|
xlt_IN_31.fog = tmpvar_34;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = gl_TexCoord[0].xyzw;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
xlt_IN_31.hip_screenPos = tmpvar_36;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = gl_TexCoord[1].xyzw;
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
xlt_IN_31.hip_screen = tmpvar_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = frag_surf (xlt_IN_31);
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = tmpvar_39;
|
|
xl_retval_32 = tmpvar_40;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = xl_retval_32.xyzw;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = tmpvar_41;
|
|
gl_FragData[0] = tmpvar_42;
|
|
}
|
|
|