mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 11:05:36 -05:00
190 lines
4.2 KiB
Text
190 lines
4.2 KiB
Text
|
struct SurfaceOutput {
|
||
|
vec3 Albedo;
|
||
|
vec3 Normal;
|
||
|
vec3 Emission;
|
||
|
float Specular;
|
||
|
float Gloss;
|
||
|
float Alpha;
|
||
|
};
|
||
|
struct Input {
|
||
|
vec2 uv_MainTex;
|
||
|
vec2 uv_BumpMap;
|
||
|
vec3 worldRefl;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
vec2 hip_pack0;
|
||
|
vec3 TtoV0;
|
||
|
vec3 TtoV1;
|
||
|
vec3 TtoV2;
|
||
|
};
|
||
|
uniform float _Shininess;
|
||
|
uniform vec4 _ReflectColor;
|
||
|
uniform sampler2D _MainTex;
|
||
|
uniform samplerCube _Cube;
|
||
|
uniform vec4 _Color;
|
||
|
uniform sampler2D _BumpMap;
|
||
|
vec4 UnpackNormal (
|
||
|
in vec4 packednormal_1
|
||
|
)
|
||
|
{
|
||
|
vec4 normal_2;
|
||
|
vec2 tmpvar_3;
|
||
|
tmpvar_3 = ((packednormal_1.wy * 2.0) - 1.0);
|
||
|
normal_2.xy = tmpvar_3.xy.xy;
|
||
|
float tmpvar_4;
|
||
|
tmpvar_4 = sqrt (((1.0 - (normal_2.x * normal_2.x)) - (normal_2.y * normal_2.y)));
|
||
|
float tmpvar_5;
|
||
|
tmpvar_5 = tmpvar_4;
|
||
|
normal_2.z = vec3(tmpvar_5).z;
|
||
|
return normal_2;
|
||
|
}
|
||
|
|
||
|
void surf (
|
||
|
in Input IN_6,
|
||
|
inout SurfaceOutput o_7
|
||
|
)
|
||
|
{
|
||
|
vec4 reflcol_8;
|
||
|
vec3 worldRefl_9;
|
||
|
vec4 c_10;
|
||
|
vec4 tex_11;
|
||
|
vec4 tmpvar_12;
|
||
|
tmpvar_12 = texture2D (_MainTex, IN_6.uv_MainTex);
|
||
|
vec4 tmpvar_13;
|
||
|
tmpvar_13 = tmpvar_12;
|
||
|
tex_11 = tmpvar_13;
|
||
|
vec4 tmpvar_14;
|
||
|
tmpvar_14 = (tex_11 * _Color);
|
||
|
c_10 = tmpvar_14;
|
||
|
vec3 tmpvar_15;
|
||
|
tmpvar_15 = c_10.xyz;
|
||
|
o_7.Albedo = tmpvar_15;
|
||
|
float tmpvar_16;
|
||
|
tmpvar_16 = tex_11.w;
|
||
|
o_7.Gloss = tmpvar_16;
|
||
|
float tmpvar_17;
|
||
|
tmpvar_17 = _Shininess;
|
||
|
o_7.Specular = tmpvar_17;
|
||
|
vec4 tmpvar_18;
|
||
|
tmpvar_18 = texture2D (_BumpMap, IN_6.uv_BumpMap);
|
||
|
vec4 tmpvar_19;
|
||
|
tmpvar_19 = UnpackNormal (tmpvar_18);
|
||
|
vec3 tmpvar_20;
|
||
|
tmpvar_20 = tmpvar_19.xyz;
|
||
|
vec3 tmpvar_21;
|
||
|
tmpvar_21 = tmpvar_20;
|
||
|
o_7.Normal = tmpvar_21;
|
||
|
vec3 tmpvar_22;
|
||
|
tmpvar_22 = IN_6.worldRefl;
|
||
|
worldRefl_9 = tmpvar_22;
|
||
|
vec4 tmpvar_23;
|
||
|
tmpvar_23 = textureCube (_Cube, worldRefl_9);
|
||
|
vec4 tmpvar_24;
|
||
|
tmpvar_24 = tmpvar_23;
|
||
|
reflcol_8 = tmpvar_24;
|
||
|
vec4 tmpvar_25;
|
||
|
tmpvar_25 = (reflcol_8 * tex_11.w);
|
||
|
reflcol_8 = tmpvar_25;
|
||
|
vec3 tmpvar_26;
|
||
|
tmpvar_26 = (reflcol_8.xyz * _ReflectColor.xyz);
|
||
|
o_7.Emission = tmpvar_26;
|
||
|
float tmpvar_27;
|
||
|
tmpvar_27 = (reflcol_8.w * _ReflectColor.w);
|
||
|
o_7.Alpha = tmpvar_27;
|
||
|
}
|
||
|
|
||
|
vec4 frag_surf (
|
||
|
in v2f_surf IN_28
|
||
|
)
|
||
|
{
|
||
|
vec4 res_29;
|
||
|
vec3 viewN_30;
|
||
|
SurfaceOutput o_31;
|
||
|
Input surfIN_32;
|
||
|
vec2 tmpvar_33;
|
||
|
tmpvar_33 = IN_28.hip_pack0.xy;
|
||
|
surfIN_32.uv_BumpMap = tmpvar_33;
|
||
|
vec3 tmpvar_34;
|
||
|
tmpvar_34 = vec3(0.0, 0.0, 0.0);
|
||
|
o_31.Albedo = tmpvar_34;
|
||
|
vec3 tmpvar_35;
|
||
|
tmpvar_35 = vec3(0.0, 0.0, 0.0);
|
||
|
o_31.Emission = tmpvar_35;
|
||
|
float tmpvar_36;
|
||
|
tmpvar_36 = 0.0;
|
||
|
o_31.Specular = tmpvar_36;
|
||
|
float tmpvar_37;
|
||
|
tmpvar_37 = 0.0;
|
||
|
o_31.Alpha = tmpvar_37;
|
||
|
float tmpvar_38;
|
||
|
tmpvar_38 = 0.0;
|
||
|
o_31.Gloss = tmpvar_38;
|
||
|
surf (surfIN_32, o_31);
|
||
|
float tmpvar_39;
|
||
|
tmpvar_39 = dot (IN_28.TtoV0, o_31.Normal);
|
||
|
float tmpvar_40;
|
||
|
tmpvar_40 = tmpvar_39;
|
||
|
viewN_30.x = tmpvar_40;
|
||
|
float tmpvar_41;
|
||
|
tmpvar_41 = dot (IN_28.TtoV1, o_31.Normal);
|
||
|
float tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
viewN_30.y = vec2(tmpvar_42).y;
|
||
|
float tmpvar_43;
|
||
|
tmpvar_43 = dot (IN_28.TtoV2, o_31.Normal);
|
||
|
float tmpvar_44;
|
||
|
tmpvar_44 = tmpvar_43;
|
||
|
viewN_30.z = vec3(tmpvar_44).z;
|
||
|
vec3 tmpvar_45;
|
||
|
tmpvar_45 = viewN_30;
|
||
|
o_31.Normal = tmpvar_45;
|
||
|
vec3 tmpvar_46;
|
||
|
tmpvar_46 = ((o_31.Normal * vec3(0.5, 0.5, -0.5)) + 0.5);
|
||
|
res_29.xyz = tmpvar_46.xyz.xyz;
|
||
|
float tmpvar_47;
|
||
|
tmpvar_47 = o_31.Specular;
|
||
|
res_29.w = vec4(tmpvar_47).w;
|
||
|
return res_29;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
v2f_surf xlt_IN_48;
|
||
|
vec4 xl_retval_49;
|
||
|
vec4 tmpvar_50;
|
||
|
tmpvar_50 = vec4(0.0, 0.0, 0.0, 0.0);
|
||
|
xlt_IN_48.pos = tmpvar_50;
|
||
|
vec2 tmpvar_51;
|
||
|
tmpvar_51 = gl_TexCoord[0].xy;
|
||
|
vec2 tmpvar_52;
|
||
|
tmpvar_52 = tmpvar_51;
|
||
|
xlt_IN_48.hip_pack0 = tmpvar_52;
|
||
|
vec3 tmpvar_53;
|
||
|
tmpvar_53 = gl_TexCoord[1].xyz;
|
||
|
vec3 tmpvar_54;
|
||
|
tmpvar_54 = tmpvar_53;
|
||
|
xlt_IN_48.TtoV0 = tmpvar_54;
|
||
|
vec3 tmpvar_55;
|
||
|
tmpvar_55 = gl_TexCoord[2].xyz;
|
||
|
vec3 tmpvar_56;
|
||
|
tmpvar_56 = tmpvar_55;
|
||
|
xlt_IN_48.TtoV1 = tmpvar_56;
|
||
|
vec3 tmpvar_57;
|
||
|
tmpvar_57 = gl_TexCoord[3].xyz;
|
||
|
vec3 tmpvar_58;
|
||
|
tmpvar_58 = tmpvar_57;
|
||
|
xlt_IN_48.TtoV2 = tmpvar_58;
|
||
|
vec4 tmpvar_59;
|
||
|
tmpvar_59 = frag_surf (xlt_IN_48);
|
||
|
vec4 tmpvar_60;
|
||
|
tmpvar_60 = tmpvar_59;
|
||
|
xl_retval_49 = tmpvar_60;
|
||
|
vec4 tmpvar_61;
|
||
|
tmpvar_61 = xl_retval_49.xyzw;
|
||
|
vec4 tmpvar_62;
|
||
|
tmpvar_62 = tmpvar_61;
|
||
|
gl_FragData[0] = tmpvar_62;
|
||
|
}
|
||
|
|