mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
99 lines
2.8 KiB
Text
99 lines
2.8 KiB
Text
uniform lowp vec4 UNITY_LIGHTMODEL_AMBIENT;
|
|
uniform sampler2D _BumpSpecMap;
|
|
uniform lowp float _Cutoff;
|
|
uniform sampler2D _MainTex;
|
|
uniform lowp vec4 _SpecColor;
|
|
uniform highp vec4 _TerrainTreeLightColors[4];
|
|
uniform lowp vec3 _TranslucencyColor;
|
|
uniform sampler2D _TranslucencyMap;
|
|
varying highp vec2 xlv_TEXCOORD0;
|
|
varying highp vec3 xlv_TEXCOORD1;
|
|
varying highp vec3 xlv_TEXCOORD2;
|
|
varying highp vec3 xlv_TEXCOORD3;
|
|
varying highp vec3 xlv_TEXCOORD4;
|
|
void main ()
|
|
{
|
|
lowp vec4 c_1;
|
|
mediump float nh_2;
|
|
mediump float nl_3;
|
|
mediump vec3 lightColor_4;
|
|
mediump vec3 backContribs_5;
|
|
mediump vec3 light_6;
|
|
mediump float gloss_7;
|
|
mediump float specular_8;
|
|
lowp vec3 albedo_9;
|
|
lowp vec4 tmpvar_10;
|
|
tmpvar_10 = texture2D (_MainTex, xlv_TEXCOORD0);
|
|
lowp float x_11;
|
|
x_11 = (tmpvar_10.w - _Cutoff);
|
|
if ((x_11 < 0.0)) {
|
|
discard;
|
|
};
|
|
highp vec3 tmpvar_12;
|
|
tmpvar_12 = (tmpvar_10.xyz * xlv_TEXCOORD1);
|
|
albedo_9 = tmpvar_12;
|
|
lowp float tmpvar_13;
|
|
tmpvar_13 = (texture2D (_BumpSpecMap, xlv_TEXCOORD0).x * 128.0);
|
|
specular_8 = tmpvar_13;
|
|
lowp vec4 tmpvar_14;
|
|
tmpvar_14 = texture2D (_TranslucencyMap, xlv_TEXCOORD0);
|
|
lowp float tmpvar_15;
|
|
tmpvar_15 = tmpvar_14.w;
|
|
gloss_7 = tmpvar_15;
|
|
lowp vec3 tmpvar_16;
|
|
tmpvar_16 = (UNITY_LIGHTMODEL_AMBIENT.xyz * albedo_9);
|
|
light_6 = tmpvar_16;
|
|
highp vec3 tmpvar_17;
|
|
tmpvar_17 = (xlv_TEXCOORD2 * tmpvar_14.z);
|
|
backContribs_5 = tmpvar_17;
|
|
highp vec3 tmpvar_18;
|
|
tmpvar_18 = _TerrainTreeLightColors[0].xyz;
|
|
lightColor_4 = tmpvar_18;
|
|
highp float tmpvar_19;
|
|
tmpvar_19 = xlv_TEXCOORD3.x;
|
|
nl_3 = tmpvar_19;
|
|
highp float tmpvar_20;
|
|
tmpvar_20 = xlv_TEXCOORD4.x;
|
|
nh_2 = tmpvar_20;
|
|
light_6 = (light_6 + ((
|
|
(albedo_9 * ((backContribs_5.x * _TranslucencyColor) + nl_3))
|
|
+
|
|
(_SpecColor.xyz * (pow (nh_2, specular_8) * gloss_7))
|
|
) * lightColor_4));
|
|
highp vec3 tmpvar_21;
|
|
tmpvar_21 = _TerrainTreeLightColors[1].xyz;
|
|
lightColor_4 = tmpvar_21;
|
|
highp float tmpvar_22;
|
|
tmpvar_22 = xlv_TEXCOORD3.y;
|
|
nl_3 = tmpvar_22;
|
|
highp float tmpvar_23;
|
|
tmpvar_23 = xlv_TEXCOORD4.y;
|
|
nh_2 = tmpvar_23;
|
|
light_6 = (light_6 + ((
|
|
(albedo_9 * ((backContribs_5.y * _TranslucencyColor) + nl_3))
|
|
+
|
|
(_SpecColor.xyz * (pow (nh_2, specular_8) * gloss_7))
|
|
) * lightColor_4));
|
|
highp vec3 tmpvar_24;
|
|
tmpvar_24 = _TerrainTreeLightColors[2].xyz;
|
|
lightColor_4 = tmpvar_24;
|
|
highp float tmpvar_25;
|
|
tmpvar_25 = xlv_TEXCOORD3.z;
|
|
nl_3 = tmpvar_25;
|
|
highp float tmpvar_26;
|
|
tmpvar_26 = xlv_TEXCOORD4.z;
|
|
nh_2 = tmpvar_26;
|
|
light_6 = (light_6 + ((
|
|
(albedo_9 * ((backContribs_5.z * _TranslucencyColor) + nl_3))
|
|
+
|
|
(_SpecColor.xyz * (pow (nh_2, specular_8) * gloss_7))
|
|
) * lightColor_4));
|
|
mediump vec3 tmpvar_27;
|
|
tmpvar_27 = (light_6 * 2.0);
|
|
c_1.xyz = tmpvar_27;
|
|
c_1.w = 1.0;
|
|
gl_FragData[0] = c_1;
|
|
}
|
|
|
|
|
|
// inputs: 5, stats: 35 alu 4 tex 1 flow
|