mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
147 lines
3 KiB
Text
147 lines
3 KiB
Text
|
struct SurfaceOutput {
|
||
|
vec3 Albedo;
|
||
|
vec3 Normal;
|
||
|
vec3 Emission;
|
||
|
float Specular;
|
||
|
float Gloss;
|
||
|
float Alpha;
|
||
|
};
|
||
|
struct Input {
|
||
|
vec2 uv_MainTex;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec3 normal;
|
||
|
vec3 lightDir;
|
||
|
vec3 _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 = vec3(0.0, 1.0, 0.0);
|
||
|
o_2.Emission = 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;
|
||
|
Input surfIN_17;
|
||
|
SurfaceOutput o_18;
|
||
|
vec3 tmpvar_19;
|
||
|
tmpvar_19 = vec3(0.0, 0.0, 0.0);
|
||
|
o_18.Albedo = tmpvar_19;
|
||
|
vec3 tmpvar_20;
|
||
|
tmpvar_20 = vec3(0.0, 0.0, 0.0);
|
||
|
o_18.Emission = tmpvar_20;
|
||
|
float tmpvar_21;
|
||
|
tmpvar_21 = 0.0;
|
||
|
o_18.Specular = tmpvar_21;
|
||
|
float tmpvar_22;
|
||
|
tmpvar_22 = 0.0;
|
||
|
o_18.Alpha = tmpvar_22;
|
||
|
float tmpvar_23;
|
||
|
tmpvar_23 = 0.0;
|
||
|
o_18.Gloss = tmpvar_23;
|
||
|
vec3 tmpvar_24;
|
||
|
tmpvar_24 = IN_14.normal;
|
||
|
o_18.Normal = tmpvar_24;
|
||
|
surf (surfIN_17, o_18);
|
||
|
vec3 tmpvar_25;
|
||
|
tmpvar_25 = IN_14.lightDir;
|
||
|
lightDir_16 = tmpvar_25;
|
||
|
vec3 tmpvar_26;
|
||
|
tmpvar_26 = normalize (lightDir_16);
|
||
|
vec3 tmpvar_27;
|
||
|
tmpvar_27 = tmpvar_26;
|
||
|
lightDir_16 = tmpvar_27;
|
||
|
float tmpvar_28;
|
||
|
tmpvar_28 = dot (IN_14._LightCoord, IN_14._LightCoord);
|
||
|
vec2 tmpvar_29;
|
||
|
tmpvar_29 = vec2(tmpvar_28);
|
||
|
vec2 tmpvar_30;
|
||
|
tmpvar_30 = tmpvar_29.xy;
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31 = texture2D (_LightTexture0, tmpvar_30);
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = LightingLambert (o_18, lightDir_16, tmpvar_31.w);
|
||
|
vec4 tmpvar_33;
|
||
|
tmpvar_33 = tmpvar_32;
|
||
|
c_15 = tmpvar_33;
|
||
|
float tmpvar_34;
|
||
|
tmpvar_34 = 0.0;
|
||
|
c_15.w = vec4(tmpvar_34).w;
|
||
|
return c_15;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_35;
|
||
|
vec4 xl_retval_36;
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_35.pos = tmpvar_37;
|
||
|
float tmpvar_38;
|
||
|
tmpvar_38 = xlv_FOG.x;
|
||
|
xlt_IN_35.fog = tmpvar_38;
|
||
|
vec3 tmpvar_39;
|
||
|
tmpvar_39 = gl_TexCoord[0].xyz;
|
||
|
vec3 tmpvar_40;
|
||
|
tmpvar_40 = tmpvar_39;
|
||
|
xlt_IN_35.normal = tmpvar_40;
|
||
|
vec3 tmpvar_41;
|
||
|
tmpvar_41 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
xlt_IN_35.lightDir = tmpvar_42;
|
||
|
vec3 tmpvar_43;
|
||
|
tmpvar_43 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_44;
|
||
|
tmpvar_44 = tmpvar_43;
|
||
|
xlt_IN_35._LightCoord = tmpvar_44;
|
||
|
vec4 tmpvar_45;
|
||
|
tmpvar_45 = frag_surf (xlt_IN_35);
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = tmpvar_45;
|
||
|
xl_retval_36 = tmpvar_46;
|
||
|
vec4 tmpvar_47;
|
||
|
tmpvar_47 = xl_retval_36.xyzw;
|
||
|
vec4 tmpvar_48;
|
||
|
tmpvar_48 = tmpvar_47;
|
||
|
gl_FragData[0] = tmpvar_48;
|
||
|
}
|
||
|
|