mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
106 lines
2.6 KiB
Text
106 lines
2.6 KiB
Text
struct v2f_surf {
|
|
highp vec4 pos;
|
|
lowp vec2 pack0;
|
|
lowp vec3 halfDir;
|
|
lowp vec3 lightDir;
|
|
lowp vec3 vlight;
|
|
};
|
|
uniform sampler2D _BumpMap;
|
|
uniform lowp vec4 _LightColor0;
|
|
uniform sampler2D _MainTex;
|
|
uniform lowp float _Shininess;
|
|
varying lowp vec2 xlv_TEXCOORD0;
|
|
varying lowp vec3 xlv_TEXCOORD1;
|
|
varying lowp vec3 xlv_TEXCOORD2;
|
|
varying lowp vec3 xlv_TEXCOORD3;
|
|
lowp vec4 frag_surf (
|
|
in v2f_surf IN_1
|
|
)
|
|
{
|
|
lowp vec4 c_2;
|
|
lowp float spec_3;
|
|
lowp float nh_4;
|
|
lowp float diff_5;
|
|
lowp vec3 Normal_6;
|
|
lowp vec4 tex_7;
|
|
lowp vec4 tmpvar_8;
|
|
tmpvar_8 = texture2D (_MainTex, IN_1.pack0);
|
|
lowp vec4 tmpvar_9;
|
|
tmpvar_9 = tmpvar_8;
|
|
tex_7 = tmpvar_9;
|
|
lowp vec4 tmpvar_10;
|
|
tmpvar_10 = texture2D (_BumpMap, IN_1.pack0);
|
|
lowp vec3 tmpvar_11;
|
|
tmpvar_11 = ((tmpvar_10.xyz * 2.0) - 1.0);
|
|
Normal_6 = tmpvar_11;
|
|
lowp float tmpvar_12;
|
|
tmpvar_12 = dot (Normal_6, IN_1.lightDir);
|
|
lowp float tmpvar_13;
|
|
tmpvar_13 = max (0.0, tmpvar_12);
|
|
lowp float tmpvar_14;
|
|
tmpvar_14 = tmpvar_13;
|
|
diff_5 = tmpvar_14;
|
|
lowp float tmpvar_15;
|
|
tmpvar_15 = dot (Normal_6, IN_1.halfDir);
|
|
lowp float tmpvar_16;
|
|
tmpvar_16 = max (0.0, tmpvar_15);
|
|
lowp float tmpvar_17;
|
|
tmpvar_17 = tmpvar_16;
|
|
nh_4 = tmpvar_17;
|
|
lowp float tmpvar_18;
|
|
tmpvar_18 = pow (nh_4, _Shininess);
|
|
lowp float tmpvar_19;
|
|
tmpvar_19 = (tmpvar_18 * tex_7.w);
|
|
spec_3 = tmpvar_19;
|
|
lowp vec3 tmpvar_20;
|
|
tmpvar_20 = tex_7.xyz;
|
|
lowp vec3 tmpvar_21;
|
|
tmpvar_21 = ((tmpvar_20 * (
|
|
(_LightColor0.xyz * diff_5)
|
|
+ IN_1.vlight)) + (_LightColor0.xyz * spec_3));
|
|
c_2.xyz = tmpvar_21.xyz.xyz;
|
|
mediump float tmpvar_22;
|
|
tmpvar_22 = 0.0;
|
|
c_2.w = vec4(tmpvar_22).w;
|
|
return c_2;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f_surf xlt_IN_23;
|
|
lowp vec4 xl_retval_24;
|
|
mediump vec4 tmpvar_25;
|
|
tmpvar_25 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_IN_23.pos = tmpvar_25;
|
|
lowp vec2 tmpvar_26;
|
|
tmpvar_26 = xlv_TEXCOORD0.xy;
|
|
lowp vec2 tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
xlt_IN_23.pack0 = tmpvar_27;
|
|
lowp vec3 tmpvar_28;
|
|
tmpvar_28 = xlv_TEXCOORD1.xyz;
|
|
lowp vec3 tmpvar_29;
|
|
tmpvar_29 = tmpvar_28;
|
|
xlt_IN_23.halfDir = tmpvar_29;
|
|
lowp vec3 tmpvar_30;
|
|
tmpvar_30 = xlv_TEXCOORD2.xyz;
|
|
lowp vec3 tmpvar_31;
|
|
tmpvar_31 = tmpvar_30;
|
|
xlt_IN_23.lightDir = tmpvar_31;
|
|
lowp vec3 tmpvar_32;
|
|
tmpvar_32 = xlv_TEXCOORD3.xyz;
|
|
lowp vec3 tmpvar_33;
|
|
tmpvar_33 = tmpvar_32;
|
|
xlt_IN_23.vlight = tmpvar_33;
|
|
lowp vec4 tmpvar_34;
|
|
tmpvar_34 = frag_surf (xlt_IN_23);
|
|
lowp vec4 tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
xl_retval_24 = tmpvar_35;
|
|
lowp vec4 tmpvar_36;
|
|
tmpvar_36 = xl_retval_24.xyzw;
|
|
lowp vec4 tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
gl_FragData[0] = tmpvar_37;
|
|
}
|
|
|