mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
212 lines
4.6 KiB
Text
212 lines
4.6 KiB
Text
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
float fog;
|
|
vec2 hip_pack0;
|
|
vec4 hip_screen;
|
|
};
|
|
uniform vec4 _MainTex_ST;
|
|
uniform vec4 _ProjectionParams;
|
|
uniform vec4 _Scale;
|
|
uniform float _SquashAmount;
|
|
uniform vec4 _SquashPlaneNormal;
|
|
uniform mat4 _TerrainEngineBendTree;
|
|
attribute vec4 TANGENT;
|
|
varying vec4 xlv_FOG;
|
|
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);
|
|
}
|
|
|
|
void PositionFog (
|
|
in vec4 v_28,
|
|
out vec4 pos_29,
|
|
out float fog_30
|
|
)
|
|
{
|
|
vec4 tmpvar_31;
|
|
tmpvar_31 = (gl_ModelViewProjectionMatrix * v_28);
|
|
pos_29 = tmpvar_31;
|
|
float tmpvar_32;
|
|
tmpvar_32 = pos_29.z;
|
|
fog_30 = tmpvar_32;
|
|
}
|
|
|
|
vec4 ComputeScreenPos (
|
|
in vec4 pos_33
|
|
)
|
|
{
|
|
vec4 o_34;
|
|
vec4 tmpvar_35;
|
|
tmpvar_35 = (pos_33 * 0.5);
|
|
o_34 = tmpvar_35;
|
|
vec2 tmpvar_36;
|
|
tmpvar_36.x = o_34.x;
|
|
tmpvar_36.y = (o_34.y * _ProjectionParams.x);
|
|
vec2 tmpvar_37;
|
|
tmpvar_37 = (tmpvar_36 + o_34.w);
|
|
o_34.xy = tmpvar_37.xy.xy;
|
|
vec2 tmpvar_38;
|
|
tmpvar_38 = pos_33.zw;
|
|
o_34.zw = tmpvar_38.xxxy.zw;
|
|
return o_34;
|
|
}
|
|
|
|
v2f_surf vert_surf (
|
|
in appdata_full v_39
|
|
)
|
|
{
|
|
v2f_surf o_40;
|
|
treevertex (v_39);
|
|
PositionFog (v_39.vertex, o_40.pos, o_40.fog);
|
|
vec2 tmpvar_41;
|
|
tmpvar_41 = ((v_39.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
|
|
o_40.hip_pack0 = tmpvar_41.xy.xy;
|
|
vec4 tmpvar_42;
|
|
tmpvar_42 = ComputeScreenPos (o_40.pos);
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = tmpvar_42;
|
|
o_40.hip_screen = tmpvar_43;
|
|
return o_40;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_44;
|
|
v2f_surf xl_retval_45;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_47;
|
|
tmpvar_47 = tmpvar_46;
|
|
xlt_v_44.vertex = tmpvar_47;
|
|
vec4 tmpvar_48;
|
|
tmpvar_48 = TANGENT.xyzw;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = tmpvar_48;
|
|
xlt_v_44.tangent = tmpvar_49;
|
|
vec3 tmpvar_50;
|
|
tmpvar_50 = gl_Normal.xyz;
|
|
vec3 tmpvar_51;
|
|
tmpvar_51 = tmpvar_50;
|
|
xlt_v_44.normal = tmpvar_51;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = tmpvar_52;
|
|
xlt_v_44.texcoord = tmpvar_53;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_55;
|
|
tmpvar_55 = tmpvar_54;
|
|
xlt_v_44.texcoord1 = tmpvar_55;
|
|
vec4 tmpvar_56;
|
|
tmpvar_56 = gl_Color.xyzw;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57 = tmpvar_56;
|
|
xlt_v_44.color = tmpvar_57;
|
|
v2f_surf tmpvar_58;
|
|
tmpvar_58 = vert_surf (xlt_v_44);
|
|
v2f_surf tmpvar_59;
|
|
tmpvar_59 = tmpvar_58;
|
|
xl_retval_45 = tmpvar_59;
|
|
vec4 tmpvar_60;
|
|
tmpvar_60 = xl_retval_45.pos.xyzw;
|
|
vec4 tmpvar_61;
|
|
tmpvar_61 = tmpvar_60;
|
|
gl_Position = tmpvar_61;
|
|
vec4 tmpvar_62;
|
|
tmpvar_62.yzw = vec3(0.0, 0.0, 0.0);
|
|
tmpvar_62.x = xl_retval_45.fog;
|
|
vec4 tmpvar_63;
|
|
tmpvar_63 = tmpvar_62;
|
|
xlv_FOG = tmpvar_63;
|
|
vec4 tmpvar_64;
|
|
tmpvar_64.zw = vec2(0.0, 0.0);
|
|
tmpvar_64.xy = xl_retval_45.hip_pack0.xy;
|
|
vec4 tmpvar_65;
|
|
tmpvar_65 = tmpvar_64;
|
|
gl_TexCoord[0] = tmpvar_65;
|
|
vec4 tmpvar_66;
|
|
tmpvar_66 = xl_retval_45.hip_screen.xyzw;
|
|
vec4 tmpvar_67;
|
|
tmpvar_67 = tmpvar_66;
|
|
gl_TexCoord[1] = tmpvar_67;
|
|
}
|
|
|