mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-04 21:31:11 -05:00
168 lines
3.5 KiB
Text
168 lines
3.5 KiB
Text
|
struct SurfaceOutput {
|
||
|
vec3 Albedo;
|
||
|
vec3 Normal;
|
||
|
vec3 Emission;
|
||
|
float Specular;
|
||
|
float Gloss;
|
||
|
float Alpha;
|
||
|
};
|
||
|
struct Input {
|
||
|
vec2 uv_MainTex;
|
||
|
vec2 uv_DecalTex;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec4 hip_pack0;
|
||
|
vec3 normal;
|
||
|
vec3 lightDir;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform vec4 _LightColor0;
|
||
|
uniform sampler2D _DecalTex;
|
||
|
uniform vec4 _Color;
|
||
|
void surf (
|
||
|
in Input IN_1,
|
||
|
inout SurfaceOutput o_2
|
||
|
)
|
||
|
{
|
||
|
vec4 decal_3;
|
||
|
vec4 c_4;
|
||
|
vec4 tmpvar_5;
|
||
|
tmpvar_5 = texture2D (_MainTex, IN_1.uv_MainTex);
|
||
|
vec4 tmpvar_6;
|
||
|
tmpvar_6 = tmpvar_5;
|
||
|
c_4 = tmpvar_6;
|
||
|
vec4 tmpvar_7;
|
||
|
tmpvar_7 = texture2D (_DecalTex, IN_1.uv_DecalTex);
|
||
|
vec4 tmpvar_8;
|
||
|
tmpvar_8 = tmpvar_7;
|
||
|
decal_3 = tmpvar_8;
|
||
|
vec3 tmpvar_9;
|
||
|
tmpvar_9 = vec3(decal_3.w);
|
||
|
vec3 tmpvar_10;
|
||
|
tmpvar_10 = mix (c_4.xyz, decal_3.xyz, tmpvar_9);
|
||
|
vec3 tmpvar_11;
|
||
|
tmpvar_11 = tmpvar_10;
|
||
|
c_4.xyz = tmpvar_11.xyz.xyz;
|
||
|
vec4 tmpvar_12;
|
||
|
tmpvar_12 = (c_4 * _Color);
|
||
|
c_4 = tmpvar_12;
|
||
|
vec3 tmpvar_13;
|
||
|
tmpvar_13 = c_4.xyz;
|
||
|
o_2.Albedo = tmpvar_13;
|
||
|
float tmpvar_14;
|
||
|
tmpvar_14 = c_4.w;
|
||
|
o_2.Alpha = tmpvar_14;
|
||
|
}
|
||
|
|
||
|
vec4 LightingLambert (
|
||
|
in SurfaceOutput s_15,
|
||
|
in vec3 lightDir_16,
|
||
|
in float atten_17
|
||
|
)
|
||
|
{
|
||
|
vec4 c_18;
|
||
|
float diff_19;
|
||
|
float tmpvar_20;
|
||
|
tmpvar_20 = dot (s_15.Normal, lightDir_16);
|
||
|
float tmpvar_21;
|
||
|
tmpvar_21 = max (0.0, tmpvar_20);
|
||
|
float tmpvar_22;
|
||
|
tmpvar_22 = tmpvar_21;
|
||
|
diff_19 = tmpvar_22;
|
||
|
vec3 tmpvar_23;
|
||
|
tmpvar_23 = ((s_15.Albedo * _LightColor0.xyz) * ((diff_19 * atten_17) * 2.0));
|
||
|
c_18.xyz = tmpvar_23.xyz.xyz;
|
||
|
float tmpvar_24;
|
||
|
tmpvar_24 = s_15.Alpha;
|
||
|
c_18.w = vec4(tmpvar_24).w;
|
||
|
return c_18;
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_25
|
||
|
)
|
||
|
{
|
||
|
vec4 c_26;
|
||
|
vec3 lightDir_27;
|
||
|
SurfaceOutput o_28;
|
||
|
Input surfIN_29;
|
||
|
vec2 tmpvar_30;
|
||
|
tmpvar_30 = IN_25.hip_pack0.xy;
|
||
|
surfIN_29.uv_MainTex = tmpvar_30;
|
||
|
vec2 tmpvar_31;
|
||
|
tmpvar_31 = IN_25.hip_pack0.zw;
|
||
|
surfIN_29.uv_DecalTex = tmpvar_31;
|
||
|
vec3 tmpvar_32;
|
||
|
tmpvar_32 = vec3(0.0, 0.0, 0.0);
|
||
|
o_28.Albedo = tmpvar_32;
|
||
|
vec3 tmpvar_33;
|
||
|
tmpvar_33 = vec3(0.0, 0.0, 0.0);
|
||
|
o_28.Emission = tmpvar_33;
|
||
|
float tmpvar_34;
|
||
|
tmpvar_34 = 0.0;
|
||
|
o_28.Specular = tmpvar_34;
|
||
|
float tmpvar_35;
|
||
|
tmpvar_35 = 0.0;
|
||
|
o_28.Alpha = tmpvar_35;
|
||
|
float tmpvar_36;
|
||
|
tmpvar_36 = 0.0;
|
||
|
o_28.Gloss = tmpvar_36;
|
||
|
vec3 tmpvar_37;
|
||
|
tmpvar_37 = IN_25.normal;
|
||
|
o_28.Normal = tmpvar_37;
|
||
|
surf (surfIN_29, o_28);
|
||
|
vec3 tmpvar_38;
|
||
|
tmpvar_38 = IN_25.lightDir;
|
||
|
lightDir_27 = tmpvar_38;
|
||
|
vec4 tmpvar_39;
|
||
|
tmpvar_39 = LightingLambert (o_28, lightDir_27, 1.0);
|
||
|
vec4 tmpvar_40;
|
||
|
tmpvar_40 = tmpvar_39;
|
||
|
c_26 = tmpvar_40;
|
||
|
float tmpvar_41;
|
||
|
tmpvar_41 = 0.0;
|
||
|
c_26.w = vec4(tmpvar_41).w;
|
||
|
return c_26;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_42;
|
||
|
vec4 xl_retval_43;
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_42.pos = tmpvar_44;
|
||
|
float tmpvar_45;
|
||
|
tmpvar_45 = xlv_FOG.x;
|
||
|
xlt_IN_42.fog = tmpvar_45;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = gl_TexCoord[0].xyzw;
|
||
|
vec4 tmpvar_47;
|
||
|
tmpvar_47 = tmpvar_46;
|
||
|
xlt_IN_42.hip_pack0 = tmpvar_47;
|
||
|
vec3 tmpvar_48;
|
||
|
tmpvar_48 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_49;
|
||
|
tmpvar_49 = tmpvar_48;
|
||
|
xlt_IN_42.normal = tmpvar_49;
|
||
|
vec3 tmpvar_50;
|
||
|
tmpvar_50 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_51;
|
||
|
tmpvar_51 = tmpvar_50;
|
||
|
xlt_IN_42.lightDir = tmpvar_51;
|
||
|
vec4 tmpvar_52;
|
||
|
tmpvar_52 = frag_surf (xlt_IN_42);
|
||
|
vec4 tmpvar_53;
|
||
|
tmpvar_53 = tmpvar_52;
|
||
|
xl_retval_43 = tmpvar_53;
|
||
|
vec4 tmpvar_54;
|
||
|
tmpvar_54 = xl_retval_43.xyzw;
|
||
|
vec4 tmpvar_55;
|
||
|
tmpvar_55 = tmpvar_54;
|
||
|
gl_FragData[0] = tmpvar_55;
|
||
|
}
|
||
|
|