mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 11:05:36 -05:00
139 lines
2.8 KiB
Text
139 lines
2.8 KiB
Text
|
struct SurfaceOutput {
|
||
|
vec3 Albedo;
|
||
|
vec3 Normal;
|
||
|
vec3 Emission;
|
||
|
float Specular;
|
||
|
float Gloss;
|
||
|
float Alpha;
|
||
|
};
|
||
|
struct Input {
|
||
|
vec3 worldRefl;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
float fog;
|
||
|
vec3 worldRefl;
|
||
|
vec3 normal;
|
||
|
vec3 lightDir;
|
||
|
};
|
||
|
varying vec4 xlv_FOG;
|
||
|
uniform vec4 _LightColor0;
|
||
|
uniform samplerCube _Cube;
|
||
|
void surf (
|
||
|
in Input IN_1,
|
||
|
inout SurfaceOutput o_2
|
||
|
)
|
||
|
{
|
||
|
vec4 tmpvar_3;
|
||
|
tmpvar_3 = textureCube (_Cube, IN_1.worldRefl);
|
||
|
vec3 tmpvar_4;
|
||
|
tmpvar_4 = tmpvar_3.xyz;
|
||
|
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;
|
||
|
vec3 tmpvar_20;
|
||
|
tmpvar_20 = IN_15.worldRefl;
|
||
|
surfIN_19.worldRefl = 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 = LightingLambert (o_18, lightDir_17, 1.0);
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29 = tmpvar_28;
|
||
|
c_16 = tmpvar_29;
|
||
|
float tmpvar_30;
|
||
|
tmpvar_30 = 0.0;
|
||
|
c_16.w = vec4(tmpvar_30).w;
|
||
|
return c_16;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_31;
|
||
|
vec4 xl_retval_32;
|
||
|
vec4 tmpvar_33;
|
||
|
tmpvar_33 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_31.pos = tmpvar_33;
|
||
|
float tmpvar_34;
|
||
|
tmpvar_34 = xlv_FOG.x;
|
||
|
xlt_IN_31.fog = tmpvar_34;
|
||
|
vec3 tmpvar_35;
|
||
|
tmpvar_35 = gl_TexCoord[0].xyz;
|
||
|
vec3 tmpvar_36;
|
||
|
tmpvar_36 = tmpvar_35;
|
||
|
xlt_IN_31.worldRefl = tmpvar_36;
|
||
|
vec3 tmpvar_37;
|
||
|
tmpvar_37 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
xlt_IN_31.normal = tmpvar_38;
|
||
|
vec3 tmpvar_39;
|
||
|
tmpvar_39 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_40;
|
||
|
tmpvar_40 = tmpvar_39;
|
||
|
xlt_IN_31.lightDir = tmpvar_40;
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = frag_surf (xlt_IN_31);
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
xl_retval_32 = tmpvar_42;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = xl_retval_32.xyzw;
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = tmpvar_43;
|
||
|
gl_FragData[0] = tmpvar_44;
|
||
|
}
|
||
|
|