mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
216 lines
5.1 KiB
Text
216 lines
5.1 KiB
Text
struct appdata_full {
|
|
vec4 vertex;
|
|
vec4 tangent;
|
|
vec3 normal;
|
|
vec4 texcoord;
|
|
vec4 texcoord1;
|
|
vec4 color;
|
|
};
|
|
struct v2f_surf {
|
|
vec4 pos;
|
|
vec3 _ShadowCoord0;
|
|
vec3 _ShadowCoord1;
|
|
vec3 _ShadowCoord2;
|
|
vec3 _ShadowCoord3;
|
|
vec2 _ShadowZFade;
|
|
};
|
|
attribute vec4 TANGENT;
|
|
uniform mat4 _World2Shadow3;
|
|
uniform mat4 _World2Shadow2;
|
|
uniform mat4 _World2Shadow1;
|
|
uniform mat4 _World2Shadow;
|
|
uniform mat4 _TerrainEngineBendTree;
|
|
uniform vec4 _SquashPlaneNormal;
|
|
uniform float _SquashAmount;
|
|
uniform vec4 _Scale;
|
|
uniform mat4 _Object2World;
|
|
uniform vec4 _LightShadowData;
|
|
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
|
|
)
|
|
{
|
|
vec4 wpos_29;
|
|
float z_30;
|
|
v2f_surf o_31;
|
|
treevertex (v_28);
|
|
vec4 tmpvar_32;
|
|
tmpvar_32 = (gl_ModelViewProjectionMatrix * v_28.vertex);
|
|
o_31.pos = tmpvar_32;
|
|
float tmpvar_33;
|
|
tmpvar_33 = -((gl_ModelViewMatrix * v_28.vertex).z);
|
|
z_30 = tmpvar_33;
|
|
float tmpvar_34;
|
|
tmpvar_34 = z_30;
|
|
o_31._ShadowZFade.x = tmpvar_34;
|
|
float tmpvar_35;
|
|
tmpvar_35 = ((z_30 * _LightShadowData.z) + _LightShadowData.w);
|
|
o_31._ShadowZFade.y = vec2(tmpvar_35).y;
|
|
vec4 tmpvar_36;
|
|
tmpvar_36 = (_Object2World * v_28.vertex);
|
|
wpos_29 = tmpvar_36;
|
|
vec3 tmpvar_37;
|
|
tmpvar_37 = (_World2Shadow * wpos_29).xyz;
|
|
o_31._ShadowCoord0 = tmpvar_37;
|
|
vec3 tmpvar_38;
|
|
tmpvar_38 = (_World2Shadow1 * wpos_29).xyz;
|
|
o_31._ShadowCoord1 = tmpvar_38;
|
|
vec3 tmpvar_39;
|
|
tmpvar_39 = (_World2Shadow2 * wpos_29).xyz;
|
|
o_31._ShadowCoord2 = tmpvar_39;
|
|
vec3 tmpvar_40;
|
|
tmpvar_40 = (_World2Shadow3 * wpos_29).xyz;
|
|
o_31._ShadowCoord3 = tmpvar_40;
|
|
return o_31;
|
|
}
|
|
|
|
void main ()
|
|
{
|
|
appdata_full xlt_v_41;
|
|
v2f_surf xl_retval_42;
|
|
vec4 tmpvar_43;
|
|
tmpvar_43 = gl_Vertex.xyzw;
|
|
vec4 tmpvar_44;
|
|
tmpvar_44 = tmpvar_43;
|
|
xlt_v_41.vertex = tmpvar_44;
|
|
vec4 tmpvar_45;
|
|
tmpvar_45 = TANGENT.xyzw;
|
|
vec4 tmpvar_46;
|
|
tmpvar_46 = tmpvar_45;
|
|
xlt_v_41.tangent = tmpvar_46;
|
|
vec3 tmpvar_47;
|
|
tmpvar_47 = gl_Normal.xyz;
|
|
vec3 tmpvar_48;
|
|
tmpvar_48 = tmpvar_47;
|
|
xlt_v_41.normal = tmpvar_48;
|
|
vec4 tmpvar_49;
|
|
tmpvar_49 = gl_MultiTexCoord0.xyzw;
|
|
vec4 tmpvar_50;
|
|
tmpvar_50 = tmpvar_49;
|
|
xlt_v_41.texcoord = tmpvar_50;
|
|
vec4 tmpvar_51;
|
|
tmpvar_51 = gl_MultiTexCoord1.xyzw;
|
|
vec4 tmpvar_52;
|
|
tmpvar_52 = tmpvar_51;
|
|
xlt_v_41.texcoord1 = tmpvar_52;
|
|
vec4 tmpvar_53;
|
|
tmpvar_53 = gl_Color.xyzw;
|
|
vec4 tmpvar_54;
|
|
tmpvar_54 = tmpvar_53;
|
|
xlt_v_41.color = tmpvar_54;
|
|
v2f_surf tmpvar_55;
|
|
tmpvar_55 = vert_surf (xlt_v_41);
|
|
v2f_surf tmpvar_56;
|
|
tmpvar_56 = tmpvar_55;
|
|
xl_retval_42 = tmpvar_56;
|
|
vec4 tmpvar_57;
|
|
tmpvar_57 = xl_retval_42.pos.xyzw;
|
|
vec4 tmpvar_58;
|
|
tmpvar_58 = tmpvar_57;
|
|
gl_Position = tmpvar_58;
|
|
vec4 tmpvar_59;
|
|
tmpvar_59.w = 0.0;
|
|
tmpvar_59.xyz = xl_retval_42._ShadowCoord0.xyz;
|
|
vec4 tmpvar_60;
|
|
tmpvar_60 = tmpvar_59;
|
|
gl_TexCoord[0] = tmpvar_60;
|
|
vec4 tmpvar_61;
|
|
tmpvar_61.w = 0.0;
|
|
tmpvar_61.xyz = xl_retval_42._ShadowCoord1.xyz;
|
|
vec4 tmpvar_62;
|
|
tmpvar_62 = tmpvar_61;
|
|
gl_TexCoord[1] = tmpvar_62;
|
|
vec4 tmpvar_63;
|
|
tmpvar_63.w = 0.0;
|
|
tmpvar_63.xyz = xl_retval_42._ShadowCoord2.xyz;
|
|
vec4 tmpvar_64;
|
|
tmpvar_64 = tmpvar_63;
|
|
gl_TexCoord[2] = tmpvar_64;
|
|
vec4 tmpvar_65;
|
|
tmpvar_65.w = 0.0;
|
|
tmpvar_65.xyz = xl_retval_42._ShadowCoord3.xyz;
|
|
vec4 tmpvar_66;
|
|
tmpvar_66 = tmpvar_65;
|
|
gl_TexCoord[3] = tmpvar_66;
|
|
vec4 tmpvar_67;
|
|
tmpvar_67.zw = vec2(0.0, 0.0);
|
|
tmpvar_67.xy = xl_retval_42._ShadowZFade.xy;
|
|
vec4 tmpvar_68;
|
|
tmpvar_68 = tmpvar_67;
|
|
gl_TexCoord[4] = tmpvar_68;
|
|
}
|
|
|