mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
158 lines
3.4 KiB
Text
158 lines
3.4 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;
|
|
vec3 _LightCoord;
|
|
};
|
|
uniform vec4 _LightColor0;
|
|
uniform samplerCube _LightTexture0;
|
|
uniform sampler2D _LightTextureB0;
|
|
varying vec4 xlv_FOG;
|
|
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;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = normalize (lightDir_16);
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = tmpvar_27;
|
|
lightDir_16 = tmpvar_28;
|
|
float tmpvar_29;
|
|
tmpvar_29 = dot (IN_14._LightCoord, IN_14._LightCoord);
|
|
vec2 tmpvar_30;
|
|
tmpvar_30 = vec2(tmpvar_29);
|
|
vec2 tmpvar_31;
|
|
tmpvar_31 = tmpvar_30.xy;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = texture2D (_LightTextureB0, tmpvar_31);
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = textureCube (_LightTexture0, IN_14._LightCoord);
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = LightingLambert (o_17, lightDir_16, (tmpvar_32.w * tmpvar_33.w));
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
c_15 = tmpvar_35;
|
|
float tmpvar_36;
|
|
tmpvar_36 = 0.0;
|
|
c_15.w = vec4(tmpvar_36).w;
|
|
return c_15;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_37;
|
|
vec4 xl_retval_38;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_37.pos = tmpvar_39;
|
|
float tmpvar_40;
|
|
tmpvar_40 = xlv_FOG.x;
|
|
xlt_IN_37.fog = tmpvar_40;
|
|
vec3 tmpvar_41;
|
|
tmpvar_41 = gl_TexCoord[0].xyz;
|
|
vec3 tmpvar_42;
|
|
tmpvar_42 = tmpvar_41;
|
|
xlt_IN_37.cust_foo = tmpvar_42;
|
|
vec3 tmpvar_43;
|
|
tmpvar_43 = gl_TexCoord[1].xyz;
|
|
vec3 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xlt_IN_37.normal = tmpvar_44;
|
|
vec3 tmpvar_45;
|
|
tmpvar_45 = gl_TexCoord[2].xyz;
|
|
vec3 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
xlt_IN_37.lightDir = tmpvar_46;
|
|
vec3 tmpvar_47;
|
|
tmpvar_47 = gl_TexCoord[3].xyz;
|
|
vec3 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
xlt_IN_37._LightCoord = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = frag_surf (xlt_IN_37);
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
xl_retval_38 = tmpvar_50;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = xl_retval_38.xyzw;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
gl_FragData[0] = tmpvar_52;
|
|
}
|
|
|