bgfx/3rdparty/glsl-optimizer/tests/vertex/zun-Hidden_Tree_Optimized_Bark_Shader-ir.txt
2014-02-10 23:06:13 -08:00

399 lines
9.4 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 lop_color;
vec3 lightDir;
vec3 viewDir;
vec3 _LightCoord;
};
uniform vec4 _Color;
uniform mat4 _LightMatrix0;
uniform vec4 _MainTex_ST;
uniform mat4 _Object2World;
uniform vec4 _Scale;
uniform float _SquashAmount;
uniform vec4 _SquashPlaneNormal;
uniform float _TimeX;
uniform vec4 _Wind;
uniform mat4 _World2Object;
uniform vec3 _WorldSpaceCameraPos;
uniform vec4 _WorldSpaceLightPos0;
uniform vec4 unity_Scale;
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;
}
vec4 TriangleWave (
in vec4 x_16
)
{
vec4 tmpvar_17;
tmpvar_17 = fract ((x_16 + 0.5));
vec4 tmpvar_18;
tmpvar_18 = abs (((tmpvar_17 * 2.0) - 1.0));
return tmpvar_18;
}
vec4 SmoothCurve (
in vec4 x_19
)
{
return ((x_19 * x_19) * (3.0 - (2.0 * x_19)));
}
vec4 SmoothTriangleWave (
in vec4 x_20
)
{
vec4 tmpvar_21;
tmpvar_21 = TriangleWave (x_20);
vec4 tmpvar_22;
tmpvar_22 = SmoothCurve (tmpvar_21);
return tmpvar_22;
}
vec4 AnimateVertex (
in vec4 pos_23,
in vec3 normal_24,
in vec4 animParams_25
)
{
vec3 bend_26;
vec2 vWavesSum_27;
vec4 vWaves_28;
vec2 vWavesIn_29;
float fVtxPhase_30;
float fBranchPhase_31;
float fObjPhase_32;
float fBranchAmp_33;
float fDetailAmp_34;
float tmpvar_35;
tmpvar_35 = 0.1;
fDetailAmp_34 = tmpvar_35;
float tmpvar_36;
tmpvar_36 = 0.3;
fBranchAmp_33 = tmpvar_36;
float tmpvar_37;
tmpvar_37 = dot (_Object2World[3].xyz, vec3(1.0, 1.0, 1.0));
float tmpvar_38;
tmpvar_38 = tmpvar_37;
fObjPhase_32 = tmpvar_38;
float tmpvar_39;
tmpvar_39 = (fObjPhase_32 + animParams_25.x);
fBranchPhase_31 = tmpvar_39;
vec3 tmpvar_40;
tmpvar_40 = vec3((animParams_25.y + fBranchPhase_31));
float tmpvar_41;
tmpvar_41 = dot (pos_23.xyz, tmpvar_40);
float tmpvar_42;
tmpvar_42 = tmpvar_41;
fVtxPhase_30 = tmpvar_42;
vec2 tmpvar_43;
tmpvar_43.x = fVtxPhase_30;
tmpvar_43.y = fBranchPhase_31;
vec2 tmpvar_44;
tmpvar_44 = (_TimeX + tmpvar_43);
vWavesIn_29 = tmpvar_44;
vec4 tmpvar_45;
tmpvar_45 = fract ((vWavesIn_29.xxyy * vec4(1.975, 0.793, 0.375, 0.193)));
vec4 tmpvar_46;
tmpvar_46 = ((tmpvar_45 * 2.0) - 1.0);
vWaves_28 = tmpvar_46;
vec4 tmpvar_47;
tmpvar_47 = SmoothTriangleWave (vWaves_28);
vec4 tmpvar_48;
tmpvar_48 = tmpvar_47;
vWaves_28 = tmpvar_48;
vec2 tmpvar_49;
tmpvar_49 = (vWaves_28.xz + vWaves_28.yw);
vWavesSum_27 = tmpvar_49;
vec3 tmpvar_50;
tmpvar_50 = ((animParams_25.y * fDetailAmp_34) * normal_24.xyz);
bend_26 = tmpvar_50;
float tmpvar_51;
tmpvar_51 = (animParams_25.w * fBranchAmp_33);
bend_26.y = vec2(tmpvar_51).y;
vec3 tmpvar_52;
tmpvar_52 = (pos_23.xyz + ((
(vWavesSum_27.xyx * bend_26)
+
((_Wind.xyz * vWavesSum_27.y) * animParams_25.w)
) * _Wind.w));
pos_23.xyz = tmpvar_52.xyz.xyz;
vec3 tmpvar_53;
tmpvar_53 = (pos_23.xyz + (animParams_25.z * _Wind.xyz));
pos_23.xyz = tmpvar_53.xyz.xyz;
return pos_23;
}
void TreeVertBark (
inout appdata_full v_54
)
{
vec3 tmpvar_55;
tmpvar_55 = (v_54.vertex.xyz * _Scale.xyz);
v_54.vertex.xyz = tmpvar_55.xyz.xyz;
vec4 tmpvar_56;
tmpvar_56.xy = v_54.color.xy.xy;
tmpvar_56.zw = v_54.texcoord1.xy.xy;
vec4 tmpvar_57;
tmpvar_57 = AnimateVertex (v_54.vertex, v_54.normal, tmpvar_56);
vec4 tmpvar_58;
tmpvar_58 = tmpvar_57;
v_54.vertex = tmpvar_58;
vec4 tmpvar_59;
tmpvar_59 = Squash (v_54.vertex);
vec4 tmpvar_60;
tmpvar_60 = tmpvar_59;
v_54.vertex = tmpvar_60;
vec4 tmpvar_61;
tmpvar_61.xyz = (v_54.color.w * _Color.xyz).xyz;
tmpvar_61.w = _Color.w;
vec4 tmpvar_62;
tmpvar_62 = tmpvar_61;
v_54.color = tmpvar_62;
vec3 tmpvar_63;
tmpvar_63 = normalize (v_54.normal);
vec3 tmpvar_64;
tmpvar_64 = tmpvar_63;
v_54.normal = tmpvar_64;
vec3 tmpvar_65;
tmpvar_65 = normalize (v_54.tangent.xyz);
vec3 tmpvar_66;
tmpvar_66 = tmpvar_65;
v_54.tangent.xyz = tmpvar_66.xyz.xyz;
}
void PositionFog (
in vec4 v_67,
out vec4 pos_68,
out float fog_69
)
{
vec4 tmpvar_70;
tmpvar_70 = (gl_ModelViewProjectionMatrix * v_67);
pos_68 = tmpvar_70;
float tmpvar_71;
tmpvar_71 = pos_68.z;
fog_69 = tmpvar_71;
}
vec3 ObjSpaceViewDir (
in vec4 v_72
)
{
vec3 objSpaceCameraPos_73;
vec4 tmpvar_74;
tmpvar_74.w = 1.0;
tmpvar_74.xyz = _WorldSpaceCameraPos.xyz.xyz;
vec3 tmpvar_75;
tmpvar_75 = ((_World2Object * tmpvar_74).xyz * unity_Scale.w);
objSpaceCameraPos_73 = tmpvar_75;
return (objSpaceCameraPos_73 - v_72.xyz);
}
vec3 ObjSpaceLightDir (
in vec4 v_76
)
{
vec3 objSpaceLightPos_77;
vec3 tmpvar_78;
tmpvar_78 = (_World2Object * _WorldSpaceLightPos0).xyz;
objSpaceLightPos_77 = tmpvar_78;
return ((objSpaceLightPos_77.xyz * unity_Scale.w) - v_76.xyz);
}
v2f_surf vert_surf (
in appdata_full v_79
)
{
mat3 rotation_80;
vec3 binormal_81;
v2f_surf o_82;
TreeVertBark (v_79);
PositionFog (v_79.vertex, o_82.pos, o_82.fog);
vec2 tmpvar_83;
tmpvar_83 = ((v_79.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
o_82.hip_pack0 = tmpvar_83.xy.xy;
vec4 tmpvar_84;
tmpvar_84 = v_79.color;
o_82.lop_color = tmpvar_84;
vec3 tmpvar_85;
tmpvar_85 = cross (v_79.normal, v_79.tangent.xyz);
vec3 tmpvar_86;
tmpvar_86 = (tmpvar_85 * v_79.tangent.w);
binormal_81 = tmpvar_86;
mat3 tmpvar_87;
float tmpvar_88;
tmpvar_88 = v_79.tangent.x;
tmpvar_87[0].x = tmpvar_88;
float tmpvar_89;
tmpvar_89 = binormal_81.x;
tmpvar_87[0].y = tmpvar_89;
float tmpvar_90;
tmpvar_90 = v_79.normal.x;
tmpvar_87[0].z = tmpvar_90;
float tmpvar_91;
tmpvar_91 = v_79.tangent.y;
tmpvar_87[1].x = tmpvar_91;
float tmpvar_92;
tmpvar_92 = binormal_81.y;
tmpvar_87[1].y = tmpvar_92;
float tmpvar_93;
tmpvar_93 = v_79.normal.y;
tmpvar_87[1].z = tmpvar_93;
float tmpvar_94;
tmpvar_94 = v_79.tangent.z;
tmpvar_87[2].x = tmpvar_94;
float tmpvar_95;
tmpvar_95 = binormal_81.z;
tmpvar_87[2].y = tmpvar_95;
float tmpvar_96;
tmpvar_96 = v_79.normal.z;
tmpvar_87[2].z = tmpvar_96;
mat3 tmpvar_97;
tmpvar_97 = tmpvar_87;
rotation_80 = tmpvar_97;
vec3 tmpvar_98;
tmpvar_98 = ObjSpaceLightDir (v_79.vertex);
vec3 tmpvar_99;
tmpvar_99 = (rotation_80 * tmpvar_98);
o_82.lightDir = tmpvar_99;
vec3 tmpvar_100;
tmpvar_100 = ObjSpaceViewDir (v_79.vertex);
vec3 tmpvar_101;
tmpvar_101 = (rotation_80 * tmpvar_100);
o_82.viewDir = tmpvar_101;
vec3 tmpvar_102;
tmpvar_102 = (_LightMatrix0 * (_Object2World * v_79.vertex)).xyz;
o_82._LightCoord = tmpvar_102;
return o_82;
}
void main ()
{
appdata_full xlt_v_103;
v2f_surf xl_retval_104;
vec4 tmpvar_105;
tmpvar_105 = gl_Vertex.xyzw;
vec4 tmpvar_106;
tmpvar_106 = tmpvar_105;
xlt_v_103.vertex = tmpvar_106;
vec4 tmpvar_107;
tmpvar_107 = TANGENT.xyzw;
vec4 tmpvar_108;
tmpvar_108 = tmpvar_107;
xlt_v_103.tangent = tmpvar_108;
vec3 tmpvar_109;
tmpvar_109 = gl_Normal.xyz;
vec3 tmpvar_110;
tmpvar_110 = tmpvar_109;
xlt_v_103.normal = tmpvar_110;
vec4 tmpvar_111;
tmpvar_111 = gl_MultiTexCoord0.xyzw;
vec4 tmpvar_112;
tmpvar_112 = tmpvar_111;
xlt_v_103.texcoord = tmpvar_112;
vec4 tmpvar_113;
tmpvar_113 = gl_MultiTexCoord1.xyzw;
vec4 tmpvar_114;
tmpvar_114 = tmpvar_113;
xlt_v_103.texcoord1 = tmpvar_114;
vec4 tmpvar_115;
tmpvar_115 = gl_Color.xyzw;
vec4 tmpvar_116;
tmpvar_116 = tmpvar_115;
xlt_v_103.color = tmpvar_116;
v2f_surf tmpvar_117;
tmpvar_117 = vert_surf (xlt_v_103);
v2f_surf tmpvar_118;
tmpvar_118 = tmpvar_117;
xl_retval_104 = tmpvar_118;
vec4 tmpvar_119;
tmpvar_119 = xl_retval_104.pos.xyzw;
vec4 tmpvar_120;
tmpvar_120 = tmpvar_119;
gl_Position = tmpvar_120;
vec4 tmpvar_121;
tmpvar_121.yzw = vec3(0.0, 0.0, 0.0);
tmpvar_121.x = xl_retval_104.fog;
vec4 tmpvar_122;
tmpvar_122 = tmpvar_121;
xlv_FOG = tmpvar_122;
vec4 tmpvar_123;
tmpvar_123.zw = vec2(0.0, 0.0);
tmpvar_123.xy = xl_retval_104.hip_pack0.xy;
vec4 tmpvar_124;
tmpvar_124 = tmpvar_123;
gl_TexCoord[0] = tmpvar_124;
vec4 tmpvar_125;
tmpvar_125 = xl_retval_104.lop_color.xyzw;
vec4 tmpvar_126;
tmpvar_126 = tmpvar_125;
gl_FrontColor = tmpvar_126;
vec4 tmpvar_127;
tmpvar_127.w = 0.0;
tmpvar_127.xyz = xl_retval_104.lightDir.xyz;
vec4 tmpvar_128;
tmpvar_128 = tmpvar_127;
gl_TexCoord[1] = tmpvar_128;
vec4 tmpvar_129;
tmpvar_129.w = 0.0;
tmpvar_129.xyz = xl_retval_104.viewDir.xyz;
vec4 tmpvar_130;
tmpvar_130 = tmpvar_129;
gl_TexCoord[2] = tmpvar_130;
vec4 tmpvar_131;
tmpvar_131.w = 0.0;
tmpvar_131.xyz = xl_retval_104._LightCoord.xyz;
vec4 tmpvar_132;
tmpvar_132 = tmpvar_131;
gl_TexCoord[3] = tmpvar_132;
}