mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-11 00:31:28 -05:00
173 lines
3.9 KiB
Text
173 lines
3.9 KiB
Text
|
struct appdata_full {
|
||
|
vec4 vertex;
|
||
|
vec4 tangent;
|
||
|
vec3 normal;
|
||
|
vec4 texcoord;
|
||
|
vec4 texcoord1;
|
||
|
vec4 color;
|
||
|
};
|
||
|
struct v2f_surf {
|
||
|
vec4 pos;
|
||
|
vec3 vec;
|
||
|
vec2 hip_pack0;
|
||
|
};
|
||
|
attribute vec4 TANGENT;
|
||
|
uniform mat4 _TerrainEngineBendTree;
|
||
|
uniform vec4 _SquashPlaneNormal;
|
||
|
uniform float _SquashAmount;
|
||
|
uniform vec4 _Scale;
|
||
|
uniform mat4 _Object2World;
|
||
|
uniform vec4 _MainTex_ST;
|
||
|
uniform vec4 _LightPositionRange;
|
||
|
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);
|
||
|
vec2 tmpvar_30;
|
||
|
tmpvar_30 = ((v_28.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
||
|
o_29.hip_pack0 = tmpvar_30.xy.xy;
|
||
|
vec3 tmpvar_31;
|
||
|
tmpvar_31 = ((_Object2World * v_28.vertex).xyz - _LightPositionRange.xyz);
|
||
|
o_29.vec = tmpvar_31;
|
||
|
vec4 tmpvar_32;
|
||
|
tmpvar_32 = (gl_ModelViewProjectionMatrix * v_28.vertex);
|
||
|
o_29.pos = tmpvar_32;
|
||
|
return o_29;
|
||
|
}
|
||
|
|
||
|
void main ()
|
||
|
{
|
||
|
appdata_full xlt_v_33;
|
||
|
v2f_surf xl_retval_34;
|
||
|
vec4 tmpvar_35;
|
||
|
tmpvar_35 = gl_Vertex.xyzw;
|
||
|
vec4 tmpvar_36;
|
||
|
tmpvar_36 = tmpvar_35;
|
||
|
xlt_v_33.vertex = tmpvar_36;
|
||
|
vec4 tmpvar_37;
|
||
|
tmpvar_37 = TANGENT.xyzw;
|
||
|
vec4 tmpvar_38;
|
||
|
tmpvar_38 = tmpvar_37;
|
||
|
xlt_v_33.tangent = tmpvar_38;
|
||
|
vec3 tmpvar_39;
|
||
|
tmpvar_39 = gl_Normal.xyz;
|
||
|
vec3 tmpvar_40;
|
||
|
tmpvar_40 = tmpvar_39;
|
||
|
xlt_v_33.normal = tmpvar_40;
|
||
|
vec4 tmpvar_41;
|
||
|
tmpvar_41 = gl_MultiTexCoord0.xyzw;
|
||
|
vec4 tmpvar_42;
|
||
|
tmpvar_42 = tmpvar_41;
|
||
|
xlt_v_33.texcoord = tmpvar_42;
|
||
|
vec4 tmpvar_43;
|
||
|
tmpvar_43 = gl_MultiTexCoord1.xyzw;
|
||
|
vec4 tmpvar_44;
|
||
|
tmpvar_44 = tmpvar_43;
|
||
|
xlt_v_33.texcoord1 = tmpvar_44;
|
||
|
vec4 tmpvar_45;
|
||
|
tmpvar_45 = gl_Color.xyzw;
|
||
|
vec4 tmpvar_46;
|
||
|
tmpvar_46 = tmpvar_45;
|
||
|
xlt_v_33.color = tmpvar_46;
|
||
|
v2f_surf tmpvar_47;
|
||
|
tmpvar_47 = vert_surf (xlt_v_33);
|
||
|
v2f_surf tmpvar_48;
|
||
|
tmpvar_48 = tmpvar_47;
|
||
|
xl_retval_34 = tmpvar_48;
|
||
|
vec4 tmpvar_49;
|
||
|
tmpvar_49 = xl_retval_34.pos.xyzw;
|
||
|
vec4 tmpvar_50;
|
||
|
tmpvar_50 = tmpvar_49;
|
||
|
gl_Position = tmpvar_50;
|
||
|
vec4 tmpvar_51;
|
||
|
tmpvar_51.w = 0.0;
|
||
|
tmpvar_51.xyz = xl_retval_34.vec.xyz;
|
||
|
vec4 tmpvar_52;
|
||
|
tmpvar_52 = tmpvar_51;
|
||
|
gl_TexCoord[0] = tmpvar_52;
|
||
|
vec4 tmpvar_53;
|
||
|
tmpvar_53.zw = vec2(0.0, 0.0);
|
||
|
tmpvar_53.xy = xl_retval_34.hip_pack0.xy;
|
||
|
vec4 tmpvar_54;
|
||
|
tmpvar_54 = tmpvar_53;
|
||
|
gl_TexCoord[1] = tmpvar_54;
|
||
|
}
|
||
|
|