mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 09:08:22 -05:00
166 lines
3.5 KiB
Text
166 lines
3.5 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;
|
|
vec2 hip_pack0;
|
|
vec3 normal;
|
|
vec3 lightDir;
|
|
vec3 _LightCoord;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _LightTexture0;
|
|
uniform vec4 _LightColor0;
|
|
uniform vec4 _Color;
|
|
void surf (
|
|
in Input IN_1,
|
|
inout SurfaceOutput o_2
|
|
)
|
|
{
|
|
vec4 c_3;
|
|
vec4 tmpvar_4;
|
|
tmpvar_4 = texture2D (_MainTex, IN_1.uv_MainTex);
|
|
vec4 tmpvar_5;
|
|
tmpvar_5 = (tmpvar_4 * _Color);
|
|
c_3 = tmpvar_5;
|
|
vec3 tmpvar_6;
|
|
tmpvar_6 = c_3.xyz;
|
|
o_2.Albedo = tmpvar_6;
|
|
float tmpvar_7;
|
|
tmpvar_7 = c_3.w;
|
|
o_2.Alpha = tmpvar_7;
|
|
}
|
|
|
|
vec4 LightingLambert (
|
|
in SurfaceOutput s_8,
|
|
in vec3 lightDir_9,
|
|
in float atten_10
|
|
)
|
|
{
|
|
vec4 c_11;
|
|
float diff_12;
|
|
float tmpvar_13;
|
|
tmpvar_13 = dot (s_8.Normal, lightDir_9);
|
|
float tmpvar_14;
|
|
tmpvar_14 = max (0.0, tmpvar_13);
|
|
float tmpvar_15;
|
|
tmpvar_15 = tmpvar_14;
|
|
diff_12 = tmpvar_15;
|
|
vec3 tmpvar_16;
|
|
tmpvar_16 = ((s_8.Albedo * _LightColor0.xyz) * ((diff_12 * atten_10) * 2.0));
|
|
c_11.xyz = tmpvar_16.xyz.xyz;
|
|
float tmpvar_17;
|
|
tmpvar_17 = s_8.Alpha;
|
|
c_11.w = vec4(tmpvar_17).w;
|
|
return c_11;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_18
|
|
)
|
|
{
|
|
vec4 c_19;
|
|
vec3 lightDir_20;
|
|
SurfaceOutput o_21;
|
|
Input surfIN_22;
|
|
vec2 tmpvar_23;
|
|
tmpvar_23 = IN_18.hip_pack0.xy;
|
|
surfIN_22.uv_MainTex = tmpvar_23;
|
|
vec3 tmpvar_24;
|
|
tmpvar_24 = vec3(0.0, 0.0, 0.0);
|
|
o_21.Albedo = tmpvar_24;
|
|
vec3 tmpvar_25;
|
|
tmpvar_25 = vec3(0.0, 0.0, 0.0);
|
|
o_21.Emission = tmpvar_25;
|
|
float tmpvar_26;
|
|
tmpvar_26 = 0.0;
|
|
o_21.Specular = tmpvar_26;
|
|
float tmpvar_27;
|
|
tmpvar_27 = 0.0;
|
|
o_21.Alpha = tmpvar_27;
|
|
float tmpvar_28;
|
|
tmpvar_28 = 0.0;
|
|
o_21.Gloss = tmpvar_28;
|
|
vec3 tmpvar_29;
|
|
tmpvar_29 = IN_18.normal;
|
|
o_21.Normal = tmpvar_29;
|
|
surf (surfIN_22, o_21);
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = IN_18.lightDir;
|
|
lightDir_20 = tmpvar_30;
|
|
vec3 tmpvar_31;
|
|
tmpvar_31 = normalize (lightDir_20);
|
|
vec3 tmpvar_32;
|
|
tmpvar_32 = tmpvar_31;
|
|
lightDir_20 = tmpvar_32;
|
|
float tmpvar_33;
|
|
tmpvar_33 = dot (IN_18._LightCoord, IN_18._LightCoord);
|
|
vec2 tmpvar_34;
|
|
tmpvar_34 = vec2(tmpvar_33);
|
|
vec2 tmpvar_35;
|
|
tmpvar_35 = tmpvar_34.xy;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = texture2D (_LightTexture0, tmpvar_35);
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = LightingLambert (o_21, lightDir_20, tmpvar_36.w);
|
|
vec4 tmpvar_38;
|
|
tmpvar_38 = tmpvar_37;
|
|
c_19 = tmpvar_38;
|
|
float tmpvar_39;
|
|
tmpvar_39 = 0.0;
|
|
c_19.w = vec4(tmpvar_39).w;
|
|
return c_19;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_40;
|
|
vec4 xl_retval_41;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_40.pos = tmpvar_42;
|
|
float tmpvar_43;
|
|
tmpvar_43 = xlv_FOG.x;
|
|
xlt_IN_40.fog = tmpvar_43;
|
|
vec2 tmpvar_44;
|
|
tmpvar_44 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_45;
|
|
tmpvar_45 = tmpvar_44;
|
|
xlt_IN_40.hip_pack0 = tmpvar_45;
|
|
vec3 tmpvar_46;
|
|
tmpvar_46 = gl_TexCoord[1].xyz;
|
|
vec3 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
xlt_IN_40.normal = tmpvar_47;
|
|
vec3 tmpvar_48;
|
|
tmpvar_48 = gl_TexCoord[2].xyz;
|
|
vec3 tmpvar_49;
|
|
tmpvar_49 = tmpvar_48;
|
|
xlt_IN_40.lightDir = tmpvar_49;
|
|
vec3 tmpvar_50;
|
|
tmpvar_50 = gl_TexCoord[3].xyz;
|
|
vec3 tmpvar_51;
|
|
tmpvar_51 = tmpvar_50;
|
|
xlt_IN_40._LightCoord = tmpvar_51;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = frag_surf (xlt_IN_40);
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = tmpvar_52;
|
|
xl_retval_41 = tmpvar_53;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = xl_retval_41.xyzw;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55 = tmpvar_54;
|
|
gl_FragData[0] = tmpvar_55;
|
|
}
|
|
|