mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
188 lines
4 KiB
Text
188 lines
4 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec2 uv_Control;
|
|
vec2 uv_Splat0;
|
|
vec2 uv_Splat1;
|
|
vec2 uv_Splat2;
|
|
vec2 uv_Splat3;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec4 hip_pack0;
|
|
vec4 hip_pack1;
|
|
vec2 hip_pack2;
|
|
vec4 hip_screen;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
uniform vec4 unity_Ambient;
|
|
uniform sampler2D _Splat3;
|
|
uniform sampler2D _Splat2;
|
|
uniform sampler2D _Splat1;
|
|
uniform sampler2D _Splat0;
|
|
uniform sampler2D _LightBuffer;
|
|
uniform sampler2D _Control;
|
|
void surf (
|
|
in Input IN,
|
|
inout SurfaceOutput o
|
|
)
|
|
{
|
|
vec3 col;
|
|
vec4 splat_control;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = texture2D (_Control, IN.uv_Control);
|
|
vec4 tmpvar_2;
|
|
tmpvar_2 = tmpvar_1;
|
|
splat_control = tmpvar_2;
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = texture2D (_Splat0, IN.uv_Splat0);
|
|
vec3 tmpvar_4;
|
|
tmpvar_4 = (splat_control.x * tmpvar_3.xyz);
|
|
col = tmpvar_4;
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = texture2D (_Splat1, IN.uv_Splat1);
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = (col + (splat_control.y * tmpvar_5.xyz));
|
|
col = tmpvar_6;
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = texture2D (_Splat2, IN.uv_Splat2);
|
|
vec3 tmpvar_8;
|
|
tmpvar_8 = (col + (splat_control.z * tmpvar_7.xyz));
|
|
col = tmpvar_8;
|
|
vec4 tmpvar_9;
|
|
tmpvar_9 = texture2D (_Splat3, IN.uv_Splat3);
|
|
vec3 tmpvar_10;
|
|
tmpvar_10 = (col + (splat_control.w * tmpvar_9.xyz));
|
|
col = tmpvar_10;
|
|
vec3 tmpvar_11;
|
|
tmpvar_11 = col;
|
|
o.Albedo = tmpvar_11;
|
|
float tmpvar_12;
|
|
tmpvar_12 = 0.0;
|
|
o.Alpha = tmpvar_12;
|
|
}
|
|
|
|
vec4 LightingLambert_PrePass (
|
|
in SurfaceOutput s,
|
|
in vec4 light
|
|
)
|
|
{
|
|
vec4 c;
|
|
vec3 tmpvar_1;
|
|
tmpvar_1 = (s.Albedo * light.xyz);
|
|
c.xyz = tmpvar_1.xyz.xyz;
|
|
float tmpvar_2;
|
|
tmpvar_2 = s.Alpha;
|
|
c.w = vec4(tmpvar_2).w;
|
|
return c;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN
|
|
)
|
|
{
|
|
vec4 col;
|
|
vec4 light;
|
|
SurfaceOutput o;
|
|
Input surfIN;
|
|
vec2 tmpvar_1;
|
|
tmpvar_1 = IN.hip_pack0.xy;
|
|
surfIN.uv_Control = tmpvar_1;
|
|
vec2 tmpvar_2;
|
|
tmpvar_2 = IN.hip_pack0.zw;
|
|
surfIN.uv_Splat0 = tmpvar_2;
|
|
vec2 tmpvar_3;
|
|
tmpvar_3 = IN.hip_pack1.xy;
|
|
surfIN.uv_Splat1 = tmpvar_3;
|
|
vec2 tmpvar_4;
|
|
tmpvar_4 = IN.hip_pack1.zw;
|
|
surfIN.uv_Splat2 = tmpvar_4;
|
|
vec2 tmpvar_5;
|
|
tmpvar_5 = IN.hip_pack2.xy;
|
|
surfIN.uv_Splat3 = tmpvar_5;
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = vec3(0.0, 0.0, 0.0);
|
|
o.Albedo = tmpvar_6;
|
|
vec3 tmpvar_7;
|
|
tmpvar_7 = vec3(0.0, 0.0, 0.0);
|
|
o.Emission = tmpvar_7;
|
|
float tmpvar_8;
|
|
tmpvar_8 = 0.0;
|
|
o.Specular = tmpvar_8;
|
|
float tmpvar_9;
|
|
tmpvar_9 = 0.0;
|
|
o.Alpha = tmpvar_9;
|
|
float tmpvar_10;
|
|
tmpvar_10 = 0.0;
|
|
o.Gloss = tmpvar_10;
|
|
surf (surfIN, o);
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = texture2DProj (_LightBuffer, IN.hip_screen);
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = tmpvar_11;
|
|
light = tmpvar_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = log2 (light);
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = -(tmpvar_13);
|
|
light = tmpvar_14;
|
|
vec3 tmpvar_15;
|
|
tmpvar_15 = (light.xyz + unity_Ambient.xyz);
|
|
light.xyz = tmpvar_15.xyz.xyz;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16 = LightingLambert_PrePass (o, light);
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = tmpvar_16;
|
|
col = tmpvar_17;
|
|
return col;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN;
|
|
vec4 xl_retval;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN.pos = tmpvar_1;
|
|
float tmpvar_2;
|
|
tmpvar_2 = xlv_FOG.x;
|
|
xlt_IN.fog = tmpvar_2;
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = gl_TexCoord[0].xyzw;
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = tmpvar_3;
|
|
xlt_IN.hip_pack0 = tmpvar_4;
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = gl_TexCoord[1].xyzw;
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = tmpvar_5;
|
|
xlt_IN.hip_pack1 = tmpvar_6;
|
|
vec2 tmpvar_7;
|
|
tmpvar_7 = gl_TexCoord[2].xy;
|
|
vec2 tmpvar_8;
|
|
tmpvar_8 = tmpvar_7;
|
|
xlt_IN.hip_pack2 = tmpvar_8;
|
|
vec4 tmpvar_9;
|
|
tmpvar_9 = gl_TexCoord[3].xyzw;
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = tmpvar_9;
|
|
xlt_IN.hip_screen = tmpvar_10;
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = frag_surf (xlt_IN);
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = tmpvar_11;
|
|
xl_retval = tmpvar_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = xl_retval.xyzw;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = tmpvar_13;
|
|
gl_FragData[0] = tmpvar_14;
|
|
}
|
|
|