mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
85 lines
2.5 KiB
Text
85 lines
2.5 KiB
Text
uniform sampler2D _BumpSpecMap;
|
|
uniform highp vec4 _Color;
|
|
uniform highp float _Cutoff;
|
|
uniform highp vec4 _LightColor0;
|
|
uniform sampler2D _LightTexture0;
|
|
uniform sampler2D _MainTex;
|
|
uniform mediump float _ShadowStrength;
|
|
uniform mediump vec3 _TranslucencyColor;
|
|
uniform sampler2D _TranslucencyMap;
|
|
uniform mediump float _TranslucencyViewDependency;
|
|
varying highp vec2 xlv_TEXCOORD0;
|
|
varying highp vec4 xlv_COLOR0;
|
|
varying highp vec3 xlv_TEXCOORD1;
|
|
varying highp vec3 xlv_TEXCOORD2;
|
|
varying highp vec2 xlv_TEXCOORD3;
|
|
void main ()
|
|
{
|
|
mediump vec4 c_1;
|
|
mediump vec3 lightDir_2;
|
|
mediump vec3 tmpvar_3;
|
|
mediump float tmpvar_4;
|
|
mediump vec4 norspc_5;
|
|
mediump vec4 trngls_6;
|
|
mediump vec4 c_7;
|
|
lowp vec4 tmpvar_8;
|
|
tmpvar_8 = texture2D (_MainTex, xlv_TEXCOORD0);
|
|
c_7 = tmpvar_8;
|
|
highp vec3 tmpvar_9;
|
|
tmpvar_9 = ((c_7.xyz * _Color.xyz) * xlv_COLOR0.w);
|
|
tmpvar_3 = tmpvar_9;
|
|
lowp vec4 tmpvar_10;
|
|
tmpvar_10 = texture2D (_TranslucencyMap, xlv_TEXCOORD0);
|
|
trngls_6 = tmpvar_10;
|
|
highp float tmpvar_11;
|
|
tmpvar_11 = (trngls_6.w * _Color.x);
|
|
tmpvar_4 = tmpvar_11;
|
|
lowp vec4 tmpvar_12;
|
|
tmpvar_12 = texture2D (_BumpSpecMap, xlv_TEXCOORD0);
|
|
norspc_5 = tmpvar_12;
|
|
mediump vec4 normal_13;
|
|
normal_13.xy = ((norspc_5.wy * 2.0) - 1.0);
|
|
normal_13.z = sqrt(((1.0 -
|
|
(normal_13.x * normal_13.x)
|
|
) - (normal_13.y * normal_13.y)));
|
|
highp float x_14;
|
|
x_14 = (c_7.w - _Cutoff);
|
|
if ((x_14 < 0.0)) {
|
|
discard;
|
|
};
|
|
lightDir_2 = xlv_TEXCOORD1;
|
|
highp vec3 tmpvar_15;
|
|
tmpvar_15 = normalize(xlv_TEXCOORD2);
|
|
lowp vec4 tmpvar_16;
|
|
tmpvar_16 = texture2D (_LightTexture0, xlv_TEXCOORD3);
|
|
mediump vec3 viewDir_17;
|
|
viewDir_17 = tmpvar_15;
|
|
mediump float atten_18;
|
|
atten_18 = tmpvar_16.w;
|
|
mediump vec4 c_19;
|
|
mediump float tmpvar_20;
|
|
tmpvar_20 = dot (normal_13.xyz, lightDir_2);
|
|
mediump float tmpvar_21;
|
|
tmpvar_21 = (pow (max (0.0,
|
|
dot (normal_13.xyz, normalize((lightDir_2 + viewDir_17)))
|
|
), (norspc_5.x * 128.0)) * tmpvar_4);
|
|
c_19.xyz = (tmpvar_3 * ((
|
|
((mix (clamp (
|
|
-(tmpvar_20)
|
|
, 0.0, 1.0), clamp (
|
|
dot (viewDir_17, -(lightDir_2))
|
|
, 0.0, 1.0), _TranslucencyViewDependency) * trngls_6.z) * _TranslucencyColor)
|
|
* 2.0) + max (0.0,
|
|
((tmpvar_20 * 0.6) + 0.4)
|
|
)));
|
|
highp vec3 tmpvar_22;
|
|
tmpvar_22 = ((c_19.xyz * _LightColor0.xyz) + tmpvar_21);
|
|
c_19.xyz = tmpvar_22;
|
|
c_19.xyz = (c_19.xyz * mix (2.0, (atten_18 * 2.0), _ShadowStrength));
|
|
c_1.xyz = c_19.xyz;
|
|
c_1.w = c_7.w;
|
|
gl_FragData[0] = c_1;
|
|
}
|
|
|
|
|
|
// inputs: 5, stats: 40 alu 5 tex 1 flow
|