mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
177 lines
3.8 KiB
Text
177 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_Illum;
|
|
vec2 uv_BumpMap;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
vec2 hip_pack0;
|
|
vec3 TtoV0;
|
|
vec3 TtoV1;
|
|
vec3 TtoV2;
|
|
};
|
|
uniform float _Shininess;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _Illum;
|
|
uniform vec4 _Color;
|
|
uniform sampler2D _BumpMap;
|
|
vec4 UnpackNormal (
|
|
in vec4 packednormal_1
|
|
)
|
|
{
|
|
vec4 normal_2;
|
|
vec2 tmpvar_3;
|
|
tmpvar_3 = ((packednormal_1.wy * 2.0) - 1.0);
|
|
normal_2.xy = tmpvar_3.xy.xy;
|
|
float tmpvar_4;
|
|
tmpvar_4 = sqrt (((1.0 - (normal_2.x * normal_2.x)) - (normal_2.y * normal_2.y)));
|
|
float tmpvar_5;
|
|
tmpvar_5 = tmpvar_4;
|
|
normal_2.z = vec3(tmpvar_5).z;
|
|
return normal_2;
|
|
}
|
|
|
|
void surf (
|
|
in Input IN_6,
|
|
inout SurfaceOutput o_7
|
|
)
|
|
{
|
|
vec4 c_8;
|
|
vec4 tex_9;
|
|
vec4 tmpvar_10;
|
|
tmpvar_10 = texture2D (_MainTex, IN_6.uv_MainTex);
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = tmpvar_10;
|
|
tex_9 = tmpvar_11;
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = (tex_9 * _Color);
|
|
c_8 = tmpvar_12;
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = c_8.xyz;
|
|
o_7.Albedo = tmpvar_13;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = texture2D (_Illum, IN_6.uv_Illum);
|
|
vec3 tmpvar_15;
|
|
tmpvar_15 = (c_8.xyz * tmpvar_14.w);
|
|
o_7.Emission = tmpvar_15;
|
|
float tmpvar_16;
|
|
tmpvar_16 = tex_9.w;
|
|
o_7.Gloss = tmpvar_16;
|
|
float tmpvar_17;
|
|
tmpvar_17 = c_8.w;
|
|
o_7.Alpha = tmpvar_17;
|
|
float tmpvar_18;
|
|
tmpvar_18 = _Shininess;
|
|
o_7.Specular = tmpvar_18;
|
|
vec4 tmpvar_19;
|
|
tmpvar_19 = texture2D (_BumpMap, IN_6.uv_BumpMap);
|
|
vec4 tmpvar_20;
|
|
tmpvar_20 = UnpackNormal (tmpvar_19);
|
|
vec3 tmpvar_21;
|
|
tmpvar_21 = tmpvar_20.xyz;
|
|
vec3 tmpvar_22;
|
|
tmpvar_22 = tmpvar_21;
|
|
o_7.Normal = tmpvar_22;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_23
|
|
)
|
|
{
|
|
vec4 res_24;
|
|
vec3 viewN_25;
|
|
SurfaceOutput o_26;
|
|
Input surfIN_27;
|
|
vec2 tmpvar_28;
|
|
tmpvar_28 = IN_23.hip_pack0.xy;
|
|
surfIN_27.uv_BumpMap = tmpvar_28;
|
|
vec3 tmpvar_29;
|
|
tmpvar_29 = vec3(0.0, 0.0, 0.0);
|
|
o_26.Albedo = tmpvar_29;
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = vec3(0.0, 0.0, 0.0);
|
|
o_26.Emission = tmpvar_30;
|
|
float tmpvar_31;
|
|
tmpvar_31 = 0.0;
|
|
o_26.Specular = tmpvar_31;
|
|
float tmpvar_32;
|
|
tmpvar_32 = 0.0;
|
|
o_26.Alpha = tmpvar_32;
|
|
float tmpvar_33;
|
|
tmpvar_33 = 0.0;
|
|
o_26.Gloss = tmpvar_33;
|
|
surf (surfIN_27, o_26);
|
|
float tmpvar_34;
|
|
tmpvar_34 = dot (IN_23.TtoV0, o_26.Normal);
|
|
float tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
viewN_25.x = tmpvar_35;
|
|
float tmpvar_36;
|
|
tmpvar_36 = dot (IN_23.TtoV1, o_26.Normal);
|
|
float tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
viewN_25.y = vec2(tmpvar_37).y;
|
|
float tmpvar_38;
|
|
tmpvar_38 = dot (IN_23.TtoV2, o_26.Normal);
|
|
float tmpvar_39;
|
|
tmpvar_39 = tmpvar_38;
|
|
viewN_25.z = vec3(tmpvar_39).z;
|
|
vec3 tmpvar_40;
|
|
tmpvar_40 = viewN_25;
|
|
o_26.Normal = tmpvar_40;
|
|
vec3 tmpvar_41;
|
|
tmpvar_41 = ((o_26.Normal * vec3(0.5, 0.5, -0.5)) + 0.5);
|
|
res_24.xyz = tmpvar_41.xyz.xyz;
|
|
float tmpvar_42;
|
|
tmpvar_42 = o_26.Specular;
|
|
res_24.w = vec4(tmpvar_42).w;
|
|
return res_24;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_43;
|
|
vec4 xl_retval_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_43.pos = tmpvar_45;
|
|
vec2 tmpvar_46;
|
|
tmpvar_46 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
xlt_IN_43.hip_pack0 = tmpvar_47;
|
|
vec3 tmpvar_48;
|
|
tmpvar_48 = gl_TexCoord[1].xyz;
|
|
vec3 tmpvar_49;
|
|
tmpvar_49 = tmpvar_48;
|
|
xlt_IN_43.TtoV0 = tmpvar_49;
|
|
vec3 tmpvar_50;
|
|
tmpvar_50 = gl_TexCoord[2].xyz;
|
|
vec3 tmpvar_51;
|
|
tmpvar_51 = tmpvar_50;
|
|
xlt_IN_43.TtoV1 = tmpvar_51;
|
|
vec3 tmpvar_52;
|
|
tmpvar_52 = gl_TexCoord[3].xyz;
|
|
vec3 tmpvar_53;
|
|
tmpvar_53 = tmpvar_52;
|
|
xlt_IN_43.TtoV2 = tmpvar_53;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = frag_surf (xlt_IN_43);
|
|
vec4 tmpvar_55;
|
|
tmpvar_55 = tmpvar_54;
|
|
xl_retval_44 = tmpvar_55;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = xl_retval_44.xyzw;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57 = tmpvar_56;
|
|
gl_FragData[0] = tmpvar_57;
|
|
}
|
|
|