mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
156 lines
3.1 KiB
Text
156 lines
3.1 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;
|
|
vec4 hip_screen;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
uniform vec4 unity_Ambient;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _LightBuffer;
|
|
uniform float _Cutoff;
|
|
void xll_clip (
|
|
in float x_1
|
|
)
|
|
{
|
|
if ((x_1 < 0.0)) {
|
|
discard;
|
|
};
|
|
}
|
|
|
|
void surf (
|
|
in Input IN_2,
|
|
inout SurfaceOutput o_3
|
|
)
|
|
{
|
|
vec4 c_4;
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = texture2D (_MainTex, IN_2.uv_MainTex);
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = (tmpvar_5 * IN_2.color);
|
|
c_4 = tmpvar_6;
|
|
vec3 tmpvar_7;
|
|
tmpvar_7 = c_4.xyz;
|
|
o_3.Albedo = tmpvar_7;
|
|
float tmpvar_8;
|
|
tmpvar_8 = c_4.w;
|
|
o_3.Alpha = tmpvar_8;
|
|
}
|
|
|
|
vec4 LightingLambert_PrePass (
|
|
in SurfaceOutput s_9,
|
|
in vec4 light_10
|
|
)
|
|
{
|
|
vec4 c_11;
|
|
vec3 tmpvar_12;
|
|
tmpvar_12 = (s_9.Albedo * light_10.xyz);
|
|
c_11.xyz = tmpvar_12.xyz.xyz;
|
|
float tmpvar_13;
|
|
tmpvar_13 = s_9.Alpha;
|
|
c_11.w = vec4(tmpvar_13).w;
|
|
return c_11;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_14
|
|
)
|
|
{
|
|
vec4 col_15;
|
|
vec4 light_16;
|
|
SurfaceOutput o_17;
|
|
Input surfIN_18;
|
|
vec2 tmpvar_19;
|
|
tmpvar_19 = IN_14.hip_pack0.xy;
|
|
surfIN_18.uv_MainTex = tmpvar_19;
|
|
vec4 tmpvar_20;
|
|
tmpvar_20 = IN_14.lop_color;
|
|
surfIN_18.color = tmpvar_20;
|
|
vec3 tmpvar_21;
|
|
tmpvar_21 = vec3(0.0, 0.0, 0.0);
|
|
o_17.Albedo = tmpvar_21;
|
|
vec3 tmpvar_22;
|
|
tmpvar_22 = vec3(0.0, 0.0, 0.0);
|
|
o_17.Emission = tmpvar_22;
|
|
float tmpvar_23;
|
|
tmpvar_23 = 0.0;
|
|
o_17.Specular = tmpvar_23;
|
|
float tmpvar_24;
|
|
tmpvar_24 = 0.0;
|
|
o_17.Alpha = tmpvar_24;
|
|
float tmpvar_25;
|
|
tmpvar_25 = 0.0;
|
|
o_17.Gloss = tmpvar_25;
|
|
surf (surfIN_18, o_17);
|
|
xll_clip ((o_17.Alpha - _Cutoff));
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = texture2DProj (_LightBuffer, IN_14.hip_screen);
|
|
vec4 tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
light_16 = tmpvar_27;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = log2 (light_16);
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = -(tmpvar_28);
|
|
light_16 = tmpvar_29;
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = (light_16.xyz + unity_Ambient.xyz);
|
|
light_16.xyz = tmpvar_30.xyz.xyz;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = LightingLambert_PrePass (o_17, light_16);
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = tmpvar_31;
|
|
col_15 = tmpvar_32;
|
|
return col_15;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_33;
|
|
vec4 xl_retval_34;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_33.pos = tmpvar_35;
|
|
float tmpvar_36;
|
|
tmpvar_36 = xlv_FOG.x;
|
|
xlt_IN_33.fog = tmpvar_36;
|
|
vec2 tmpvar_37;
|
|
tmpvar_37 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
xlt_IN_33.hip_pack0 = tmpvar_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = gl_Color.xyzw;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = tmpvar_39;
|
|
xlt_IN_33.lop_color = tmpvar_40;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = gl_TexCoord[1].xyzw;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = tmpvar_41;
|
|
xlt_IN_33.hip_screen = tmpvar_42;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = frag_surf (xlt_IN_33);
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xl_retval_34 = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = xl_retval_34.xyzw;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
gl_FragData[0] = tmpvar_46;
|
|
}
|
|
|