mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
121 lines
2.5 KiB
Text
121 lines
2.5 KiB
Text
struct SurfaceOutput {
|
|
vec3 Albedo;
|
|
vec3 Normal;
|
|
vec3 Emission;
|
|
float Specular;
|
|
float Gloss;
|
|
float Alpha;
|
|
};
|
|
struct Input {
|
|
vec2 uv_MainTex;
|
|
vec3 worldRefl;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
vec3 normal;
|
|
};
|
|
uniform float _Shininess;
|
|
uniform vec4 _ReflectColor;
|
|
uniform sampler2D _MainTex;
|
|
uniform samplerCube _Cube;
|
|
uniform vec4 _Color;
|
|
void surf (
|
|
in Input IN_1,
|
|
inout SurfaceOutput o_2
|
|
)
|
|
{
|
|
vec4 reflcol_3;
|
|
vec4 c_4;
|
|
vec4 tex_5;
|
|
vec4 tmpvar_6;
|
|
tmpvar_6 = texture2D (_MainTex, IN_1.uv_MainTex);
|
|
vec4 tmpvar_7;
|
|
tmpvar_7 = tmpvar_6;
|
|
tex_5 = tmpvar_7;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = (tex_5 * _Color);
|
|
c_4 = tmpvar_8;
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = c_4.xyz;
|
|
o_2.Albedo = tmpvar_9;
|
|
float tmpvar_10;
|
|
tmpvar_10 = tex_5.w;
|
|
o_2.Gloss = tmpvar_10;
|
|
float tmpvar_11;
|
|
tmpvar_11 = _Shininess;
|
|
o_2.Specular = tmpvar_11;
|
|
vec4 tmpvar_12;
|
|
tmpvar_12 = textureCube (_Cube, IN_1.worldRefl);
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = tmpvar_12;
|
|
reflcol_3 = tmpvar_13;
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = (reflcol_3 * tex_5.w);
|
|
reflcol_3 = tmpvar_14;
|
|
vec3 tmpvar_15;
|
|
tmpvar_15 = (reflcol_3.xyz * _ReflectColor.xyz);
|
|
o_2.Emission = tmpvar_15;
|
|
float tmpvar_16;
|
|
tmpvar_16 = (reflcol_3.w * _ReflectColor.w);
|
|
o_2.Alpha = tmpvar_16;
|
|
}
|
|
|
|
vec4 frag_surf (
|
|
in v2f_surf IN_17
|
|
)
|
|
{
|
|
vec4 res_18;
|
|
Input surfIN_19;
|
|
SurfaceOutput o_20;
|
|
vec3 tmpvar_21;
|
|
tmpvar_21 = vec3(0.0, 0.0, 0.0);
|
|
o_20.Albedo = tmpvar_21;
|
|
vec3 tmpvar_22;
|
|
tmpvar_22 = vec3(0.0, 0.0, 0.0);
|
|
o_20.Emission = tmpvar_22;
|
|
float tmpvar_23;
|
|
tmpvar_23 = 0.0;
|
|
o_20.Specular = tmpvar_23;
|
|
float tmpvar_24;
|
|
tmpvar_24 = 0.0;
|
|
o_20.Alpha = tmpvar_24;
|
|
float tmpvar_25;
|
|
tmpvar_25 = 0.0;
|
|
o_20.Gloss = tmpvar_25;
|
|
vec3 tmpvar_26;
|
|
tmpvar_26 = IN_17.normal;
|
|
o_20.Normal = tmpvar_26;
|
|
surf (surfIN_19, o_20);
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = ((o_20.Normal * vec3(0.5, 0.5, -0.5)) + 0.5);
|
|
res_18.xyz = tmpvar_27.xyz.xyz;
|
|
float tmpvar_28;
|
|
tmpvar_28 = o_20.Specular;
|
|
res_18.w = vec4(tmpvar_28).w;
|
|
return res_18;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_29;
|
|
vec4 xl_retval_30;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_29.pos = tmpvar_31;
|
|
vec3 tmpvar_32;
|
|
tmpvar_32 = gl_TexCoord[0].xyz;
|
|
vec3 tmpvar_33;
|
|
tmpvar_33 = tmpvar_32;
|
|
xlt_IN_29.normal = tmpvar_33;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = frag_surf (xlt_IN_29);
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
xl_retval_30 = tmpvar_35;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = xl_retval_30.xyzw;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
gl_FragData[0] = tmpvar_37;
|
|
}
|
|
|