mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
158 lines
3.5 KiB
Text
158 lines
3.5 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
vec3 color;
|
|
vec3 backContrib;
|
|
vec3 nl;
|
|
vec3 nh;
|
|
};
|
|
uniform sampler2D _TranslucencyMap;
|
|
uniform vec3 _TranslucencyColor;
|
|
uniform vec4 _TerrainTreeLightColors[4];
|
|
uniform vec4 _SpecColor;
|
|
uniform sampler2D _MainTex;
|
|
uniform float _Cutoff;
|
|
uniform sampler2D _BumpSpecMap;
|
|
void xll_clip (
|
|
in float x_1
|
|
)
|
|
{
|
|
if ((x_1 < 0.0)) {
|
|
discard;
|
|
};
|
|
}
|
|
|
|
vec4 frag (
|
|
in v2f i_2
|
|
)
|
|
{
|
|
vec4 c_3;
|
|
float spec_4;
|
|
float nh_5;
|
|
float nl_6;
|
|
vec3 translucencyColor_7;
|
|
vec3 lightColor_8;
|
|
int j_9;
|
|
vec3 backContribs_10;
|
|
vec3 light_11;
|
|
float gloss_12;
|
|
vec4 trngls_13;
|
|
float specular_14;
|
|
vec3 albedo_15;
|
|
vec4 col_16;
|
|
int tmpvar_17;
|
|
tmpvar_17 = 0;
|
|
j_9 = tmpvar_17;
|
|
vec4 tmpvar_18;
|
|
tmpvar_18 = texture2D (_MainTex, i_2.uv);
|
|
vec4 tmpvar_19;
|
|
tmpvar_19 = tmpvar_18;
|
|
col_16 = tmpvar_19;
|
|
xll_clip ((col_16.w - _Cutoff));
|
|
vec3 tmpvar_20;
|
|
tmpvar_20 = (col_16.xyz * i_2.color);
|
|
albedo_15 = tmpvar_20;
|
|
vec4 tmpvar_21;
|
|
tmpvar_21 = texture2D (_BumpSpecMap, i_2.uv);
|
|
float tmpvar_22;
|
|
tmpvar_22 = (tmpvar_21.x * 128.0);
|
|
specular_14 = tmpvar_22;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23 = texture2D (_TranslucencyMap, i_2.uv);
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = tmpvar_23;
|
|
trngls_13 = tmpvar_24;
|
|
float tmpvar_25;
|
|
tmpvar_25 = trngls_13.w;
|
|
gloss_12 = tmpvar_25;
|
|
vec3 tmpvar_26;
|
|
tmpvar_26 = gl_LightModel.ambient.xyz;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = (tmpvar_26 * albedo_15);
|
|
light_11 = tmpvar_27;
|
|
vec3 tmpvar_28;
|
|
tmpvar_28 = (i_2.backContrib * trngls_13.z);
|
|
backContribs_10 = tmpvar_28;
|
|
while (true) {
|
|
if (!((j_9 < 3))) {
|
|
break;
|
|
};
|
|
vec3 tmpvar_29;
|
|
tmpvar_29 = _TerrainTreeLightColors[j_9].xyz;
|
|
lightColor_8 = tmpvar_29;
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = (backContribs_10[j_9] * _TranslucencyColor);
|
|
translucencyColor_7 = tmpvar_30;
|
|
float tmpvar_31;
|
|
tmpvar_31 = i_2.nl[j_9];
|
|
nl_6 = tmpvar_31;
|
|
float tmpvar_32;
|
|
tmpvar_32 = i_2.nh[j_9];
|
|
nh_5 = tmpvar_32;
|
|
float tmpvar_33;
|
|
tmpvar_33 = pow (nh_5, specular_14);
|
|
float tmpvar_34;
|
|
tmpvar_34 = (tmpvar_33 * gloss_12);
|
|
spec_4 = tmpvar_34;
|
|
vec3 tmpvar_35;
|
|
tmpvar_35 = (light_11 + (((albedo_15 * (translucencyColor_7 + nl_6)) + (_SpecColor.xyz * spec_4)) * lightColor_8));
|
|
light_11 = tmpvar_35;
|
|
int _post_incdec_tmp_36;
|
|
_post_incdec_tmp_36 = j_9;
|
|
int tmpvar_37;
|
|
tmpvar_37 = (j_9 + 1);
|
|
j_9 = tmpvar_37;
|
|
};
|
|
vec3 tmpvar_38;
|
|
tmpvar_38 = (light_11 * 2.0);
|
|
c_3.xyz = tmpvar_38.xyz.xyz;
|
|
float tmpvar_39;
|
|
tmpvar_39 = 1.0;
|
|
c_3.w = vec4(tmpvar_39).w;
|
|
return c_3;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
v2f xlt_i_40;
|
|
vec4 xl_retval_41;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
xlt_i_40.pos = tmpvar_42;
|
|
vec2 tmpvar_43;
|
|
tmpvar_43 = gl_TexCoord[0].xy;
|
|
vec2 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xlt_i_40.uv = tmpvar_44;
|
|
vec3 tmpvar_45;
|
|
tmpvar_45 = gl_TexCoord[1].xyz;
|
|
vec3 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
xlt_i_40.color = tmpvar_46;
|
|
vec3 tmpvar_47;
|
|
tmpvar_47 = gl_TexCoord[2].xyz;
|
|
vec3 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
xlt_i_40.backContrib = tmpvar_48;
|
|
vec3 tmpvar_49;
|
|
tmpvar_49 = gl_TexCoord[3].xyz;
|
|
vec3 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
xlt_i_40.nl = tmpvar_50;
|
|
vec3 tmpvar_51;
|
|
tmpvar_51 = gl_TexCoord[4].xyz;
|
|
vec3 tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
xlt_i_40.nh = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = frag (xlt_i_40);
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = tmpvar_53;
|
|
xl_retval_41 = tmpvar_54;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55 = xl_retval_41.xyzw;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = tmpvar_55;
|
|
gl_FragData[0] = tmpvar_56;
|
|
}
|
|
|