mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
148 lines
2.9 KiB
Text
148 lines
2.9 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;
|
||
|
vec4 hip_screen;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform vec4 unity_Ambient;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform sampler2D _LightBuffer;
|
||
|
uniform float _Cutoff;
|
||
|
uniform vec4 _Color;
|
||
|
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 * _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;
|
||
|
vec3 tmpvar_20;
|
||
|
tmpvar_20 = vec3(0.0, 0.0, 0.0);
|
||
|
o_17.Albedo = tmpvar_20;
|
||
|
vec3 tmpvar_21;
|
||
|
tmpvar_21 = vec3(0.0, 0.0, 0.0);
|
||
|
o_17.Emission = tmpvar_21;
|
||
|
float tmpvar_22;
|
||
|
tmpvar_22 = 0.0;
|
||
|
o_17.Specular = tmpvar_22;
|
||
|
float tmpvar_23;
|
||
|
tmpvar_23 = 0.0;
|
||
|
o_17.Alpha = tmpvar_23;
|
||
|
float tmpvar_24;
|
||
|
tmpvar_24 = 0.0;
|
||
|
o_17.Gloss = tmpvar_24;
|
||
|
surf (surfIN_18, o_17);
|
||
|
xll_clip ((o_17.Alpha - _Cutoff));
|
||
|
vec4 tmpvar_25;
|
||
|
tmpvar_25 = texture2DProj (_LightBuffer, IN_14.hip_screen);
|
||
|
vec4 tmpvar_26;
|
||
|
tmpvar_26 = tmpvar_25;
|
||
|
light_16 = tmpvar_26;
|
||
|
vec4 tmpvar_27;
|
||
|
tmpvar_27 = log2 (light_16);
|
||
|
vec4 tmpvar_28;
|
||
|
tmpvar_28 = -(tmpvar_27);
|
||
|
light_16 = tmpvar_28;
|
||
|
vec3 tmpvar_29;
|
||
|
tmpvar_29 = (light_16.xyz + unity_Ambient.xyz);
|
||
|
light_16.xyz = tmpvar_29.xyz.xyz;
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = LightingLambert_PrePass (o_17, light_16);
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31 = tmpvar_30;
|
||
|
col_15 = tmpvar_31;
|
||
|
return col_15;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_32;
|
||
|
vec4 xl_retval_33;
|
||
|
vec4 tmpvar_34;
|
||
|
tmpvar_34 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_32.pos = tmpvar_34;
|
||
|
float tmpvar_35;
|
||
|
tmpvar_35 = xlv_FOG.x;
|
||
|
xlt_IN_32.fog = tmpvar_35;
|
||
|
vec2 tmpvar_36;
|
||
|
tmpvar_36 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_37;
|
||
|
tmpvar_37 = tmpvar_36;
|
||
|
xlt_IN_32.hip_pack0 = tmpvar_37;
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = gl_TexCoord[1].xyzw;
|
||
|
vec4 tmpvar_39;
|
||
|
tmpvar_39 = tmpvar_38;
|
||
|
xlt_IN_32.hip_screen = tmpvar_39;
|
||
|
vec4 tmpvar_40;
|
||
|
tmpvar_40 = frag_surf (xlt_IN_32);
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = tmpvar_40;
|
||
|
xl_retval_33 = tmpvar_41;
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = xl_retval_33.xyzw;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = tmpvar_42;
|
||
|
gl_FragData[0] = tmpvar_43;
|
||
|
}
|
||
|
|