mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
271 lines
5.3 KiB
Text
271 lines
5.3 KiB
Text
|
struct SurfaceOutput {
|
||
|
vec3 Albedo;
|
||
|
vec3 Normal;
|
||
|
vec3 Emission;
|
||
|
float Specular;
|
||
|
float Gloss;
|
||
|
float Alpha;
|
||
|
};
|
||
|
struct Input {
|
||
|
vec3 foo;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec3 cust_foo;
|
||
|
vec4 hip_screen;
|
||
|
vec3 hip_lmapFade;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform sampler2D unity_LightmapInd;
|
||
|
uniform sampler2D unity_Lightmap;
|
||
|
uniform sampler2D _LightBuffer;
|
||
|
float xll_saturate (
|
||
|
in float x_1
|
||
|
)
|
||
|
{
|
||
|
float tmpvar_2;
|
||
|
tmpvar_2 = clamp (x_1, 0.0, 1.0);
|
||
|
return tmpvar_2;
|
||
|
}
|
||
|
|
||
|
vec2 xll_saturate (
|
||
|
in vec2 x_3
|
||
|
)
|
||
|
{
|
||
|
vec2 tmpvar_4;
|
||
|
tmpvar_4 = clamp (x_3, 0.0, 1.0);
|
||
|
return tmpvar_4;
|
||
|
}
|
||
|
|
||
|
vec3 xll_saturate (
|
||
|
in vec3 x_5
|
||
|
)
|
||
|
{
|
||
|
vec3 tmpvar_6;
|
||
|
tmpvar_6 = clamp (x_5, 0.0, 1.0);
|
||
|
return tmpvar_6;
|
||
|
}
|
||
|
|
||
|
vec4 xll_saturate (
|
||
|
in vec4 x_7
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_8;
|
||
|
tmpvar_8 = clamp (x_7, 0.0, 1.0);
|
||
|
return tmpvar_8;
|
||
|
}
|
||
|
|
||
|
mat2 xll_saturate (
|
||
|
in mat2 m_9
|
||
|
)
|
||
|
{
|
||
|
vec2 tmpvar_10;
|
||
|
tmpvar_10 = clamp (m_9[0], 0.0, 1.0);
|
||
|
vec2 tmpvar_11;
|
||
|
tmpvar_11 = clamp (m_9[1], 0.0, 1.0);
|
||
|
mat2 tmpvar_12;
|
||
|
vec2 tmpvar_13;
|
||
|
tmpvar_13 = tmpvar_10;
|
||
|
tmpvar_12[0] = tmpvar_13;
|
||
|
vec2 tmpvar_14;
|
||
|
tmpvar_14 = tmpvar_11;
|
||
|
tmpvar_12[1] = tmpvar_14;
|
||
|
return tmpvar_12;
|
||
|
}
|
||
|
|
||
|
mat3 xll_saturate (
|
||
|
in mat3 m_15
|
||
|
)
|
||
|
{
|
||
|
vec3 tmpvar_16;
|
||
|
tmpvar_16 = clamp (m_15[0], 0.0, 1.0);
|
||
|
vec3 tmpvar_17;
|
||
|
tmpvar_17 = clamp (m_15[1], 0.0, 1.0);
|
||
|
vec3 tmpvar_18;
|
||
|
tmpvar_18 = clamp (m_15[2], 0.0, 1.0);
|
||
|
mat3 tmpvar_19;
|
||
|
vec3 tmpvar_20;
|
||
|
tmpvar_20 = tmpvar_16;
|
||
|
tmpvar_19[0] = tmpvar_20;
|
||
|
vec3 tmpvar_21;
|
||
|
tmpvar_21 = tmpvar_17;
|
||
|
tmpvar_19[1] = tmpvar_21;
|
||
|
vec3 tmpvar_22;
|
||
|
tmpvar_22 = tmpvar_18;
|
||
|
tmpvar_19[2] = tmpvar_22;
|
||
|
return tmpvar_19;
|
||
|
}
|
||
|
|
||
|
mat4 xll_saturate (
|
||
|
in mat4 m_23
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_24;
|
||
|
tmpvar_24 = clamp (m_23[0], 0.0, 1.0);
|
||
|
vec4 tmpvar_25;
|
||
|
tmpvar_25 = clamp (m_23[1], 0.0, 1.0);
|
||
|
vec4 tmpvar_26;
|
||
|
tmpvar_26 = clamp (m_23[2], 0.0, 1.0);
|
||
|
vec4 tmpvar_27;
|
||
|
tmpvar_27 = clamp (m_23[3], 0.0, 1.0);
|
||
|
mat4 tmpvar_28;
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29 = tmpvar_24;
|
||
|
tmpvar_28[0] = tmpvar_29;
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = tmpvar_25;
|
||
|
tmpvar_28[1] = tmpvar_30;
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31 = tmpvar_26;
|
||
|
tmpvar_28[2] = tmpvar_31;
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = tmpvar_27;
|
||
|
tmpvar_28[3] = tmpvar_32;
|
||
|
return tmpvar_28;
|
||
|
}
|
||
|
|
||
|
void surf (
|
||
|
in Input IN_33,
|
||
|
inout SurfaceOutput o_34
|
||
|
)
|
||
|
{
|
||
|
vec3 tmpvar_35;
|
||
|
tmpvar_35 = IN_33.foo;
|
||
|
o_34.Albedo = tmpvar_35;
|
||
|
}
|
||
|
|
||
|
vec4 LightingLambert_PrePass (
|
||
|
in SurfaceOutput s_36,
|
||
|
in vec4 light_37
|
||
|
)
|
||
|
{
|
||
|
vec4 c_38;
|
||
|
vec3 tmpvar_39;
|
||
|
tmpvar_39 = (s_36.Albedo * light_37.xyz);
|
||
|
c_38.xyz = tmpvar_39.xyz.xyz;
|
||
|
float tmpvar_40;
|
||
|
tmpvar_40 = s_36.Alpha;
|
||
|
c_38.w = vec4(tmpvar_40).w;
|
||
|
return c_38;
|
||
|
}
|
||
|
|
||
|
vec3 DecodeLightmap (
|
||
|
in vec4 color_41
|
||
|
)
|
||
|
{
|
||
|
return (2.0 * color_41.xyz);
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_42
|
||
|
)
|
||
|
{
|
||
|
vec4 col_43;
|
||
|
vec3 lm_44;
|
||
|
vec3 lmIndirect_45;
|
||
|
vec3 lmFull_46;
|
||
|
vec4 light_47;
|
||
|
SurfaceOutput o_48;
|
||
|
Input surfIN_49;
|
||
|
vec3 tmpvar_50;
|
||
|
tmpvar_50 = IN_42.cust_foo;
|
||
|
surfIN_49.foo = tmpvar_50;
|
||
|
vec3 tmpvar_51;
|
||
|
tmpvar_51 = vec3(0.0, 0.0, 0.0);
|
||
|
o_48.Albedo = tmpvar_51;
|
||
|
vec3 tmpvar_52;
|
||
|
tmpvar_52 = vec3(0.0, 0.0, 0.0);
|
||
|
o_48.Emission = tmpvar_52;
|
||
|
float tmpvar_53;
|
||
|
tmpvar_53 = 0.0;
|
||
|
o_48.Specular = tmpvar_53;
|
||
|
float tmpvar_54;
|
||
|
tmpvar_54 = 0.0;
|
||
|
o_48.Alpha = tmpvar_54;
|
||
|
float tmpvar_55;
|
||
|
tmpvar_55 = 0.0;
|
||
|
o_48.Gloss = tmpvar_55;
|
||
|
surf (surfIN_49, o_48);
|
||
|
vec4 tmpvar_56;
|
||
|
tmpvar_56 = texture2DProj (_LightBuffer, IN_42.hip_screen);
|
||
|
vec4 tmpvar_57;
|
||
|
tmpvar_57 = tmpvar_56;
|
||
|
light_47 = tmpvar_57;
|
||
|
vec4 tmpvar_58;
|
||
|
tmpvar_58 = log2 (light_47);
|
||
|
vec4 tmpvar_59;
|
||
|
tmpvar_59 = -(tmpvar_58);
|
||
|
light_47 = tmpvar_59;
|
||
|
vec4 tmpvar_60;
|
||
|
tmpvar_60 = texture2D (unity_Lightmap, IN_42.hip_lmapFade.xy);
|
||
|
vec3 tmpvar_61;
|
||
|
tmpvar_61 = DecodeLightmap (tmpvar_60);
|
||
|
vec3 tmpvar_62;
|
||
|
tmpvar_62 = tmpvar_61;
|
||
|
lmFull_46 = tmpvar_62;
|
||
|
vec4 tmpvar_63;
|
||
|
tmpvar_63 = texture2D (unity_LightmapInd, IN_42.hip_lmapFade.xy);
|
||
|
vec3 tmpvar_64;
|
||
|
tmpvar_64 = DecodeLightmap (tmpvar_63);
|
||
|
vec3 tmpvar_65;
|
||
|
tmpvar_65 = tmpvar_64;
|
||
|
lmIndirect_45 = tmpvar_65;
|
||
|
float tmpvar_66;
|
||
|
tmpvar_66 = xll_saturate (IN_42.hip_lmapFade.z);
|
||
|
vec3 tmpvar_67;
|
||
|
tmpvar_67 = vec3(tmpvar_66);
|
||
|
vec3 tmpvar_68;
|
||
|
tmpvar_68 = mix (lmIndirect_45, lmFull_46, tmpvar_67);
|
||
|
vec3 tmpvar_69;
|
||
|
tmpvar_69 = tmpvar_68;
|
||
|
lm_44 = tmpvar_69;
|
||
|
vec3 tmpvar_70;
|
||
|
tmpvar_70 = (light_47.xyz + lm_44);
|
||
|
light_47.xyz = tmpvar_70.xyz.xyz;
|
||
|
vec4 tmpvar_71;
|
||
|
tmpvar_71 = LightingLambert_PrePass (o_48, light_47);
|
||
|
vec4 tmpvar_72;
|
||
|
tmpvar_72 = tmpvar_71;
|
||
|
col_43 = tmpvar_72;
|
||
|
return col_43;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_73;
|
||
|
vec4 xl_retval_74;
|
||
|
vec4 tmpvar_75;
|
||
|
tmpvar_75 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_73.pos = tmpvar_75;
|
||
|
float tmpvar_76;
|
||
|
tmpvar_76 = xlv_FOG.x;
|
||
|
xlt_IN_73.fog = tmpvar_76;
|
||
|
vec3 tmpvar_77;
|
||
|
tmpvar_77 = gl_TexCoord[0].xyz;
|
||
|
vec3 tmpvar_78;
|
||
|
tmpvar_78 = tmpvar_77;
|
||
|
xlt_IN_73.cust_foo = tmpvar_78;
|
||
|
vec4 tmpvar_79;
|
||
|
tmpvar_79 = gl_TexCoord[1].xyzw;
|
||
|
vec4 tmpvar_80;
|
||
|
tmpvar_80 = tmpvar_79;
|
||
|
xlt_IN_73.hip_screen = tmpvar_80;
|
||
|
vec3 tmpvar_81;
|
||
|
tmpvar_81 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_82;
|
||
|
tmpvar_82 = tmpvar_81;
|
||
|
xlt_IN_73.hip_lmapFade = tmpvar_82;
|
||
|
vec4 tmpvar_83;
|
||
|
tmpvar_83 = frag_surf (xlt_IN_73);
|
||
|
vec4 tmpvar_84;
|
||
|
tmpvar_84 = tmpvar_83;
|
||
|
xl_retval_74 = tmpvar_84;
|
||
|
vec4 tmpvar_85;
|
||
|
tmpvar_85 = xl_retval_74.xyzw;
|
||
|
vec4 tmpvar_86;
|
||
|
tmpvar_86 = tmpvar_85;
|
||
|
gl_FragData[0] = tmpvar_86;
|
||
|
}
|
||
|
|