mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-04 21:31:11 -05:00
148 lines
3.1 KiB
Text
148 lines
3.1 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;
|
||
|
vec2 _LightCoord;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform sampler2D _LightTexture0;
|
||
|
uniform vec4 _LightColor0;
|
||
|
void surf (
|
||
|
in Input IN_1,
|
||
|
inout SurfaceOutput o_2
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_3;
|
||
|
tmpvar_3 = texture2D (_MainTex, IN_1.uv_MainTex);
|
||
|
vec3 tmpvar_4;
|
||
|
tmpvar_4 = (tmpvar_3.xyz * 0.5);
|
||
|
o_2.Albedo = tmpvar_4;
|
||
|
}
|
||
|
|
||
|
vec4 LightingLambert (
|
||
|
in SurfaceOutput s_5,
|
||
|
in vec3 lightDir_6,
|
||
|
in float atten_7
|
||
|
)
|
||
|
{
|
||
|
vec4 c_8;
|
||
|
float diff_9;
|
||
|
float tmpvar_10;
|
||
|
tmpvar_10 = dot (s_5.Normal, lightDir_6);
|
||
|
float tmpvar_11;
|
||
|
tmpvar_11 = max (0.0, tmpvar_10);
|
||
|
float tmpvar_12;
|
||
|
tmpvar_12 = tmpvar_11;
|
||
|
diff_9 = tmpvar_12;
|
||
|
vec3 tmpvar_13;
|
||
|
tmpvar_13 = ((s_5.Albedo * _LightColor0.xyz) * ((diff_9 * atten_7) * 2.0));
|
||
|
c_8.xyz = tmpvar_13.xyz.xyz;
|
||
|
float tmpvar_14;
|
||
|
tmpvar_14 = s_5.Alpha;
|
||
|
c_8.w = vec4(tmpvar_14).w;
|
||
|
return c_8;
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_15
|
||
|
)
|
||
|
{
|
||
|
vec4 c_16;
|
||
|
vec3 lightDir_17;
|
||
|
SurfaceOutput o_18;
|
||
|
Input surfIN_19;
|
||
|
vec2 tmpvar_20;
|
||
|
tmpvar_20 = IN_15.hip_pack0.xy;
|
||
|
surfIN_19.uv_MainTex = tmpvar_20;
|
||
|
vec3 tmpvar_21;
|
||
|
tmpvar_21 = vec3(0.0, 0.0, 0.0);
|
||
|
o_18.Albedo = tmpvar_21;
|
||
|
vec3 tmpvar_22;
|
||
|
tmpvar_22 = vec3(0.0, 0.0, 0.0);
|
||
|
o_18.Emission = tmpvar_22;
|
||
|
float tmpvar_23;
|
||
|
tmpvar_23 = 0.0;
|
||
|
o_18.Specular = tmpvar_23;
|
||
|
float tmpvar_24;
|
||
|
tmpvar_24 = 0.0;
|
||
|
o_18.Alpha = tmpvar_24;
|
||
|
float tmpvar_25;
|
||
|
tmpvar_25 = 0.0;
|
||
|
o_18.Gloss = tmpvar_25;
|
||
|
vec3 tmpvar_26;
|
||
|
tmpvar_26 = IN_15.normal;
|
||
|
o_18.Normal = tmpvar_26;
|
||
|
surf (surfIN_19, o_18);
|
||
|
vec3 tmpvar_27;
|
||
|
tmpvar_27 = IN_15.lightDir;
|
||
|
lightDir_17 = tmpvar_27;
|
||
|
vec4 tmpvar_28;
|
||
|
tmpvar_28 = texture2D (_LightTexture0, IN_15._LightCoord);
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29 = LightingLambert (o_18, lightDir_17, (tmpvar_28.w * 1.0));
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = tmpvar_29;
|
||
|
c_16 = tmpvar_30;
|
||
|
float tmpvar_31;
|
||
|
tmpvar_31 = 0.0;
|
||
|
c_16.w = vec4(tmpvar_31).w;
|
||
|
return c_16;
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
float tmpvar_35;
|
||
|
tmpvar_35 = xlv_FOG.x;
|
||
|
xlt_IN_32.fog = tmpvar_35;
|
||
|
vec2 tmpvar_36;
|
||
|
tmpvar_36 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_37;
|
||
|
tmpvar_37 = tmpvar_36;
|
||
|
xlt_IN_32.hip_pack0 = tmpvar_37;
|
||
|
vec3 tmpvar_38;
|
||
|
tmpvar_38 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_39;
|
||
|
tmpvar_39 = tmpvar_38;
|
||
|
xlt_IN_32.normal = tmpvar_39;
|
||
|
vec3 tmpvar_40;
|
||
|
tmpvar_40 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_41;
|
||
|
tmpvar_41 = tmpvar_40;
|
||
|
xlt_IN_32.lightDir = tmpvar_41;
|
||
|
vec2 tmpvar_42;
|
||
|
tmpvar_42 = gl_TexCoord[3].xy;
|
||
|
vec2 tmpvar_43;
|
||
|
tmpvar_43 = tmpvar_42;
|
||
|
xlt_IN_32._LightCoord = tmpvar_43;
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = frag_surf (xlt_IN_32);
|
||
|
vec4 tmpvar_45;
|
||
|
tmpvar_45 = tmpvar_44;
|
||
|
xl_retval_33 = tmpvar_45;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = xl_retval_33.xyzw;
|
||
|
vec4 tmpvar_47;
|
||
|
tmpvar_47 = tmpvar_46;
|
||
|
gl_FragData[0] = tmpvar_47;
|
||
|
}
|
||
|
|