mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
180 lines
3.9 KiB
Text
180 lines
3.9 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 _SpecColor;
|
||
|
uniform float _Shininess;
|
||
|
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;
|
||
|
float tmpvar_10;
|
||
|
tmpvar_10 = tex_5.w;
|
||
|
o_2.Gloss = tmpvar_10;
|
||
|
float tmpvar_11;
|
||
|
tmpvar_11 = _Shininess;
|
||
|
o_2.Specular = tmpvar_11;
|
||
|
vec4 tmpvar_12;
|
||
|
tmpvar_12 = textureCube (_Cube, IN_1.worldRefl);
|
||
|
vec4 tmpvar_13;
|
||
|
tmpvar_13 = tmpvar_12;
|
||
|
reflcol_3 = tmpvar_13;
|
||
|
vec4 tmpvar_14;
|
||
|
tmpvar_14 = (reflcol_3 * tex_5.w);
|
||
|
reflcol_3 = tmpvar_14;
|
||
|
vec3 tmpvar_15;
|
||
|
tmpvar_15 = (reflcol_3.xyz * _ReflectColor.xyz);
|
||
|
o_2.Emission = tmpvar_15;
|
||
|
float tmpvar_16;
|
||
|
tmpvar_16 = (reflcol_3.w * _ReflectColor.w);
|
||
|
o_2.Alpha = tmpvar_16;
|
||
|
}
|
||
|
|
||
|
vec4 LightingBlinnPhong_PrePass (
|
||
|
in SurfaceOutput s_17,
|
||
|
in vec4 light_18
|
||
|
)
|
||
|
{
|
||
|
vec4 c_19;
|
||
|
float spec_20;
|
||
|
float tmpvar_21;
|
||
|
tmpvar_21 = (light_18.w * s_17.Gloss);
|
||
|
spec_20 = tmpvar_21;
|
||
|
vec3 tmpvar_22;
|
||
|
tmpvar_22 = ((s_17.Albedo * light_18.xyz) + ((light_18.xyz * _SpecColor.xyz) * spec_20));
|
||
|
c_19.xyz = tmpvar_22.xyz.xyz;
|
||
|
float tmpvar_23;
|
||
|
tmpvar_23 = (s_17.Alpha + (spec_20 * _SpecColor.w));
|
||
|
c_19.w = vec4(tmpvar_23).w;
|
||
|
return c_19;
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_24
|
||
|
)
|
||
|
{
|
||
|
vec4 col_25;
|
||
|
vec4 light_26;
|
||
|
SurfaceOutput o_27;
|
||
|
Input surfIN_28;
|
||
|
vec2 tmpvar_29;
|
||
|
tmpvar_29 = IN_24.hip_pack0.xy;
|
||
|
surfIN_28.uv_MainTex = tmpvar_29;
|
||
|
vec3 tmpvar_30;
|
||
|
tmpvar_30 = IN_24.worldRefl;
|
||
|
surfIN_28.worldRefl = tmpvar_30;
|
||
|
vec3 tmpvar_31;
|
||
|
tmpvar_31 = vec3(0.0, 0.0, 0.0);
|
||
|
o_27.Albedo = tmpvar_31;
|
||
|
vec3 tmpvar_32;
|
||
|
tmpvar_32 = vec3(0.0, 0.0, 0.0);
|
||
|
o_27.Emission = tmpvar_32;
|
||
|
float tmpvar_33;
|
||
|
tmpvar_33 = 0.0;
|
||
|
o_27.Specular = tmpvar_33;
|
||
|
float tmpvar_34;
|
||
|
tmpvar_34 = 0.0;
|
||
|
o_27.Alpha = tmpvar_34;
|
||
|
float tmpvar_35;
|
||
|
tmpvar_35 = 0.0;
|
||
|
o_27.Gloss = tmpvar_35;
|
||
|
surf (surfIN_28, o_27);
|
||
|
vec4 tmpvar_36;
|
||
|
tmpvar_36 = texture2DProj (_LightBuffer, IN_24.hip_screen);
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = tmpvar_36;
|
||
|
light_26 = tmpvar_37;
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = log2 (light_26);
|
||
|
vec4 tmpvar_39;
|
||
|
tmpvar_39 = -(tmpvar_38);
|
||
|
light_26 = tmpvar_39;
|
||
|
vec3 tmpvar_40;
|
||
|
tmpvar_40 = (light_26.xyz + unity_Ambient.xyz);
|
||
|
light_26.xyz = tmpvar_40.xyz.xyz;
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = LightingBlinnPhong_PrePass (o_27, light_26);
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
col_25 = tmpvar_42;
|
||
|
vec3 tmpvar_43;
|
||
|
tmpvar_43 = (col_25.xyz + o_27.Emission);
|
||
|
col_25.xyz = tmpvar_43.xyz.xyz;
|
||
|
return col_25;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_44;
|
||
|
vec4 xl_retval_45;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_44.pos = tmpvar_46;
|
||
|
float tmpvar_47;
|
||
|
tmpvar_47 = xlv_FOG.x;
|
||
|
xlt_IN_44.fog = tmpvar_47;
|
||
|
vec2 tmpvar_48;
|
||
|
tmpvar_48 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_49;
|
||
|
tmpvar_49 = tmpvar_48;
|
||
|
xlt_IN_44.hip_pack0 = tmpvar_49;
|
||
|
vec3 tmpvar_50;
|
||
|
tmpvar_50 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_51;
|
||
|
tmpvar_51 = tmpvar_50;
|
||
|
xlt_IN_44.worldRefl = tmpvar_51;
|
||
|
vec4 tmpvar_52;
|
||
|
tmpvar_52 = gl_TexCoord[2].xyzw;
|
||
|
vec4 tmpvar_53;
|
||
|
tmpvar_53 = tmpvar_52;
|
||
|
xlt_IN_44.hip_screen = tmpvar_53;
|
||
|
vec4 tmpvar_54;
|
||
|
tmpvar_54 = frag_surf (xlt_IN_44);
|
||
|
vec4 tmpvar_55;
|
||
|
tmpvar_55 = tmpvar_54;
|
||
|
xl_retval_45 = tmpvar_55;
|
||
|
vec4 tmpvar_56;
|
||
|
tmpvar_56 = xl_retval_45.xyzw;
|
||
|
vec4 tmpvar_57;
|
||
|
tmpvar_57 = tmpvar_56;
|
||
|
gl_FragData[0] = tmpvar_57;
|
||
|
}
|
||
|
|