mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -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 {
|
|
vec2 uv_MainTex;
|
|
vec2 uv2_Detail;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec4 hip_pack0;
|
|
vec4 hip_screen;
|
|
};
|
|
uniform sampler2D _Detail;
|
|
uniform sampler2D _LightBuffer;
|
|
uniform sampler2D _MainTex;
|
|
uniform vec4 unity_Ambient;
|
|
varying vec4 xlv_FOG;
|
|
void surf (
|
|
in Input IN_1,
|
|
inout SurfaceOutput o_2
|
|
)
|
|
{
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = texture2D (_MainTex, IN_1.uv_MainTex);
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = texture2D (_Detail, IN_1.uv2_Detail);
|
|
vec3 tmpvar_5;
|
|
tmpvar_5 = ((tmpvar_3.xyz * tmpvar_4.xyz) * 2.0);
|
|
o_2.Albedo = tmpvar_5;
|
|
}
|
|
|
|
vec4 LightingLambert_PrePass (
|
|
in SurfaceOutput s_6,
|
|
in vec4 light_7
|
|
)
|
|
{
|
|
vec4 c_8;
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = (s_6.Albedo * light_7.xyz);
|
|
c_8.xyz = tmpvar_9.xyz.xyz;
|
|
float tmpvar_10;
|
|
tmpvar_10 = s_6.Alpha;
|
|
c_8.w = vec4(tmpvar_10).w;
|
|
return c_8;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_11
|
|
)
|
|
{
|
|
vec4 col_12;
|
|
vec4 light_13;
|
|
SurfaceOutput o_14;
|
|
Input surfIN_15;
|
|
vec2 tmpvar_16;
|
|
tmpvar_16 = IN_11.hip_pack0.xy;
|
|
surfIN_15.uv_MainTex = tmpvar_16;
|
|
vec2 tmpvar_17;
|
|
tmpvar_17 = IN_11.hip_pack0.zw;
|
|
surfIN_15.uv2_Detail = tmpvar_17;
|
|
vec3 tmpvar_18;
|
|
tmpvar_18 = vec3(0.0, 0.0, 0.0);
|
|
o_14.Albedo = tmpvar_18;
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = vec3(0.0, 0.0, 0.0);
|
|
o_14.Emission = tmpvar_19;
|
|
float tmpvar_20;
|
|
tmpvar_20 = 0.0;
|
|
o_14.Specular = tmpvar_20;
|
|
float tmpvar_21;
|
|
tmpvar_21 = 0.0;
|
|
o_14.Alpha = tmpvar_21;
|
|
float tmpvar_22;
|
|
tmpvar_22 = 0.0;
|
|
o_14.Gloss = tmpvar_22;
|
|
surf (surfIN_15, o_14);
|
|
vec4 tmpvar_23;
|
|
tmpvar_23 = texture2DProj (_LightBuffer, IN_11.hip_screen);
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = tmpvar_23;
|
|
light_13 = tmpvar_24;
|
|
vec4 tmpvar_25;
|
|
tmpvar_25 = log2 (light_13);
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = -(tmpvar_25);
|
|
light_13 = tmpvar_26;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = (light_13.xyz + unity_Ambient.xyz);
|
|
light_13.xyz = tmpvar_27.xyz.xyz;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = LightingLambert_PrePass (o_14, light_13);
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = tmpvar_28;
|
|
col_12 = tmpvar_29;
|
|
return col_12;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_30;
|
|
vec4 xl_retval_31;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_30.pos = tmpvar_32;
|
|
float tmpvar_33;
|
|
tmpvar_33 = xlv_FOG.x;
|
|
xlt_IN_30.fog = tmpvar_33;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = gl_TexCoord[0].xyzw;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
xlt_IN_30.hip_pack0 = tmpvar_35;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = gl_TexCoord[1].xyzw;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
xlt_IN_30.hip_screen = tmpvar_37;
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = frag_surf (xlt_IN_30);
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = tmpvar_38;
|
|
xl_retval_31 = tmpvar_39;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = xl_retval_31.xyzw;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = tmpvar_40;
|
|
gl_FragData[0] = tmpvar_41;
|
|
}
|
|
|