mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-04 21:31:11 -05:00
151 lines
3 KiB
Text
151 lines
3 KiB
Text
|
struct SurfaceOutput {
|
||
|
vec3 Albedo;
|
||
|
vec3 Normal;
|
||
|
vec3 Emission;
|
||
|
float Specular;
|
||
|
float Gloss;
|
||
|
float Alpha;
|
||
|
};
|
||
|
struct Input {
|
||
|
vec2 uv_MainTex;
|
||
|
vec3 worldPos;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec2 hip_pack0;
|
||
|
vec3 worldPos;
|
||
|
vec4 hip_screen;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform vec4 unity_Ambient;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform sampler2D _LightBuffer;
|
||
|
void xll_clip (
|
||
|
in float x_1
|
||
|
)
|
||
|
{
|
||
|
if ((x_1 < 0.0)) {
|
||
|
discard;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
void surf (
|
||
|
in Input IN_2,
|
||
|
inout SurfaceOutput o_3
|
||
|
)
|
||
|
{
|
||
|
float tmpvar_4;
|
||
|
tmpvar_4 = fract (((IN_2.worldPos.y + (IN_2.worldPos.z * 0.1)) * 5.0));
|
||
|
xll_clip ((tmpvar_4 - 0.5));
|
||
|
vec4 tmpvar_5;
|
||
|
tmpvar_5 = texture2D (_MainTex, IN_2.uv_MainTex);
|
||
|
vec3 tmpvar_6;
|
||
|
tmpvar_6 = tmpvar_5.xyz;
|
||
|
o_3.Albedo = tmpvar_6;
|
||
|
}
|
||
|
|
||
|
vec4 LightingLambert_PrePass (
|
||
|
in SurfaceOutput s_7,
|
||
|
in vec4 light_8
|
||
|
)
|
||
|
{
|
||
|
vec4 c_9;
|
||
|
vec3 tmpvar_10;
|
||
|
tmpvar_10 = (s_7.Albedo * light_8.xyz);
|
||
|
c_9.xyz = tmpvar_10.xyz.xyz;
|
||
|
float tmpvar_11;
|
||
|
tmpvar_11 = s_7.Alpha;
|
||
|
c_9.w = vec4(tmpvar_11).w;
|
||
|
return c_9;
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_12
|
||
|
)
|
||
|
{
|
||
|
vec4 col_13;
|
||
|
vec4 light_14;
|
||
|
SurfaceOutput o_15;
|
||
|
Input surfIN_16;
|
||
|
vec2 tmpvar_17;
|
||
|
tmpvar_17 = IN_12.hip_pack0.xy;
|
||
|
surfIN_16.uv_MainTex = tmpvar_17;
|
||
|
vec3 tmpvar_18;
|
||
|
tmpvar_18 = IN_12.worldPos;
|
||
|
surfIN_16.worldPos = tmpvar_18;
|
||
|
vec3 tmpvar_19;
|
||
|
tmpvar_19 = vec3(0.0, 0.0, 0.0);
|
||
|
o_15.Albedo = tmpvar_19;
|
||
|
vec3 tmpvar_20;
|
||
|
tmpvar_20 = vec3(0.0, 0.0, 0.0);
|
||
|
o_15.Emission = tmpvar_20;
|
||
|
float tmpvar_21;
|
||
|
tmpvar_21 = 0.0;
|
||
|
o_15.Specular = tmpvar_21;
|
||
|
float tmpvar_22;
|
||
|
tmpvar_22 = 0.0;
|
||
|
o_15.Alpha = tmpvar_22;
|
||
|
float tmpvar_23;
|
||
|
tmpvar_23 = 0.0;
|
||
|
o_15.Gloss = tmpvar_23;
|
||
|
surf (surfIN_16, o_15);
|
||
|
vec4 tmpvar_24;
|
||
|
tmpvar_24 = texture2DProj (_LightBuffer, IN_12.hip_screen);
|
||
|
vec4 tmpvar_25;
|
||
|
tmpvar_25 = tmpvar_24;
|
||
|
light_14 = tmpvar_25;
|
||
|
vec4 tmpvar_26;
|
||
|
tmpvar_26 = log2 (light_14);
|
||
|
vec4 tmpvar_27;
|
||
|
tmpvar_27 = -(tmpvar_26);
|
||
|
light_14 = tmpvar_27;
|
||
|
vec3 tmpvar_28;
|
||
|
tmpvar_28 = (light_14.xyz + unity_Ambient.xyz);
|
||
|
light_14.xyz = tmpvar_28.xyz.xyz;
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29 = LightingLambert_PrePass (o_15, light_14);
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = tmpvar_29;
|
||
|
col_13 = tmpvar_30;
|
||
|
return col_13;
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
vec2 tmpvar_35;
|
||
|
tmpvar_35 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_36;
|
||
|
tmpvar_36 = tmpvar_35;
|
||
|
xlt_IN_31.hip_pack0 = tmpvar_36;
|
||
|
vec3 tmpvar_37;
|
||
|
tmpvar_37 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
xlt_IN_31.worldPos = tmpvar_38;
|
||
|
vec4 tmpvar_39;
|
||
|
tmpvar_39 = gl_TexCoord[2].xyzw;
|
||
|
vec4 tmpvar_40;
|
||
|
tmpvar_40 = tmpvar_39;
|
||
|
xlt_IN_31.hip_screen = tmpvar_40;
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = frag_surf (xlt_IN_31);
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
xl_retval_32 = tmpvar_42;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = xl_retval_32.xyzw;
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = tmpvar_43;
|
||
|
gl_FragData[0] = tmpvar_44;
|
||
|
}
|
||
|
|