bgfx/3rdparty/glsl-optimizer/tests/vertex/z-treeleaf-ir.txt
2012-10-07 20:41:18 -07:00

428 lines
10 KiB
Text

struct appdata_full {
vec4 vertex;
vec4 tangent;
vec3 normal;
vec4 texcoord;
vec4 texcoord1;
vec4 color;
};
struct v2f_surf {
vec4 pos;
vec2 hip_pack0;
vec4 lop_color;
vec3 lightDir;
vec3 viewDir;
vec2 _LightCoord;
};
varying vec2 xlv_TEXCOORD3;
varying vec3 xlv_TEXCOORD2;
varying vec3 xlv_TEXCOORD1;
varying vec4 xlv_COLOR0;
varying vec2 xlv_TEXCOORD0;
attribute vec4 TANGENT;
uniform vec4 unity_Scale;
uniform mat4 glstate_matrix_mvp;
uniform mat4 glstate_matrix_invtrans_modelview0;
uniform vec4 _WorldSpaceLightPos0;
uniform vec3 _WorldSpaceCameraPos;
uniform mat4 _World2Object;
uniform vec4 _Wind;
uniform vec4 _Time;
uniform vec4 _SquashPlaneNormal;
uniform float _SquashAmount;
uniform vec4 _Scale;
uniform mat4 _Object2World;
uniform vec4 _MainTex_ST;
uniform mat4 _LightMatrix0;
vec4 Squash (
in vec4 pos_1
)
{
vec3 projectedVertex_2;
vec3 planeNormal_3;
vec3 tmpvar_4;
tmpvar_4 = _SquashPlaneNormal.xyz;
planeNormal_3 = tmpvar_4;
vec3 tmpvar_5;
tmpvar_5 = pos_1.xyz;
float tmpvar_6;
tmpvar_6 = dot (planeNormal_3, tmpvar_5);
vec3 tmpvar_7;
tmpvar_7 = (pos_1.xyz - ((tmpvar_6 + _SquashPlaneNormal.w) * planeNormal_3));
projectedVertex_2 = tmpvar_7;
vec3 tmpvar_8;
tmpvar_8 = vec3(_SquashAmount);
vec3 tmpvar_9;
tmpvar_9 = mix (projectedVertex_2, pos_1.xyz, tmpvar_8);
vec4 tmpvar_10;
tmpvar_10.w = 1.0;
tmpvar_10.xyz = tmpvar_9.xyz;
vec4 tmpvar_11;
tmpvar_11 = tmpvar_10;
pos_1 = tmpvar_11;
return pos_1;
}
void ExpandBillboard (
in mat4 mat_12,
inout vec4 pos_13,
inout vec3 normal_14,
inout vec4 tangent_15
)
{
vec3 tanb_16;
vec3 norb_17;
float isBillboard_18;
float tmpvar_19;
tmpvar_19 = abs (tangent_15.w);
float tmpvar_20;
tmpvar_20 = (1.0 - tmpvar_19);
isBillboard_18 = tmpvar_20;
vec4 tmpvar_21;
tmpvar_21.w = 0.0;
tmpvar_21.xyz = normal_14.xyz;
vec4 tmpvar_22;
tmpvar_22 = normalize ((tmpvar_21 * mat_12));
vec3 tmpvar_23;
tmpvar_23 = tmpvar_22.xyz;
vec3 tmpvar_24;
tmpvar_24 = tmpvar_23;
norb_17 = tmpvar_24;
vec4 tmpvar_25;
tmpvar_25.w = 0.0;
tmpvar_25.xyz = tangent_15.xyz.xyz;
vec4 tmpvar_26;
tmpvar_26 = normalize ((tmpvar_25 * mat_12));
vec3 tmpvar_27;
tmpvar_27 = tmpvar_26.xyz;
vec3 tmpvar_28;
tmpvar_28 = tmpvar_27;
tanb_16 = tmpvar_28;
vec4 tmpvar_29;
tmpvar_29.zw = vec2(0.0, 0.0);
tmpvar_29.xy = normal_14.xy.xy;
vec4 tmpvar_30;
tmpvar_30 = (pos_13 + ((tmpvar_29 * mat_12) * isBillboard_18));
pos_13 = tmpvar_30;
vec3 tmpvar_31;
tmpvar_31 = vec3(isBillboard_18);
vec3 tmpvar_32;
tmpvar_32 = mix (normal_14, norb_17, tmpvar_31);
vec3 tmpvar_33;
tmpvar_33 = tmpvar_32;
normal_14 = tmpvar_33;
vec4 tmpvar_34;
tmpvar_34.w = -1.0;
tmpvar_34.xyz = tanb_16.xyz;
vec4 tmpvar_35;
tmpvar_35 = vec4(isBillboard_18);
vec4 tmpvar_36;
tmpvar_36 = mix (tangent_15, tmpvar_34, tmpvar_35);
vec4 tmpvar_37;
tmpvar_37 = tmpvar_36;
tangent_15 = tmpvar_37;
}
vec4 TriangleWave (
in vec4 x_38
)
{
vec4 tmpvar_39;
tmpvar_39 = fract ((x_38 + 0.5));
vec4 tmpvar_40;
tmpvar_40 = abs (((tmpvar_39 * 2.0) - 1.0));
return tmpvar_40;
}
vec4 SmoothCurve (
in vec4 x_41
)
{
return ((x_41 * x_41) * (3.0 - (2.0 * x_41)));
}
vec4 SmoothTriangleWave (
in vec4 x_42
)
{
vec4 tmpvar_43;
tmpvar_43 = TriangleWave (x_42);
vec4 tmpvar_44;
tmpvar_44 = SmoothCurve (tmpvar_43);
return tmpvar_44;
}
vec4 AnimateVertex (
in vec4 pos_45,
in vec3 normal_46,
in vec4 animParams_47
)
{
vec3 bend_48;
vec2 vWavesSum_49;
vec4 vWaves_50;
vec2 vWavesIn_51;
float fVtxPhase_52;
float fBranchPhase_53;
float fObjPhase_54;
float fBranchAmp_55;
float fDetailAmp_56;
float tmpvar_57;
tmpvar_57 = 0.1;
fDetailAmp_56 = tmpvar_57;
float tmpvar_58;
tmpvar_58 = 0.3;
fBranchAmp_55 = tmpvar_58;
float tmpvar_59;
tmpvar_59 = dot (_Object2World[3].xyz, vec3(1.0, 1.0, 1.0));
float tmpvar_60;
tmpvar_60 = tmpvar_59;
fObjPhase_54 = tmpvar_60;
float tmpvar_61;
tmpvar_61 = (fObjPhase_54 + animParams_47.x);
fBranchPhase_53 = tmpvar_61;
vec3 tmpvar_62;
tmpvar_62 = vec3((animParams_47.y + fBranchPhase_53));
float tmpvar_63;
tmpvar_63 = dot (pos_45.xyz, tmpvar_62);
float tmpvar_64;
tmpvar_64 = tmpvar_63;
fVtxPhase_52 = tmpvar_64;
vec2 tmpvar_65;
tmpvar_65.x = fVtxPhase_52;
tmpvar_65.y = fBranchPhase_53;
vec2 tmpvar_66;
tmpvar_66 = (_Time.yy + tmpvar_65);
vWavesIn_51 = tmpvar_66;
vec4 tmpvar_67;
tmpvar_67 = fract ((vWavesIn_51.xxyy * vec4(1.975, 0.793, 0.375, 0.193)));
vec4 tmpvar_68;
tmpvar_68 = ((tmpvar_67 * 2.0) - 1.0);
vWaves_50 = tmpvar_68;
vec4 tmpvar_69;
tmpvar_69 = SmoothTriangleWave (vWaves_50);
vec4 tmpvar_70;
tmpvar_70 = tmpvar_69;
vWaves_50 = tmpvar_70;
vec2 tmpvar_71;
tmpvar_71 = (vWaves_50.xz + vWaves_50.yw);
vWavesSum_49 = tmpvar_71;
vec3 tmpvar_72;
tmpvar_72 = ((animParams_47.y * fDetailAmp_56) * normal_46.xyz);
bend_48 = tmpvar_72;
float tmpvar_73;
tmpvar_73 = (animParams_47.w * fBranchAmp_55);
bend_48.y = vec2(tmpvar_73).y;
vec3 tmpvar_74;
tmpvar_74 = (pos_45.xyz + (((vWavesSum_49.xyx * bend_48) + ((_Wind.xyz * vWavesSum_49.y) * animParams_47.w)) * _Wind.w));
pos_45.xyz = tmpvar_74.xyz.xyz;
vec3 tmpvar_75;
tmpvar_75 = (pos_45.xyz + (animParams_47.z * _Wind.xyz));
pos_45.xyz = tmpvar_75.xyz.xyz;
return pos_45;
}
void TreeVertLeaf (
inout appdata_full v_76
)
{
ExpandBillboard (glstate_matrix_invtrans_modelview0, v_76.vertex, v_76.normal, v_76.tangent);
vec3 tmpvar_77;
tmpvar_77 = (v_76.vertex.xyz * _Scale.xyz);
v_76.vertex.xyz = tmpvar_77.xyz.xyz;
vec4 tmpvar_78;
tmpvar_78.xy = v_76.color.xy.xy;
tmpvar_78.zw = v_76.texcoord1.xy.xy;
vec4 tmpvar_79;
tmpvar_79 = AnimateVertex (v_76.vertex, v_76.normal, tmpvar_78);
vec4 tmpvar_80;
tmpvar_80 = tmpvar_79;
v_76.vertex = tmpvar_80;
vec4 tmpvar_81;
tmpvar_81 = Squash (v_76.vertex);
vec4 tmpvar_82;
tmpvar_82 = tmpvar_81;
v_76.vertex = tmpvar_82;
vec4 tmpvar_83;
tmpvar_83.xyz = vec3(1.0, 1.0, 1.0);
tmpvar_83.w = v_76.color.w;
vec4 tmpvar_84;
tmpvar_84 = tmpvar_83;
v_76.color = tmpvar_84;
vec3 tmpvar_85;
tmpvar_85 = normalize (v_76.normal);
vec3 tmpvar_86;
tmpvar_86 = tmpvar_85;
v_76.normal = tmpvar_86;
vec3 tmpvar_87;
tmpvar_87 = normalize (v_76.tangent.xyz);
vec3 tmpvar_88;
tmpvar_88 = tmpvar_87;
v_76.tangent.xyz = tmpvar_88.xyz.xyz;
}
vec3 ObjSpaceViewDir (
in vec4 v_89
)
{
vec3 objSpaceCameraPos_90;
vec4 tmpvar_91;
tmpvar_91.w = 1.0;
tmpvar_91.xyz = _WorldSpaceCameraPos.xyz.xyz;
vec3 tmpvar_92;
tmpvar_92 = ((_World2Object * tmpvar_91).xyz * unity_Scale.w);
objSpaceCameraPos_90 = tmpvar_92;
return (objSpaceCameraPos_90 - v_89.xyz);
}
vec3 ObjSpaceLightDir (
in vec4 v_93
)
{
vec3 objSpaceLightPos_94;
vec3 tmpvar_95;
tmpvar_95 = (_World2Object * _WorldSpaceLightPos0).xyz;
objSpaceLightPos_94 = tmpvar_95;
return objSpaceLightPos_94.xyz;
}
v2f_surf xlat_main (
in appdata_full v_96
)
{
mat3 rotation_97;
vec3 binormal_98;
v2f_surf o_99;
TreeVertLeaf (v_96);
vec4 tmpvar_100;
tmpvar_100 = (glstate_matrix_mvp * v_96.vertex);
o_99.pos = tmpvar_100;
vec2 tmpvar_101;
tmpvar_101 = ((v_96.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
o_99.hip_pack0 = tmpvar_101.xy.xy;
vec4 tmpvar_102;
tmpvar_102 = v_96.color;
o_99.lop_color = tmpvar_102;
vec3 tmpvar_103;
tmpvar_103 = cross (v_96.normal, v_96.tangent.xyz);
vec3 tmpvar_104;
tmpvar_104 = (tmpvar_103 * v_96.tangent.w);
binormal_98 = tmpvar_104;
mat3 tmpvar_105;
float tmpvar_106;
tmpvar_106 = v_96.tangent.x;
tmpvar_105[0].x = tmpvar_106;
float tmpvar_107;
tmpvar_107 = binormal_98.x;
tmpvar_105[0].y = tmpvar_107;
float tmpvar_108;
tmpvar_108 = v_96.normal.x;
tmpvar_105[0].z = tmpvar_108;
float tmpvar_109;
tmpvar_109 = v_96.tangent.y;
tmpvar_105[1].x = tmpvar_109;
float tmpvar_110;
tmpvar_110 = binormal_98.y;
tmpvar_105[1].y = tmpvar_110;
float tmpvar_111;
tmpvar_111 = v_96.normal.y;
tmpvar_105[1].z = tmpvar_111;
float tmpvar_112;
tmpvar_112 = v_96.tangent.z;
tmpvar_105[2].x = tmpvar_112;
float tmpvar_113;
tmpvar_113 = binormal_98.z;
tmpvar_105[2].y = tmpvar_113;
float tmpvar_114;
tmpvar_114 = v_96.normal.z;
tmpvar_105[2].z = tmpvar_114;
mat3 tmpvar_115;
tmpvar_115 = (tmpvar_105);
rotation_97 = (tmpvar_115);
vec3 tmpvar_116;
tmpvar_116 = ObjSpaceLightDir (v_96.vertex);
vec3 tmpvar_117;
tmpvar_117 = (rotation_97 * tmpvar_116);
o_99.lightDir = tmpvar_117;
vec3 tmpvar_118;
tmpvar_118 = ObjSpaceViewDir (v_96.vertex);
vec3 tmpvar_119;
tmpvar_119 = (rotation_97 * tmpvar_118);
o_99.viewDir = tmpvar_119;
vec2 tmpvar_120;
tmpvar_120 = (_LightMatrix0 * (_Object2World * v_96.vertex)).xy;
o_99._LightCoord = tmpvar_120;
return o_99;
}
void main ()
{
appdata_full xlt_v_121;
v2f_surf xl_retval_122;
vec4 tmpvar_123;
tmpvar_123 = gl_Vertex.xyzw;
vec4 tmpvar_124;
tmpvar_124 = tmpvar_123;
xlt_v_121.vertex = tmpvar_124;
vec4 tmpvar_125;
tmpvar_125 = TANGENT.xyzw;
vec4 tmpvar_126;
tmpvar_126 = tmpvar_125;
xlt_v_121.tangent = tmpvar_126;
vec3 tmpvar_127;
tmpvar_127 = gl_Normal.xyz;
vec3 tmpvar_128;
tmpvar_128 = tmpvar_127;
xlt_v_121.normal = tmpvar_128;
vec4 tmpvar_129;
tmpvar_129 = gl_MultiTexCoord0.xyzw;
vec4 tmpvar_130;
tmpvar_130 = tmpvar_129;
xlt_v_121.texcoord = tmpvar_130;
vec4 tmpvar_131;
tmpvar_131 = gl_MultiTexCoord1.xyzw;
vec4 tmpvar_132;
tmpvar_132 = tmpvar_131;
xlt_v_121.texcoord1 = tmpvar_132;
vec4 tmpvar_133;
tmpvar_133 = gl_Color.xyzw;
vec4 tmpvar_134;
tmpvar_134 = tmpvar_133;
xlt_v_121.color = tmpvar_134;
v2f_surf tmpvar_135;
tmpvar_135 = xlat_main (xlt_v_121);
v2f_surf tmpvar_136;
tmpvar_136 = tmpvar_135;
xl_retval_122 = tmpvar_136;
vec4 tmpvar_137;
tmpvar_137 = xl_retval_122.pos.xyzw;
vec4 tmpvar_138;
tmpvar_138 = tmpvar_137;
gl_Position = tmpvar_138;
vec2 tmpvar_139;
tmpvar_139 = xl_retval_122.hip_pack0.xy;
vec2 tmpvar_140;
tmpvar_140 = tmpvar_139;
xlv_TEXCOORD0 = tmpvar_140;
vec4 tmpvar_141;
tmpvar_141 = xl_retval_122.lop_color.xyzw;
vec4 tmpvar_142;
tmpvar_142 = tmpvar_141;
xlv_COLOR0 = tmpvar_142;
vec3 tmpvar_143;
tmpvar_143 = xl_retval_122.lightDir.xyz;
vec3 tmpvar_144;
tmpvar_144 = tmpvar_143;
xlv_TEXCOORD1 = tmpvar_144;
vec3 tmpvar_145;
tmpvar_145 = xl_retval_122.viewDir.xyz;
vec3 tmpvar_146;
tmpvar_146 = tmpvar_145;
xlv_TEXCOORD2 = tmpvar_146;
vec2 tmpvar_147;
tmpvar_147 = xl_retval_122._LightCoord.xy;
vec2 tmpvar_148;
tmpvar_148 = tmpvar_147;
xlv_TEXCOORD3 = tmpvar_148;
}