mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
122 lines
2.5 KiB
Text
122 lines
2.5 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec2 uv_MainTex;
|
|
vec4 color;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
};
|
|
uniform sampler2D _BumpSpecMap;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _TranslucencyMap;
|
|
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 norspc_8;
|
|
vec4 trngls_9;
|
|
vec4 c_10;
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = texture2D (_MainTex, IN_6.uv_MainTex);
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = tmpvar_11;
|
|
c_10 = tmpvar_12;
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = (c_10.xyz * IN_6.color.xyz);
|
|
o_7.Albedo = tmpvar_13;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = texture2D (_TranslucencyMap, IN_6.uv_MainTex);
|
|
vec4 tmpvar_15;
|
|
tmpvar_15 = tmpvar_14;
|
|
trngls_9 = tmpvar_15;
|
|
float tmpvar_16;
|
|
tmpvar_16 = trngls_9.w;
|
|
o_7.Gloss = tmpvar_16;
|
|
float tmpvar_17;
|
|
tmpvar_17 = IN_6.color.w;
|
|
o_7.Alpha = tmpvar_17;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = texture2D (_BumpSpecMap, IN_6.uv_MainTex);
|
|
vec4 tmpvar_19;
|
|
tmpvar_19 = tmpvar_18;
|
|
norspc_8 = tmpvar_19;
|
|
float tmpvar_20;
|
|
tmpvar_20 = norspc_8.x;
|
|
o_7.Specular = tmpvar_20;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = UnpackNormal (norspc_8);
|
|
vec3 tmpvar_22;
|
|
tmpvar_22 = tmpvar_21.xyz;
|
|
vec3 tmpvar_23;
|
|
tmpvar_23 = tmpvar_22;
|
|
o_7.Normal = tmpvar_23;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_24
|
|
)
|
|
{
|
|
Input surfIN_25;
|
|
SurfaceOutput o_26;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = vec3(0.0, 0.0, 0.0);
|
|
o_26.Albedo = tmpvar_27;
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = vec3(0.0, 0.0, 0.0);
|
|
o_26.Emission = tmpvar_28;
|
|
float tmpvar_29;
|
|
tmpvar_29 = 0.0;
|
|
o_26.Specular = tmpvar_29;
|
|
float tmpvar_30;
|
|
tmpvar_30 = 0.0;
|
|
o_26.Alpha = tmpvar_30;
|
|
float tmpvar_31;
|
|
tmpvar_31 = 0.0;
|
|
o_26.Gloss = tmpvar_31;
|
|
surf (surfIN_25, o_26);
|
|
return vec4(0.0, 0.0, 0.0, 0.0);
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_32;
|
|
vec4 xl_retval_33;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_32.pos = tmpvar_34;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = frag_surf (xlt_IN_32);
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = tmpvar_35;
|
|
xl_retval_33 = tmpvar_36;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = xl_retval_33.xyzw;
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
gl_FragData[0] = tmpvar_38;
|
|
}
|
|
|