mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
167 lines
3.6 KiB
Text
167 lines
3.6 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec2 uv_MainTex;
|
|
vec3 worldRefl;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 hip_pack0;
|
|
vec3 worldRefl;
|
|
vec4 hip_screen;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
uniform vec4 unity_Ambient;
|
|
uniform vec4 _ReflectColor;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _LightBuffer;
|
|
uniform samplerCube _Cube;
|
|
uniform vec4 _Color;
|
|
void surf (
|
|
in Input IN_1,
|
|
inout SurfaceOutput o_2
|
|
)
|
|
{
|
|
vec4 reflcol_3;
|
|
vec4 c_4;
|
|
vec4 tex_5;
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = texture2D (_MainTex, IN_1.uv_MainTex);
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = tmpvar_6;
|
|
tex_5 = tmpvar_7;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = (tex_5 * _Color);
|
|
c_4 = tmpvar_8;
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = c_4.xyz;
|
|
o_2.Albedo = tmpvar_9;
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = textureCube (_Cube, IN_1.worldRefl);
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = tmpvar_10;
|
|
reflcol_3 = tmpvar_11;
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = (reflcol_3 * tex_5.w);
|
|
reflcol_3 = tmpvar_12;
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = (reflcol_3.xyz * _ReflectColor.xyz);
|
|
o_2.Emission = tmpvar_13;
|
|
float tmpvar_14;
|
|
tmpvar_14 = (reflcol_3.w * _ReflectColor.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;
|
|
vec3 tmpvar_26;
|
|
tmpvar_26 = IN_20.worldRefl;
|
|
surfIN_24.worldRefl = 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;
|
|
vec3 tmpvar_39;
|
|
tmpvar_39 = (col_21.xyz + o_23.Emission);
|
|
col_21.xyz = tmpvar_39.xyz.xyz;
|
|
return col_21;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_40;
|
|
vec4 xl_retval_41;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_40.pos = tmpvar_42;
|
|
float tmpvar_43;
|
|
tmpvar_43 = xlv_FOG.x;
|
|
xlt_IN_40.fog = tmpvar_43;
|
|
vec2 tmpvar_44;
|
|
tmpvar_44 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_45;
|
|
tmpvar_45 = tmpvar_44;
|
|
xlt_IN_40.hip_pack0 = tmpvar_45;
|
|
vec3 tmpvar_46;
|
|
tmpvar_46 = gl_TexCoord[1].xyz;
|
|
vec3 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
xlt_IN_40.worldRefl = tmpvar_47;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = gl_TexCoord[2].xyzw;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = tmpvar_48;
|
|
xlt_IN_40.hip_screen = tmpvar_49;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = frag_surf (xlt_IN_40);
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = tmpvar_50;
|
|
xl_retval_41 = tmpvar_51;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = xl_retval_41.xyzw;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = tmpvar_52;
|
|
gl_FragData[0] = tmpvar_53;
|
|
}
|
|
|