bgfx/3rdparty/glsl-optimizer/tests/fragment/z-treeleafloop-inES.txt
2012-10-07 20:41:18 -07:00

82 lines
2.3 KiB
Plaintext

void xll_clip(float x) {
if ( x<0.0 ) discard;
}
#line 11
struct v2f {
highp vec4 pos;
highp vec2 uv;
highp vec3 color;
highp vec3 backContrib;
highp vec3 nl;
highp vec3 nh;
};
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;
lowp vec4 xlat_main( in v2f i );
#line 30
lowp vec4 xlat_main( in v2f i ) {
lowp vec4 col;
lowp vec3 albedo;
mediump float specular;
lowp vec4 trngls;
mediump float gloss;
mediump vec3 light;
mediump vec3 backContribs;
highp int j = 0;
mediump vec3 lightColor;
mediump vec3 translucencyColor;
mediump float nl;
mediump float nh;
mediump float spec;
lowp vec4 c;
col = texture2D( _MainTex, i.uv);
xll_clip((col.w - _Cutoff));
#line 35
albedo = (col.xyz * i.color);
specular = (texture2D( _BumpSpecMap, i.uv).x * 128.000);
#line 39
trngls = texture2D( _TranslucencyMap, i.uv);
gloss = trngls.w;
light = (vec3( UNITY_LIGHTMODEL_AMBIENT) * albedo);
#line 44
backContribs = (i.backContrib * trngls.z);
for ( ; (j < 3); (j++)) {
#line 48
lightColor = _TerrainTreeLightColors[j].xyz;
translucencyColor = (backContribs[j] * _TranslucencyColor);
nl = i.nl[j];
#line 52
nh = i.nh[j];
spec = (pow( nh, specular) * gloss);
light += (((albedo * (translucencyColor + nl)) + (_SpecColor.xyz * spec)) * lightColor);
}
#line 58
c.xyz = (light * 2.00000);
c.w = 1.00000;
return c;
}
varying highp vec4 xlv_SV_POSITION;
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 xl_retval;
v2f xlt_i;
xlt_i.pos = vec4( xlv_SV_POSITION);
xlt_i.uv = vec2( xlv_TEXCOORD0);
xlt_i.color = vec3( xlv_TEXCOORD1);
xlt_i.backContrib = vec3( xlv_TEXCOORD2);
xlt_i.nl = vec3( xlv_TEXCOORD3);
xlt_i.nh = vec3( xlv_TEXCOORD4);
xl_retval = xlat_main( xlt_i);
gl_FragData[0] = vec4( xl_retval);
}