mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
157 lines
3.3 KiB
Text
157 lines
3.3 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec2 uv_MainTex;
|
|
vec2 uv_DecalTex;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec4 hip_pack0;
|
|
vec4 hip_screen;
|
|
};
|
|
uniform vec4 _Color;
|
|
uniform sampler2D _DecalTex;
|
|
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 decal_3;
|
|
vec4 c_4;
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = texture2D (_MainTex, IN_1.uv_MainTex);
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = tmpvar_5;
|
|
c_4 = tmpvar_6;
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = texture2D (_DecalTex, IN_1.uv_DecalTex);
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = tmpvar_7;
|
|
decal_3 = tmpvar_8;
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = vec3(decal_3.w);
|
|
vec3 tmpvar_10;
|
|
tmpvar_10 = mix (c_4.xyz, decal_3.xyz, tmpvar_9);
|
|
vec3 tmpvar_11;
|
|
tmpvar_11 = tmpvar_10;
|
|
c_4.xyz = tmpvar_11.xyz.xyz;
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = (c_4 * _Color);
|
|
c_4 = tmpvar_12;
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = c_4.xyz;
|
|
o_2.Albedo = tmpvar_13;
|
|
float tmpvar_14;
|
|
tmpvar_14 = c_4.w;
|
|
o_2.Alpha = tmpvar_14;
|
|
}
|
|
|
|
vec4 LightingLambert_PrePass (
|
|
in SurfaceOutput s_15,
|
|
in vec4 light_16
|
|
)
|
|
{
|
|
vec4 c_17;
|
|
vec3 tmpvar_18;
|
|
tmpvar_18 = (s_15.Albedo * light_16.xyz);
|
|
c_17.xyz = tmpvar_18.xyz.xyz;
|
|
float tmpvar_19;
|
|
tmpvar_19 = s_15.Alpha;
|
|
c_17.w = vec4(tmpvar_19).w;
|
|
return c_17;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_20
|
|
)
|
|
{
|
|
vec4 col_21;
|
|
vec4 light_22;
|
|
SurfaceOutput o_23;
|
|
Input surfIN_24;
|
|
vec2 tmpvar_25;
|
|
tmpvar_25 = IN_20.hip_pack0.xy;
|
|
surfIN_24.uv_MainTex = tmpvar_25;
|
|
vec2 tmpvar_26;
|
|
tmpvar_26 = IN_20.hip_pack0.zw;
|
|
surfIN_24.uv_DecalTex = tmpvar_26;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = vec3(0.0, 0.0, 0.0);
|
|
o_23.Albedo = tmpvar_27;
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = vec3(0.0, 0.0, 0.0);
|
|
o_23.Emission = tmpvar_28;
|
|
float tmpvar_29;
|
|
tmpvar_29 = 0.0;
|
|
o_23.Specular = tmpvar_29;
|
|
float tmpvar_30;
|
|
tmpvar_30 = 0.0;
|
|
o_23.Alpha = tmpvar_30;
|
|
float tmpvar_31;
|
|
tmpvar_31 = 0.0;
|
|
o_23.Gloss = tmpvar_31;
|
|
surf (surfIN_24, o_23);
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = texture2DProj (_LightBuffer, IN_20.hip_screen);
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = tmpvar_32;
|
|
light_22 = tmpvar_33;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = log2 (light_22);
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = -(tmpvar_34);
|
|
light_22 = tmpvar_35;
|
|
vec3 tmpvar_36;
|
|
tmpvar_36 = (light_22.xyz + unity_Ambient.xyz);
|
|
light_22.xyz = tmpvar_36.xyz.xyz;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = LightingLambert_PrePass (o_23, light_22);
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
col_21 = tmpvar_38;
|
|
return col_21;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_39;
|
|
vec4 xl_retval_40;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_39.pos = tmpvar_41;
|
|
float tmpvar_42;
|
|
tmpvar_42 = xlv_FOG.x;
|
|
xlt_IN_39.fog = tmpvar_42;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = gl_TexCoord[0].xyzw;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xlt_IN_39.hip_pack0 = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = gl_TexCoord[1].xyzw;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
xlt_IN_39.hip_screen = tmpvar_46;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = frag_surf (xlt_IN_39);
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
xl_retval_40 = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = xl_retval_40.xyzw;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
gl_FragData[0] = tmpvar_50;
|
|
}
|
|
|