mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 11:05:36 -05:00
170 lines
3.7 KiB
Text
170 lines
3.7 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 sampler2D _BumpMap;
|
|
uniform vec4 _Color;
|
|
uniform sampler2D _Illum;
|
|
uniform sampler2D _MainTex;
|
|
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 = c_8.w;
|
|
o_7.Alpha = tmpvar_16;
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = texture2D (_BumpMap, IN_6.uv_BumpMap);
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = UnpackNormal (tmpvar_17);
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = tmpvar_18.xyz;
|
|
vec3 tmpvar_20;
|
|
tmpvar_20 = tmpvar_19;
|
|
o_7.Normal = tmpvar_20;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_21
|
|
)
|
|
{
|
|
vec4 res_22;
|
|
vec3 viewN_23;
|
|
SurfaceOutput o_24;
|
|
Input surfIN_25;
|
|
vec2 tmpvar_26;
|
|
tmpvar_26 = IN_21.hip_pack0.xy;
|
|
surfIN_25.uv_BumpMap = tmpvar_26;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = vec3(0.0, 0.0, 0.0);
|
|
o_24.Albedo = tmpvar_27;
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = vec3(0.0, 0.0, 0.0);
|
|
o_24.Emission = tmpvar_28;
|
|
float tmpvar_29;
|
|
tmpvar_29 = 0.0;
|
|
o_24.Specular = tmpvar_29;
|
|
float tmpvar_30;
|
|
tmpvar_30 = 0.0;
|
|
o_24.Alpha = tmpvar_30;
|
|
float tmpvar_31;
|
|
tmpvar_31 = 0.0;
|
|
o_24.Gloss = tmpvar_31;
|
|
surf (surfIN_25, o_24);
|
|
float tmpvar_32;
|
|
tmpvar_32 = dot (IN_21.TtoV0, o_24.Normal);
|
|
float tmpvar_33;
|
|
tmpvar_33 = tmpvar_32;
|
|
viewN_23.x = tmpvar_33;
|
|
float tmpvar_34;
|
|
tmpvar_34 = dot (IN_21.TtoV1, o_24.Normal);
|
|
float tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
viewN_23.y = vec2(tmpvar_35).y;
|
|
float tmpvar_36;
|
|
tmpvar_36 = dot (IN_21.TtoV2, o_24.Normal);
|
|
float tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
viewN_23.z = vec3(tmpvar_37).z;
|
|
vec3 tmpvar_38;
|
|
tmpvar_38 = viewN_23;
|
|
o_24.Normal = tmpvar_38;
|
|
vec3 tmpvar_39;
|
|
tmpvar_39 = ((o_24.Normal * vec3(0.5, 0.5, -0.5)) + 0.5);
|
|
res_22.xyz = tmpvar_39.xyz.xyz;
|
|
float tmpvar_40;
|
|
tmpvar_40 = o_24.Specular;
|
|
res_22.w = vec4(tmpvar_40).w;
|
|
return res_22;
|
|
}
|
|
|
|
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;
|
|
vec2 tmpvar_44;
|
|
tmpvar_44 = gl_TexCoord[0].xy;
|
|
vec2 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;
|
|
}
|
|
|