mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
145 lines
3 KiB
Text
145 lines
3 KiB
Text
|
struct SurfaceOutput {
|
||
|
vec3 Albedo;
|
||
|
vec3 Normal;
|
||
|
vec3 Emission;
|
||
|
float Specular;
|
||
|
float Gloss;
|
||
|
float Alpha;
|
||
|
};
|
||
|
struct Input {
|
||
|
vec3 foo;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec3 cust_foo;
|
||
|
vec3 normal;
|
||
|
vec3 lightDir;
|
||
|
vec2 _LightCoord;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform sampler2D _LightTexture0;
|
||
|
uniform vec4 _LightColor0;
|
||
|
void surf (
|
||
|
in Input IN_1,
|
||
|
inout SurfaceOutput o_2
|
||
|
)
|
||
|
{
|
||
|
vec3 tmpvar_3;
|
||
|
tmpvar_3 = IN_1.foo;
|
||
|
o_2.Albedo = tmpvar_3;
|
||
|
}
|
||
|
|
||
|
vec4 LightingLambert (
|
||
|
in SurfaceOutput s_4,
|
||
|
in vec3 lightDir_5,
|
||
|
in float atten_6
|
||
|
)
|
||
|
{
|
||
|
vec4 c_7;
|
||
|
float diff_8;
|
||
|
float tmpvar_9;
|
||
|
tmpvar_9 = dot (s_4.Normal, lightDir_5);
|
||
|
float tmpvar_10;
|
||
|
tmpvar_10 = max (0.0, tmpvar_9);
|
||
|
float tmpvar_11;
|
||
|
tmpvar_11 = tmpvar_10;
|
||
|
diff_8 = tmpvar_11;
|
||
|
vec3 tmpvar_12;
|
||
|
tmpvar_12 = ((s_4.Albedo * _LightColor0.xyz) * ((diff_8 * atten_6) * 2.0));
|
||
|
c_7.xyz = tmpvar_12.xyz.xyz;
|
||
|
float tmpvar_13;
|
||
|
tmpvar_13 = s_4.Alpha;
|
||
|
c_7.w = vec4(tmpvar_13).w;
|
||
|
return c_7;
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_14
|
||
|
)
|
||
|
{
|
||
|
vec4 c_15;
|
||
|
vec3 lightDir_16;
|
||
|
SurfaceOutput o_17;
|
||
|
Input surfIN_18;
|
||
|
vec3 tmpvar_19;
|
||
|
tmpvar_19 = IN_14.cust_foo;
|
||
|
surfIN_18.foo = tmpvar_19;
|
||
|
vec3 tmpvar_20;
|
||
|
tmpvar_20 = vec3(0.0, 0.0, 0.0);
|
||
|
o_17.Albedo = tmpvar_20;
|
||
|
vec3 tmpvar_21;
|
||
|
tmpvar_21 = vec3(0.0, 0.0, 0.0);
|
||
|
o_17.Emission = tmpvar_21;
|
||
|
float tmpvar_22;
|
||
|
tmpvar_22 = 0.0;
|
||
|
o_17.Specular = tmpvar_22;
|
||
|
float tmpvar_23;
|
||
|
tmpvar_23 = 0.0;
|
||
|
o_17.Alpha = tmpvar_23;
|
||
|
float tmpvar_24;
|
||
|
tmpvar_24 = 0.0;
|
||
|
o_17.Gloss = tmpvar_24;
|
||
|
vec3 tmpvar_25;
|
||
|
tmpvar_25 = IN_14.normal;
|
||
|
o_17.Normal = tmpvar_25;
|
||
|
surf (surfIN_18, o_17);
|
||
|
vec3 tmpvar_26;
|
||
|
tmpvar_26 = IN_14.lightDir;
|
||
|
lightDir_16 = tmpvar_26;
|
||
|
vec4 tmpvar_27;
|
||
|
tmpvar_27 = texture2D (_LightTexture0, IN_14._LightCoord);
|
||
|
vec4 tmpvar_28;
|
||
|
tmpvar_28 = LightingLambert (o_17, lightDir_16, (tmpvar_27.w * 1.0));
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29 = tmpvar_28;
|
||
|
c_15 = tmpvar_29;
|
||
|
float tmpvar_30;
|
||
|
tmpvar_30 = 0.0;
|
||
|
c_15.w = vec4(tmpvar_30).w;
|
||
|
return c_15;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_31;
|
||
|
vec4 xl_retval_32;
|
||
|
vec4 tmpvar_33;
|
||
|
tmpvar_33 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_31.pos = tmpvar_33;
|
||
|
float tmpvar_34;
|
||
|
tmpvar_34 = xlv_FOG.x;
|
||
|
xlt_IN_31.fog = tmpvar_34;
|
||
|
vec3 tmpvar_35;
|
||
|
tmpvar_35 = gl_TexCoord[0].xyz;
|
||
|
vec3 tmpvar_36;
|
||
|
tmpvar_36 = tmpvar_35;
|
||
|
xlt_IN_31.cust_foo = tmpvar_36;
|
||
|
vec3 tmpvar_37;
|
||
|
tmpvar_37 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
xlt_IN_31.normal = tmpvar_38;
|
||
|
vec3 tmpvar_39;
|
||
|
tmpvar_39 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_40;
|
||
|
tmpvar_40 = tmpvar_39;
|
||
|
xlt_IN_31.lightDir = tmpvar_40;
|
||
|
vec2 tmpvar_41;
|
||
|
tmpvar_41 = gl_TexCoord[3].xy;
|
||
|
vec2 tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
xlt_IN_31._LightCoord = tmpvar_42;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = frag_surf (xlt_IN_31);
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = tmpvar_43;
|
||
|
xl_retval_32 = tmpvar_44;
|
||
|
vec4 tmpvar_45;
|
||
|
tmpvar_45 = xl_retval_32.xyzw;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = tmpvar_45;
|
||
|
gl_FragData[0] = tmpvar_46;
|
||
|
}
|
||
|
|