mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
139 lines
3.1 KiB
Text
139 lines
3.1 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 uv;
|
|
vec2 uv2;
|
|
vec3 I;
|
|
vec3 TtoW0;
|
|
vec3 TtoW1;
|
|
vec3 TtoW2;
|
|
};
|
|
varying vec4 xlv_FOG;
|
|
uniform vec4 _ReflectColor;
|
|
uniform sampler2D _MainTex;
|
|
uniform samplerCube _Cube;
|
|
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;
|
|
}
|
|
|
|
vec4 frag (
|
|
in v2f i_6
|
|
)
|
|
{
|
|
vec4 reflcolor_7;
|
|
vec4 c_8;
|
|
vec3 r_9;
|
|
vec3 wn_10;
|
|
vec4 texcol_11;
|
|
vec4 normal_12;
|
|
vec4 tmpvar_13;
|
|
tmpvar_13 = texture2D (_BumpMap, i_6.uv2);
|
|
vec4 tmpvar_14;
|
|
tmpvar_14 = UnpackNormal (tmpvar_13);
|
|
vec4 tmpvar_15;
|
|
tmpvar_15 = tmpvar_14;
|
|
normal_12 = tmpvar_15;
|
|
vec4 tmpvar_16;
|
|
tmpvar_16 = texture2D (_MainTex, i_6.uv);
|
|
vec4 tmpvar_17;
|
|
tmpvar_17 = tmpvar_16;
|
|
texcol_11 = tmpvar_17;
|
|
float tmpvar_18;
|
|
tmpvar_18 = dot (i_6.TtoW0, normal_12.xyz);
|
|
float tmpvar_19;
|
|
tmpvar_19 = tmpvar_18;
|
|
wn_10.x = tmpvar_19;
|
|
float tmpvar_20;
|
|
tmpvar_20 = dot (i_6.TtoW1, normal_12.xyz);
|
|
float tmpvar_21;
|
|
tmpvar_21 = tmpvar_20;
|
|
wn_10.y = vec2(tmpvar_21).y;
|
|
float tmpvar_22;
|
|
tmpvar_22 = dot (i_6.TtoW2, normal_12.xyz);
|
|
float tmpvar_23;
|
|
tmpvar_23 = tmpvar_22;
|
|
wn_10.z = vec3(tmpvar_23).z;
|
|
vec3 tmpvar_24;
|
|
tmpvar_24 = reflect (i_6.I, wn_10);
|
|
vec3 tmpvar_25;
|
|
tmpvar_25 = tmpvar_24;
|
|
r_9 = tmpvar_25;
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = (gl_LightModel.ambient * texcol_11);
|
|
c_8 = tmpvar_26;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = (c_8.xyz * 2.0);
|
|
c_8.xyz = tmpvar_27.xyz.xyz;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = textureCube (_Cube, r_9);
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = ((tmpvar_28 * _ReflectColor) * texcol_11.w);
|
|
reflcolor_7 = tmpvar_29;
|
|
return (c_8 + reflcolor_7);
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f xlt_i_30;
|
|
vec4 xl_retval_31;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_i_30.pos = tmpvar_32;
|
|
float tmpvar_33;
|
|
tmpvar_33 = xlv_FOG.x;
|
|
xlt_i_30.fog = tmpvar_33;
|
|
vec2 tmpvar_34;
|
|
tmpvar_34 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
xlt_i_30.uv = tmpvar_35;
|
|
vec2 tmpvar_36;
|
|
tmpvar_36 = gl_TexCoord[1].xy;
|
|
vec2 tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
xlt_i_30.uv2 = tmpvar_37;
|
|
vec3 tmpvar_38;
|
|
tmpvar_38 = gl_TexCoord[2].xyz;
|
|
vec3 tmpvar_39;
|
|
tmpvar_39 = tmpvar_38;
|
|
xlt_i_30.I = tmpvar_39;
|
|
vec3 tmpvar_40;
|
|
tmpvar_40 = gl_TexCoord[3].xyz;
|
|
vec3 tmpvar_41;
|
|
tmpvar_41 = tmpvar_40;
|
|
xlt_i_30.TtoW0 = tmpvar_41;
|
|
vec3 tmpvar_42;
|
|
tmpvar_42 = gl_TexCoord[4].xyz;
|
|
vec3 tmpvar_43;
|
|
tmpvar_43 = tmpvar_42;
|
|
xlt_i_30.TtoW1 = tmpvar_43;
|
|
vec3 tmpvar_44;
|
|
tmpvar_44 = gl_TexCoord[5].xyz;
|
|
vec3 tmpvar_45;
|
|
tmpvar_45 = tmpvar_44;
|
|
xlt_i_30.TtoW2 = tmpvar_45;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = frag (xlt_i_30);
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
xl_retval_31 = tmpvar_47;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = xl_retval_31.xyzw;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = tmpvar_48;
|
|
gl_FragData[0] = tmpvar_49;
|
|
}
|
|
|