mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
293 lines
5.7 KiB
Text
293 lines
5.7 KiB
Text
|
struct SurfaceOutput {
|
||
|
vec3 Albedo;
|
||
|
vec3 Normal;
|
||
|
vec3 Emission;
|
||
|
float Specular;
|
||
|
float Gloss;
|
||
|
float Alpha;
|
||
|
};
|
||
|
struct Input {
|
||
|
vec2 uv_MainTex;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec2 hip_pack0;
|
||
|
vec4 hip_screen;
|
||
|
vec3 hip_lmapFade;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform sampler2D unity_LightmapInd;
|
||
|
uniform sampler2D unity_Lightmap;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform sampler2D _LightBuffer;
|
||
|
uniform float _Cutoff;
|
||
|
uniform vec4 _Color;
|
||
|
void xll_clip (
|
||
|
in float x_1
|
||
|
)
|
||
|
{
|
||
|
if ((x_1 < 0.0)) {
|
||
|
discard;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
float xll_saturate (
|
||
|
in float x_2
|
||
|
)
|
||
|
{
|
||
|
float tmpvar_3;
|
||
|
tmpvar_3 = clamp (x_2, 0.0, 1.0);
|
||
|
return tmpvar_3;
|
||
|
}
|
||
|
|
||
|
vec2 xll_saturate (
|
||
|
in vec2 x_4
|
||
|
)
|
||
|
{
|
||
|
vec2 tmpvar_5;
|
||
|
tmpvar_5 = clamp (x_4, 0.0, 1.0);
|
||
|
return tmpvar_5;
|
||
|
}
|
||
|
|
||
|
vec3 xll_saturate (
|
||
|
in vec3 x_6
|
||
|
)
|
||
|
{
|
||
|
vec3 tmpvar_7;
|
||
|
tmpvar_7 = clamp (x_6, 0.0, 1.0);
|
||
|
return tmpvar_7;
|
||
|
}
|
||
|
|
||
|
vec4 xll_saturate (
|
||
|
in vec4 x_8
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_9;
|
||
|
tmpvar_9 = clamp (x_8, 0.0, 1.0);
|
||
|
return tmpvar_9;
|
||
|
}
|
||
|
|
||
|
mat2 xll_saturate (
|
||
|
in mat2 m_10
|
||
|
)
|
||
|
{
|
||
|
vec2 tmpvar_11;
|
||
|
tmpvar_11 = clamp (m_10[0], 0.0, 1.0);
|
||
|
vec2 tmpvar_12;
|
||
|
tmpvar_12 = clamp (m_10[1], 0.0, 1.0);
|
||
|
mat2 tmpvar_13;
|
||
|
vec2 tmpvar_14;
|
||
|
tmpvar_14 = tmpvar_11;
|
||
|
tmpvar_13[0] = tmpvar_14;
|
||
|
vec2 tmpvar_15;
|
||
|
tmpvar_15 = tmpvar_12;
|
||
|
tmpvar_13[1] = tmpvar_15;
|
||
|
return tmpvar_13;
|
||
|
}
|
||
|
|
||
|
mat3 xll_saturate (
|
||
|
in mat3 m_16
|
||
|
)
|
||
|
{
|
||
|
vec3 tmpvar_17;
|
||
|
tmpvar_17 = clamp (m_16[0], 0.0, 1.0);
|
||
|
vec3 tmpvar_18;
|
||
|
tmpvar_18 = clamp (m_16[1], 0.0, 1.0);
|
||
|
vec3 tmpvar_19;
|
||
|
tmpvar_19 = clamp (m_16[2], 0.0, 1.0);
|
||
|
mat3 tmpvar_20;
|
||
|
vec3 tmpvar_21;
|
||
|
tmpvar_21 = tmpvar_17;
|
||
|
tmpvar_20[0] = tmpvar_21;
|
||
|
vec3 tmpvar_22;
|
||
|
tmpvar_22 = tmpvar_18;
|
||
|
tmpvar_20[1] = tmpvar_22;
|
||
|
vec3 tmpvar_23;
|
||
|
tmpvar_23 = tmpvar_19;
|
||
|
tmpvar_20[2] = tmpvar_23;
|
||
|
return tmpvar_20;
|
||
|
}
|
||
|
|
||
|
mat4 xll_saturate (
|
||
|
in mat4 m_24
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_25;
|
||
|
tmpvar_25 = clamp (m_24[0], 0.0, 1.0);
|
||
|
vec4 tmpvar_26;
|
||
|
tmpvar_26 = clamp (m_24[1], 0.0, 1.0);
|
||
|
vec4 tmpvar_27;
|
||
|
tmpvar_27 = clamp (m_24[2], 0.0, 1.0);
|
||
|
vec4 tmpvar_28;
|
||
|
tmpvar_28 = clamp (m_24[3], 0.0, 1.0);
|
||
|
mat4 tmpvar_29;
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = tmpvar_25;
|
||
|
tmpvar_29[0] = tmpvar_30;
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31 = tmpvar_26;
|
||
|
tmpvar_29[1] = tmpvar_31;
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = tmpvar_27;
|
||
|
tmpvar_29[2] = tmpvar_32;
|
||
|
vec4 tmpvar_33;
|
||
|
tmpvar_33 = tmpvar_28;
|
||
|
tmpvar_29[3] = tmpvar_33;
|
||
|
return tmpvar_29;
|
||
|
}
|
||
|
|
||
|
void surf (
|
||
|
in Input IN_34,
|
||
|
inout SurfaceOutput o_35
|
||
|
)
|
||
|
{
|
||
|
vec4 c_36;
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = texture2D (_MainTex, IN_34.uv_MainTex);
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = (tmpvar_37 * _Color);
|
||
|
c_36 = tmpvar_38;
|
||
|
vec3 tmpvar_39;
|
||
|
tmpvar_39 = c_36.xyz;
|
||
|
o_35.Albedo = tmpvar_39;
|
||
|
float tmpvar_40;
|
||
|
tmpvar_40 = c_36.w;
|
||
|
o_35.Alpha = tmpvar_40;
|
||
|
}
|
||
|
|
||
|
vec4 LightingLambert_PrePass (
|
||
|
in SurfaceOutput s_41,
|
||
|
in vec4 light_42
|
||
|
)
|
||
|
{
|
||
|
vec4 c_43;
|
||
|
vec3 tmpvar_44;
|
||
|
tmpvar_44 = (s_41.Albedo * light_42.xyz);
|
||
|
c_43.xyz = tmpvar_44.xyz.xyz;
|
||
|
float tmpvar_45;
|
||
|
tmpvar_45 = s_41.Alpha;
|
||
|
c_43.w = vec4(tmpvar_45).w;
|
||
|
return c_43;
|
||
|
}
|
||
|
|
||
|
vec3 DecodeLightmap (
|
||
|
in vec4 color_46
|
||
|
)
|
||
|
{
|
||
|
return (2.0 * color_46.xyz);
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_47
|
||
|
)
|
||
|
{
|
||
|
vec4 col_48;
|
||
|
vec3 lm_49;
|
||
|
vec3 lmIndirect_50;
|
||
|
vec3 lmFull_51;
|
||
|
vec4 light_52;
|
||
|
SurfaceOutput o_53;
|
||
|
Input surfIN_54;
|
||
|
vec2 tmpvar_55;
|
||
|
tmpvar_55 = IN_47.hip_pack0.xy;
|
||
|
surfIN_54.uv_MainTex = tmpvar_55;
|
||
|
vec3 tmpvar_56;
|
||
|
tmpvar_56 = vec3(0.0, 0.0, 0.0);
|
||
|
o_53.Albedo = tmpvar_56;
|
||
|
vec3 tmpvar_57;
|
||
|
tmpvar_57 = vec3(0.0, 0.0, 0.0);
|
||
|
o_53.Emission = tmpvar_57;
|
||
|
float tmpvar_58;
|
||
|
tmpvar_58 = 0.0;
|
||
|
o_53.Specular = tmpvar_58;
|
||
|
float tmpvar_59;
|
||
|
tmpvar_59 = 0.0;
|
||
|
o_53.Alpha = tmpvar_59;
|
||
|
float tmpvar_60;
|
||
|
tmpvar_60 = 0.0;
|
||
|
o_53.Gloss = tmpvar_60;
|
||
|
surf (surfIN_54, o_53);
|
||
|
xll_clip ((o_53.Alpha - _Cutoff));
|
||
|
vec4 tmpvar_61;
|
||
|
tmpvar_61 = texture2DProj (_LightBuffer, IN_47.hip_screen);
|
||
|
vec4 tmpvar_62;
|
||
|
tmpvar_62 = tmpvar_61;
|
||
|
light_52 = tmpvar_62;
|
||
|
vec4 tmpvar_63;
|
||
|
tmpvar_63 = log2 (light_52);
|
||
|
vec4 tmpvar_64;
|
||
|
tmpvar_64 = -(tmpvar_63);
|
||
|
light_52 = tmpvar_64;
|
||
|
vec4 tmpvar_65;
|
||
|
tmpvar_65 = texture2D (unity_Lightmap, IN_47.hip_lmapFade.xy);
|
||
|
vec3 tmpvar_66;
|
||
|
tmpvar_66 = DecodeLightmap (tmpvar_65);
|
||
|
vec3 tmpvar_67;
|
||
|
tmpvar_67 = tmpvar_66;
|
||
|
lmFull_51 = tmpvar_67;
|
||
|
vec4 tmpvar_68;
|
||
|
tmpvar_68 = texture2D (unity_LightmapInd, IN_47.hip_lmapFade.xy);
|
||
|
vec3 tmpvar_69;
|
||
|
tmpvar_69 = DecodeLightmap (tmpvar_68);
|
||
|
vec3 tmpvar_70;
|
||
|
tmpvar_70 = tmpvar_69;
|
||
|
lmIndirect_50 = tmpvar_70;
|
||
|
float tmpvar_71;
|
||
|
tmpvar_71 = xll_saturate (IN_47.hip_lmapFade.z);
|
||
|
vec3 tmpvar_72;
|
||
|
tmpvar_72 = vec3(tmpvar_71);
|
||
|
vec3 tmpvar_73;
|
||
|
tmpvar_73 = mix (lmIndirect_50, lmFull_51, tmpvar_72);
|
||
|
vec3 tmpvar_74;
|
||
|
tmpvar_74 = tmpvar_73;
|
||
|
lm_49 = tmpvar_74;
|
||
|
vec3 tmpvar_75;
|
||
|
tmpvar_75 = (light_52.xyz + lm_49);
|
||
|
light_52.xyz = tmpvar_75.xyz.xyz;
|
||
|
vec4 tmpvar_76;
|
||
|
tmpvar_76 = LightingLambert_PrePass (o_53, light_52);
|
||
|
vec4 tmpvar_77;
|
||
|
tmpvar_77 = tmpvar_76;
|
||
|
col_48 = tmpvar_77;
|
||
|
return col_48;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_78;
|
||
|
vec4 xl_retval_79;
|
||
|
vec4 tmpvar_80;
|
||
|
tmpvar_80 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_78.pos = tmpvar_80;
|
||
|
float tmpvar_81;
|
||
|
tmpvar_81 = xlv_FOG.x;
|
||
|
xlt_IN_78.fog = tmpvar_81;
|
||
|
vec2 tmpvar_82;
|
||
|
tmpvar_82 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_83;
|
||
|
tmpvar_83 = tmpvar_82;
|
||
|
xlt_IN_78.hip_pack0 = tmpvar_83;
|
||
|
vec4 tmpvar_84;
|
||
|
tmpvar_84 = gl_TexCoord[1].xyzw;
|
||
|
vec4 tmpvar_85;
|
||
|
tmpvar_85 = tmpvar_84;
|
||
|
xlt_IN_78.hip_screen = tmpvar_85;
|
||
|
vec3 tmpvar_86;
|
||
|
tmpvar_86 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_87;
|
||
|
tmpvar_87 = tmpvar_86;
|
||
|
xlt_IN_78.hip_lmapFade = tmpvar_87;
|
||
|
vec4 tmpvar_88;
|
||
|
tmpvar_88 = frag_surf (xlt_IN_78);
|
||
|
vec4 tmpvar_89;
|
||
|
tmpvar_89 = tmpvar_88;
|
||
|
xl_retval_79 = tmpvar_89;
|
||
|
vec4 tmpvar_90;
|
||
|
tmpvar_90 = xl_retval_79.xyzw;
|
||
|
vec4 tmpvar_91;
|
||
|
tmpvar_91 = tmpvar_90;
|
||
|
gl_FragData[0] = tmpvar_91;
|
||
|
}
|
||
|
|