mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
90 lines
2.7 KiB
Text
90 lines
2.7 KiB
Text
|
#version 300 es
|
||
|
out mediump vec4 _fragData;
|
||
|
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;
|
||
|
in highp vec2 xlv_TEXCOORD0;
|
||
|
in highp vec3 xlv_TEXCOORD1;
|
||
|
in highp vec3 xlv_TEXCOORD2;
|
||
|
in highp vec3 xlv_TEXCOORD3;
|
||
|
in 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 = texture (_MainTex, xlv_TEXCOORD0);
|
||
|
lowp float x_11;
|
||
|
x_11 = (tmpvar_10.w - _Cutoff);
|
||
|
if ((x_11 < 0.0)) {
|
||
|
discard;
|
||
|
};
|
||
|
albedo_9 = (tmpvar_10.xyz * xlv_TEXCOORD1);
|
||
|
lowp vec4 tmpvar_12;
|
||
|
tmpvar_12 = texture (_BumpSpecMap, xlv_TEXCOORD0);
|
||
|
specular_8 = (tmpvar_12.x * 128.0);
|
||
|
lowp vec4 tmpvar_13;
|
||
|
tmpvar_13 = texture (_TranslucencyMap, xlv_TEXCOORD0);
|
||
|
gloss_7 = tmpvar_13.w;
|
||
|
light_6 = (UNITY_LIGHTMODEL_AMBIENT.xyz * albedo_9);
|
||
|
backContribs_5 = (xlv_TEXCOORD2 * tmpvar_13.z);
|
||
|
lightColor_4 = _TerrainTreeLightColors[0].xyz;
|
||
|
nl_3 = xlv_TEXCOORD3.x;
|
||
|
nh_2 = xlv_TEXCOORD4.x;
|
||
|
light_6 = (light_6 + ((
|
||
|
(albedo_9 * ((backContribs_5.x * _TranslucencyColor) + nl_3))
|
||
|
+
|
||
|
(_SpecColor.xyz * (pow (nh_2, specular_8) * gloss_7))
|
||
|
) * lightColor_4));
|
||
|
lightColor_4 = _TerrainTreeLightColors[1].xyz;
|
||
|
nl_3 = xlv_TEXCOORD3.y;
|
||
|
nh_2 = xlv_TEXCOORD4.y;
|
||
|
light_6 = (light_6 + ((
|
||
|
(albedo_9 * ((backContribs_5.y * _TranslucencyColor) + nl_3))
|
||
|
+
|
||
|
(_SpecColor.xyz * (pow (nh_2, specular_8) * gloss_7))
|
||
|
) * lightColor_4));
|
||
|
lightColor_4 = _TerrainTreeLightColors[2].xyz;
|
||
|
nl_3 = xlv_TEXCOORD3.z;
|
||
|
nh_2 = xlv_TEXCOORD4.z;
|
||
|
light_6 = (light_6 + ((
|
||
|
(albedo_9 * ((backContribs_5.z * _TranslucencyColor) + nl_3))
|
||
|
+
|
||
|
(_SpecColor.xyz * (pow (nh_2, specular_8) * gloss_7))
|
||
|
) * lightColor_4));
|
||
|
c_1.xyz = (light_6 * 2.0);
|
||
|
c_1.w = 1.0;
|
||
|
_fragData = c_1;
|
||
|
}
|
||
|
|
||
|
|
||
|
// stats: 35 alu 4 tex 1 flow
|
||
|
// inputs: 5
|
||
|
// #0: xlv_TEXCOORD0 (high float) 2x1 [-1]
|
||
|
// #1: xlv_TEXCOORD1 (high float) 3x1 [-1]
|
||
|
// #2: xlv_TEXCOORD2 (high float) 3x1 [-1]
|
||
|
// #3: xlv_TEXCOORD3 (high float) 3x1 [-1]
|
||
|
// #4: xlv_TEXCOORD4 (high float) 3x1 [-1]
|
||
|
// uniforms: 5 (total size: 0)
|
||
|
// #0: UNITY_LIGHTMODEL_AMBIENT (low float) 4x1 [-1]
|
||
|
// #1: _Cutoff (low float) 1x1 [-1]
|
||
|
// #2: _SpecColor (low float) 4x1 [-1]
|
||
|
// #3: _TerrainTreeLightColors (high float) 4x1 [4]
|
||
|
// #4: _TranslucencyColor (low float) 3x1 [-1]
|
||
|
// textures: 3
|
||
|
// #0: _BumpSpecMap (low 2d) 0x0 [-1]
|
||
|
// #1: _MainTex (low 2d) 0x0 [-1]
|
||
|
// #2: _TranslucencyMap (low 2d) 0x0 [-1]
|