mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-04 21:31:11 -05:00
99 lines
2.1 KiB
Text
99 lines
2.1 KiB
Text
|
struct appdata_full {
|
||
|
vec4 vertex;
|
||
|
vec3 normal;
|
||
|
};
|
||
|
struct v2f {
|
||
|
vec4 pos;
|
||
|
vec3 backContrib;
|
||
|
vec3 nl;
|
||
|
};
|
||
|
uniform float _TranslucencyViewDependency;
|
||
|
uniform vec3 _TerrainTreeLightDirections[4];
|
||
|
v2f vert (
|
||
|
in appdata_full v_1
|
||
|
)
|
||
|
{
|
||
|
int j_2;
|
||
|
vec3 viewDir_3;
|
||
|
v2f o_4;
|
||
|
vec4 tmpvar_5;
|
||
|
tmpvar_5 = v_1.vertex;
|
||
|
o_4.pos = tmpvar_5;
|
||
|
vec3 tmpvar_6;
|
||
|
tmpvar_6 = v_1.vertex.xyz;
|
||
|
viewDir_3 = tmpvar_6;
|
||
|
int tmpvar_7;
|
||
|
tmpvar_7 = 0;
|
||
|
j_2 = tmpvar_7;
|
||
|
while (true) {
|
||
|
float backContrib_8;
|
||
|
float nl_9;
|
||
|
vec3 lightDir_10;
|
||
|
if (!((j_2 < 3))) {
|
||
|
break;
|
||
|
};
|
||
|
vec3 tmpvar_11;
|
||
|
tmpvar_11 = _TerrainTreeLightDirections[j_2];
|
||
|
lightDir_10 = tmpvar_11;
|
||
|
float tmpvar_12;
|
||
|
tmpvar_12 = dot (v_1.normal, lightDir_10);
|
||
|
float tmpvar_13;
|
||
|
tmpvar_13 = tmpvar_12;
|
||
|
nl_9 = tmpvar_13;
|
||
|
float tmpvar_14;
|
||
|
tmpvar_14 = dot (viewDir_3, -(lightDir_10));
|
||
|
float tmpvar_15;
|
||
|
tmpvar_15 = tmpvar_14;
|
||
|
backContrib_8 = tmpvar_15;
|
||
|
float tmpvar_16;
|
||
|
tmpvar_16 = mix (-(nl_9), backContrib_8, _TranslucencyViewDependency);
|
||
|
float tmpvar_17;
|
||
|
tmpvar_17 = tmpvar_16;
|
||
|
o_4.backContrib[j_2] = tmpvar_17;
|
||
|
float tmpvar_18;
|
||
|
tmpvar_18 = max (0.0, ((nl_9 * 0.6) + 0.4));
|
||
|
float tmpvar_19;
|
||
|
tmpvar_19 = tmpvar_18;
|
||
|
o_4.nl[j_2] = tmpvar_19;
|
||
|
int _post_incdec_tmp_20;
|
||
|
_post_incdec_tmp_20 = j_2;
|
||
|
int tmpvar_21;
|
||
|
tmpvar_21 = (j_2 + 1);
|
||
|
j_2 = tmpvar_21;
|
||
|
};
|
||
|
return o_4;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
appdata_full xlt_v_22;
|
||
|
v2f xl_retval_23;
|
||
|
vec4 tmpvar_24;
|
||
|
tmpvar_24 = gl_Vertex;
|
||
|
xlt_v_22.vertex = tmpvar_24;
|
||
|
vec3 tmpvar_25;
|
||
|
tmpvar_25 = gl_Normal;
|
||
|
xlt_v_22.normal = tmpvar_25;
|
||
|
v2f tmpvar_26;
|
||
|
tmpvar_26 = vert (xlt_v_22);
|
||
|
v2f tmpvar_27;
|
||
|
tmpvar_27 = tmpvar_26;
|
||
|
xl_retval_23 = tmpvar_27;
|
||
|
vec4 tmpvar_28;
|
||
|
tmpvar_28 = xl_retval_23.pos;
|
||
|
gl_Position = tmpvar_28;
|
||
|
vec4 tmpvar_29;
|
||
|
tmpvar_29.w = 0.0;
|
||
|
tmpvar_29.xyz = xl_retval_23.backContrib.xyz;
|
||
|
vec4 tmpvar_30;
|
||
|
tmpvar_30 = tmpvar_29;
|
||
|
gl_TexCoord[2] = tmpvar_30;
|
||
|
vec4 tmpvar_31;
|
||
|
tmpvar_31.w = 0.0;
|
||
|
tmpvar_31.xyz = xl_retval_23.nl.xyz;
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = tmpvar_31;
|
||
|
gl_TexCoord[3] = tmpvar_32;
|
||
|
}
|
||
|
|