mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
122 lines
2.3 KiB
Text
122 lines
2.3 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 _TranslucencyMap;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _BumpSpecMap;
|
|
vec4 UnpackNormal (
|
|
in vec4 packednormal
|
|
)
|
|
{
|
|
vec4 normal;
|
|
vec2 tmpvar_1;
|
|
tmpvar_1 = ((packednormal.wy * 2.0) - 1.0);
|
|
normal.xy = tmpvar_1.xy.xy;
|
|
float tmpvar_2;
|
|
tmpvar_2 = sqrt (((1.0 - (normal.x * normal.x)) - (normal.y * normal.y)));
|
|
float tmpvar_3;
|
|
tmpvar_3 = tmpvar_2;
|
|
normal.z = vec3(tmpvar_3).z;
|
|
return normal;
|
|
}
|
|
|
|
void surf (
|
|
in Input IN,
|
|
inout SurfaceOutput o
|
|
)
|
|
{
|
|
vec4 norspc;
|
|
vec4 trngls;
|
|
vec4 c;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = texture2D (_MainTex, IN.uv_MainTex);
|
|
vec4 tmpvar_2;
|
|
tmpvar_2 = tmpvar_1;
|
|
c = tmpvar_2;
|
|
vec3 tmpvar_3;
|
|
tmpvar_3 = (c.xyz * IN.color.xyz);
|
|
o.Albedo = tmpvar_3;
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = texture2D (_TranslucencyMap, IN.uv_MainTex);
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = tmpvar_4;
|
|
trngls = tmpvar_5;
|
|
float tmpvar_6;
|
|
tmpvar_6 = trngls.w;
|
|
o.Gloss = tmpvar_6;
|
|
float tmpvar_7;
|
|
tmpvar_7 = IN.color.w;
|
|
o.Alpha = tmpvar_7;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = texture2D (_BumpSpecMap, IN.uv_MainTex);
|
|
vec4 tmpvar_9;
|
|
tmpvar_9 = tmpvar_8;
|
|
norspc = tmpvar_9;
|
|
float tmpvar_10;
|
|
tmpvar_10 = norspc.x;
|
|
o.Specular = tmpvar_10;
|
|
vec4 tmpvar_11;
|
|
tmpvar_11 = UnpackNormal (norspc);
|
|
vec3 tmpvar_12;
|
|
tmpvar_12 = tmpvar_11.xyz;
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = tmpvar_12;
|
|
o.Normal = tmpvar_13;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN
|
|
)
|
|
{
|
|
Input surfIN;
|
|
SurfaceOutput o;
|
|
vec3 tmpvar_1;
|
|
tmpvar_1 = vec3(0.0, 0.0, 0.0);
|
|
o.Albedo = tmpvar_1;
|
|
vec3 tmpvar_2;
|
|
tmpvar_2 = vec3(0.0, 0.0, 0.0);
|
|
o.Emission = tmpvar_2;
|
|
float tmpvar_3;
|
|
tmpvar_3 = 0.0;
|
|
o.Specular = tmpvar_3;
|
|
float tmpvar_4;
|
|
tmpvar_4 = 0.0;
|
|
o.Alpha = tmpvar_4;
|
|
float tmpvar_5;
|
|
tmpvar_5 = 0.0;
|
|
o.Gloss = tmpvar_5;
|
|
surf (surfIN, o);
|
|
return vec4(0.0, 0.0, 0.0, 0.0);
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN;
|
|
vec4 xl_retval;
|
|
vec4 tmpvar_1;
|
|
tmpvar_1 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN.pos = tmpvar_1;
|
|
vec4 tmpvar_2;
|
|
tmpvar_2 = frag_surf (xlt_IN);
|
|
vec4 tmpvar_3;
|
|
tmpvar_3 = tmpvar_2;
|
|
xl_retval = tmpvar_3;
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = xl_retval.xyzw;
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = tmpvar_4;
|
|
gl_FragData[0] = tmpvar_5;
|
|
}
|
|
|