mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-29 02:55:36 -05:00
161 lines
3.5 KiB
Text
161 lines
3.5 KiB
Text
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
vec3 vec;
|
|
};
|
|
uniform vec4 _LightPositionRange;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _Scale;
|
|
uniform float _SquashAmount;
|
|
uniform vec4 _SquashPlaneNormal;
|
|
uniform mat4 _TerrainEngineBendTree;
|
|
attribute vec4 TANGENT;
|
|
vec4 Squash (
|
|
in vec4 pos_1
|
|
)
|
|
{
|
|
vec3 planeNormal_2;
|
|
vec3 planePoint_3;
|
|
vec3 projectedVertex_4;
|
|
vec3 tmpvar_5;
|
|
tmpvar_5 = pos_1.xyz;
|
|
projectedVertex_4 = tmpvar_5;
|
|
vec3 tmpvar_6;
|
|
tmpvar_6.xz = vec2(0.0, 0.0);
|
|
tmpvar_6.y = _SquashPlaneNormal.w;
|
|
vec3 tmpvar_7;
|
|
tmpvar_7 = tmpvar_6;
|
|
planePoint_3 = tmpvar_7;
|
|
vec3 tmpvar_8;
|
|
tmpvar_8 = _SquashPlaneNormal.xyz;
|
|
planeNormal_2 = tmpvar_8;
|
|
vec3 tmpvar_9;
|
|
tmpvar_9 = pos_1.xyz;
|
|
float tmpvar_10;
|
|
tmpvar_10 = dot (planeNormal_2, (planePoint_3 - tmpvar_9));
|
|
vec3 tmpvar_11;
|
|
tmpvar_11 = (projectedVertex_4 + (tmpvar_10 * planeNormal_2));
|
|
projectedVertex_4 = tmpvar_11;
|
|
vec3 tmpvar_12;
|
|
tmpvar_12 = vec3(_SquashAmount);
|
|
vec3 tmpvar_13;
|
|
tmpvar_13 = mix (projectedVertex_4, pos_1.xyz, tmpvar_12);
|
|
vec4 tmpvar_14;
|
|
tmpvar_14.w = 1.0;
|
|
tmpvar_14.xyz = tmpvar_13.xyz;
|
|
vec4 tmpvar_15;
|
|
tmpvar_15 = tmpvar_14;
|
|
pos_1 = tmpvar_15;
|
|
return pos_1;
|
|
}
|
|
|
|
void TerrainAnimateTree (
|
|
inout vec4 pos_16,
|
|
in float alpha_17
|
|
)
|
|
{
|
|
vec3 bent_18;
|
|
vec3 tmpvar_19;
|
|
tmpvar_19 = (pos_16.xyz * _Scale.xyz);
|
|
pos_16.xyz = tmpvar_19.xyz.xyz;
|
|
vec4 tmpvar_20;
|
|
tmpvar_20.w = 0.0;
|
|
tmpvar_20.xyz = pos_16.xyz.xyz;
|
|
vec3 tmpvar_21;
|
|
tmpvar_21 = (_TerrainEngineBendTree * tmpvar_20).xyz;
|
|
bent_18 = tmpvar_21;
|
|
vec3 tmpvar_22;
|
|
tmpvar_22 = vec3(alpha_17);
|
|
vec3 tmpvar_23;
|
|
tmpvar_23 = mix (pos_16.xyz, bent_18, tmpvar_22);
|
|
vec3 tmpvar_24;
|
|
tmpvar_24 = tmpvar_23;
|
|
pos_16.xyz = tmpvar_24.xyz.xyz;
|
|
vec4 tmpvar_25;
|
|
tmpvar_25 = Squash (pos_16);
|
|
vec4 tmpvar_26;
|
|
tmpvar_26 = tmpvar_25;
|
|
pos_16 = tmpvar_26;
|
|
}
|
|
|
|
void treevertex (
|
|
inout appdata_full v_27
|
|
)
|
|
{
|
|
TerrainAnimateTree (v_27.vertex, v_27.color.w);
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_28
|
|
)
|
|
{
|
|
v2f_surf o_29;
|
|
treevertex (v_28);
|
|
vec3 tmpvar_30;
|
|
tmpvar_30 = ((_Object2World * v_28.vertex).xyz - _LightPositionRange.xyz);
|
|
o_29.vec = tmpvar_30;
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = (gl_ModelViewProjectionMatrix * v_28.vertex);
|
|
o_29.pos = tmpvar_31;
|
|
return o_29;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_32;
|
|
v2f_surf xl_retval_33;
|
|
vec4 tmpvar_34;
|
|
tmpvar_34 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = tmpvar_34;
|
|
xlt_v_32.vertex = tmpvar_35;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = TANGENT.xyzw;
|
|
vec4 tmpvar_37;
|
|
tmpvar_37 = tmpvar_36;
|
|
xlt_v_32.tangent = tmpvar_37;
|
|
vec3 tmpvar_38;
|
|
tmpvar_38 = gl_Normal.xyz;
|
|
vec3 tmpvar_39;
|
|
tmpvar_39 = tmpvar_38;
|
|
xlt_v_32.normal = tmpvar_39;
|
|
vec4 tmpvar_40;
|
|
tmpvar_40 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_41;
|
|
tmpvar_41 = tmpvar_40;
|
|
xlt_v_32.texcoord = tmpvar_41;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = tmpvar_42;
|
|
xlt_v_32.texcoord1 = tmpvar_43;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = gl_Color.xyzw;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = tmpvar_44;
|
|
xlt_v_32.color = tmpvar_45;
|
|
v2f_surf tmpvar_46;
|
|
tmpvar_46 = vert_surf (xlt_v_32);
|
|
v2f_surf tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
xl_retval_33 = tmpvar_47;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = xl_retval_33.pos.xyzw;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = tmpvar_48;
|
|
gl_Position = tmpvar_49;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50.w = 0.0;
|
|
tmpvar_50.xyz = xl_retval_33.vec.xyz;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = tmpvar_50;
|
|
gl_TexCoord[0] = tmpvar_51;
|
|
}
|
|
|