mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
126 lines
2.8 KiB
Text
126 lines
2.8 KiB
Text
struct v2f {
|
|
vec4 pos;
|
|
vec2 uv;
|
|
vec3 color;
|
|
};
|
|
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
uniform vec4 _TerrainTreeLightColors[4];
|
|
uniform vec3 _TerrainTreeLightDirections[4];
|
|
attribute vec4 TANGENT;
|
|
v2f vert (
|
|
in appdata_full v_1
|
|
)
|
|
{
|
|
float diff_2;
|
|
vec3 lightDir_3;
|
|
int i_4;
|
|
vec3 lightColor_5;
|
|
v2f o_6;
|
|
int tmpvar_7;
|
|
tmpvar_7 = 0;
|
|
i_4 = tmpvar_7;
|
|
vec4 tmpvar_8;
|
|
tmpvar_8 = (gl_ModelViewProjectionMatrix * v_1.vertex);
|
|
o_6.pos = tmpvar_8;
|
|
vec2 tmpvar_9;
|
|
tmpvar_9 = v_1.texcoord.xy;
|
|
o_6.uv = tmpvar_9;
|
|
vec3 tmpvar_10;
|
|
tmpvar_10 = gl_LightModel.ambient.xyz;
|
|
lightColor_5 = tmpvar_10;
|
|
while (true) {
|
|
if (!((i_4 < 4))) {
|
|
break;
|
|
};
|
|
vec3 tmpvar_11;
|
|
tmpvar_11 = _TerrainTreeLightDirections[i_4];
|
|
lightDir_3 = tmpvar_11.xyz.xyz;
|
|
float tmpvar_12;
|
|
tmpvar_12 = dot (lightDir_3.xyz, v_1.normal);
|
|
float tmpvar_13;
|
|
tmpvar_13 = max (0.0, tmpvar_12);
|
|
float tmpvar_14;
|
|
tmpvar_14 = tmpvar_13;
|
|
diff_2 = tmpvar_14;
|
|
vec3 tmpvar_15;
|
|
tmpvar_15 = (_TerrainTreeLightColors[i_4] * diff_2).xyz;
|
|
vec3 tmpvar_16;
|
|
tmpvar_16 = (lightColor_5 + tmpvar_15);
|
|
lightColor_5 = tmpvar_16;
|
|
int _post_incdec_tmp_17;
|
|
_post_incdec_tmp_17 = i_4;
|
|
int tmpvar_18;
|
|
tmpvar_18 = (i_4 + 1);
|
|
i_4 = tmpvar_18;
|
|
};
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = (lightColor_5 * v_1.color.w);
|
|
o_6.color = tmpvar_19;
|
|
return o_6;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_20;
|
|
v2f xl_retval_21;
|
|
vec4 tmpvar_22;
|
|
tmpvar_22 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_23;
|
|
tmpvar_23 = tmpvar_22;
|
|
xlt_v_20.vertex = tmpvar_23;
|
|
vec4 tmpvar_24;
|
|
tmpvar_24 = TANGENT.xyzw;
|
|
vec4 tmpvar_25;
|
|
tmpvar_25 = tmpvar_24;
|
|
xlt_v_20.tangent = tmpvar_25;
|
|
vec3 tmpvar_26;
|
|
tmpvar_26 = gl_Normal.xyz;
|
|
vec3 tmpvar_27;
|
|
tmpvar_27 = tmpvar_26;
|
|
xlt_v_20.normal = tmpvar_27;
|
|
vec4 tmpvar_28;
|
|
tmpvar_28 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_29;
|
|
tmpvar_29 = tmpvar_28;
|
|
xlt_v_20.texcoord = tmpvar_29;
|
|
vec4 tmpvar_30;
|
|
tmpvar_30 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = tmpvar_30;
|
|
xlt_v_20.texcoord1 = tmpvar_31;
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = gl_Color.xyzw;
|
|
vec4 tmpvar_33;
|
|
tmpvar_33 = tmpvar_32;
|
|
xlt_v_20.color = tmpvar_33;
|
|
v2f tmpvar_34;
|
|
tmpvar_34 = vert (xlt_v_20);
|
|
v2f tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
xl_retval_21 = tmpvar_35;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = xl_retval_21.pos.xyzw;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
gl_Position = tmpvar_37;
|
|
vec4 tmpvar_38;
|
|
tmpvar_38.zw = vec2(0.0, 0.0);
|
|
tmpvar_38.xy = xl_retval_21.uv.xy;
|
|
vec4 tmpvar_39;
|
|
tmpvar_39 = tmpvar_38;
|
|
gl_TexCoord[0] = tmpvar_39;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40.w = 0.0;
|
|
tmpvar_40.xyz = xl_retval_21.color.xyz;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = tmpvar_40;
|
|
gl_TexCoord[1] = tmpvar_41;
|
|
}
|
|
|