mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
180 lines
3.8 KiB
Text
180 lines
3.8 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec2 uv_MainTex;
|
|
vec2 uv_BumpMap;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
vec4 hip_pack0;
|
|
vec3 TtoV0;
|
|
vec3 TtoV1;
|
|
vec3 TtoV2;
|
|
};
|
|
uniform float _Shininess;
|
|
uniform sampler2D _MainTex;
|
|
uniform float _Cutoff;
|
|
uniform vec4 _Color;
|
|
uniform sampler2D _BumpMap;
|
|
void xll_clip (
|
|
in float x_1
|
|
)
|
|
{
|
|
if ((x_1 < 0.0)) {
|
|
discard;
|
|
};
|
|
}
|
|
|
|
vec4 UnpackNormal (
|
|
in vec4 packednormal_2
|
|
)
|
|
{
|
|
vec4 normal_3;
|
|
vec2 tmpvar_4;
|
|
tmpvar_4 = ((packednormal_2.wy * 2.0) - 1.0);
|
|
normal_3.xy = tmpvar_4.xy.xy;
|
|
float tmpvar_5;
|
|
tmpvar_5 = sqrt (((1.0 - (normal_3.x * normal_3.x)) - (normal_3.y * normal_3.y)));
|
|
float tmpvar_6;
|
|
tmpvar_6 = tmpvar_5;
|
|
normal_3.z = vec3(tmpvar_6).z;
|
|
return normal_3;
|
|
}
|
|
|
|
void surf (
|
|
in Input IN_7,
|
|
inout SurfaceOutput o_8
|
|
)
|
|
{
|
|
vec4 tex_9;
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = texture2D (_MainTex, IN_7.uv_MainTex);
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = tmpvar_10;
|
|
tex_9 = tmpvar_11;
|
|
vec3 tmpvar_12;
|
|
tmpvar_12 = (tex_9.xyz * _Color.xyz);
|
|
o_8.Albedo = tmpvar_12;
|
|
float tmpvar_13;
|
|
tmpvar_13 = tex_9.w;
|
|
o_8.Gloss = tmpvar_13;
|
|
float tmpvar_14;
|
|
tmpvar_14 = (tex_9.w * _Color.w);
|
|
o_8.Alpha = tmpvar_14;
|
|
float tmpvar_15;
|
|
tmpvar_15 = _Shininess;
|
|
o_8.Specular = tmpvar_15;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16 = texture2D (_BumpMap, IN_7.uv_BumpMap);
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = UnpackNormal (tmpvar_16);
|
|
vec3 tmpvar_18;
|
|
tmpvar_18 = tmpvar_17.xyz;
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = tmpvar_18;
|
|
o_8.Normal = tmpvar_19;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_20
|
|
)
|
|
{
|
|
vec4 res_21;
|
|
vec3 viewN_22;
|
|
SurfaceOutput o_23;
|
|
Input surfIN_24;
|
|
vec2 tmpvar_25;
|
|
tmpvar_25 = IN_20.hip_pack0.xy;
|
|
surfIN_24.uv_MainTex = tmpvar_25;
|
|
vec2 tmpvar_26;
|
|
tmpvar_26 = IN_20.hip_pack0.zw;
|
|
surfIN_24.uv_BumpMap = 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);
|
|
xll_clip ((o_23.Alpha - _Cutoff));
|
|
float tmpvar_32;
|
|
tmpvar_32 = dot (IN_20.TtoV0, o_23.Normal);
|
|
float tmpvar_33;
|
|
tmpvar_33 = tmpvar_32;
|
|
viewN_22.x = tmpvar_33;
|
|
float tmpvar_34;
|
|
tmpvar_34 = dot (IN_20.TtoV1, o_23.Normal);
|
|
float tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
viewN_22.y = vec2(tmpvar_35).y;
|
|
float tmpvar_36;
|
|
tmpvar_36 = dot (IN_20.TtoV2, o_23.Normal);
|
|
float tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
viewN_22.z = vec3(tmpvar_37).z;
|
|
vec3 tmpvar_38;
|
|
tmpvar_38 = viewN_22;
|
|
o_23.Normal = tmpvar_38;
|
|
vec3 tmpvar_39;
|
|
tmpvar_39 = ((o_23.Normal * vec3(0.5, 0.5, -0.5)) + 0.5);
|
|
res_21.xyz = tmpvar_39.xyz.xyz;
|
|
float tmpvar_40;
|
|
tmpvar_40 = o_23.Specular;
|
|
res_21.w = vec4(tmpvar_40).w;
|
|
return res_21;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_41;
|
|
vec4 xl_retval_42;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_41.pos = tmpvar_43;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = gl_TexCoord[0].xyzw;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = tmpvar_44;
|
|
xlt_IN_41.hip_pack0 = tmpvar_45;
|
|
vec3 tmpvar_46;
|
|
tmpvar_46 = gl_TexCoord[1].xyz;
|
|
vec3 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
xlt_IN_41.TtoV0 = tmpvar_47;
|
|
vec3 tmpvar_48;
|
|
tmpvar_48 = gl_TexCoord[2].xyz;
|
|
vec3 tmpvar_49;
|
|
tmpvar_49 = tmpvar_48;
|
|
xlt_IN_41.TtoV1 = tmpvar_49;
|
|
vec3 tmpvar_50;
|
|
tmpvar_50 = gl_TexCoord[3].xyz;
|
|
vec3 tmpvar_51;
|
|
tmpvar_51 = tmpvar_50;
|
|
xlt_IN_41.TtoV2 = tmpvar_51;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = frag_surf (xlt_IN_41);
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = tmpvar_52;
|
|
xl_retval_42 = tmpvar_53;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = xl_retval_42.xyzw;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55 = tmpvar_54;
|
|
gl_FragData[0] = tmpvar_55;
|
|
}
|
|
|