bgfx/3rdparty/glsl-optimizer/tests/vertex/zun-Hidden_TerrainEngine_Details_BillboardWavingDoublePass1-ir.txt

382 lines
8.9 KiB
Text
Raw Normal View History

2012-10-07 23:41:18 -04:00
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 normal;
vec3 lightDir;
vec3 _LightCoord;
};
uniform vec4 _CameraPosition;
2014-02-11 02:06:13 -05:00
uniform vec3 _CameraRight;
uniform vec3 _CameraUp;
uniform mat4 _LightMatrix0;
uniform vec4 _MainTex_ST;
uniform mat4 _Object2World;
uniform vec4 _WaveAndDistance;
uniform vec4 _WavingTint;
uniform vec4 _WorldSpaceLightPos0;
uniform vec4 unity_Scale;
attribute vec4 TANGENT;
varying vec4 xlv_FOG;
2012-10-07 23:41:18 -04:00
mat3 xll_constructMat3 (
in mat4 m_1
)
{
vec3 tmpvar_2;
tmpvar_2 = m_1[0].xyz;
vec3 tmpvar_3;
tmpvar_3 = m_1[1].xyz;
vec3 tmpvar_4;
tmpvar_4 = m_1[2].xyz;
mat3 tmpvar_5;
vec3 tmpvar_6;
tmpvar_6 = tmpvar_2;
tmpvar_5[0] = tmpvar_6;
vec3 tmpvar_7;
tmpvar_7 = tmpvar_3;
tmpvar_5[1] = tmpvar_7;
vec3 tmpvar_8;
tmpvar_8 = tmpvar_4;
tmpvar_5[2] = tmpvar_8;
return tmpvar_5;
}
void FastSinCos (
in vec4 val_9,
out vec4 s_10,
out vec4 c_11
)
{
vec4 cos8_12;
vec4 sin7_13;
vec4 r3_14;
vec4 r2_15;
vec4 r1_16;
vec4 r8_17;
vec4 r7_18;
vec4 r6_19;
vec4 r5_20;
vec4 tmpvar_21;
tmpvar_21 = vec4(1.0, -0.161616, 0.0083333, -0.00019841);
sin7_13 = tmpvar_21;
vec4 tmpvar_22;
tmpvar_22 = vec4(-0.5, 0.0416667, -0.00138889, 2.48016e-05);
cos8_12 = tmpvar_22;
vec4 tmpvar_23;
tmpvar_23 = ((val_9 * 6.40885) - 3.14159);
val_9 = tmpvar_23;
vec4 tmpvar_24;
tmpvar_24 = (val_9 * val_9);
r5_20 = tmpvar_24;
vec4 tmpvar_25;
tmpvar_25 = (r5_20 * r5_20);
r6_19 = tmpvar_25;
vec4 tmpvar_26;
tmpvar_26 = (r6_19 * r5_20);
r7_18 = tmpvar_26;
vec4 tmpvar_27;
tmpvar_27 = (r6_19 * r5_20);
r8_17 = tmpvar_27;
vec4 tmpvar_28;
tmpvar_28 = (r5_20 * val_9);
r1_16 = tmpvar_28;
vec4 tmpvar_29;
tmpvar_29 = (r1_16 * r5_20);
r2_15 = tmpvar_29;
vec4 tmpvar_30;
tmpvar_30 = (r2_15 * r5_20);
r3_14 = tmpvar_30;
vec4 tmpvar_31;
2014-02-11 02:06:13 -05:00
tmpvar_31 = (((val_9 +
(r1_16 * sin7_13.y)
) + (r2_15 * sin7_13.z)) + (r3_14 * sin7_13.w));
2012-10-07 23:41:18 -04:00
s_10 = tmpvar_31;
vec4 tmpvar_32;
2014-02-11 02:06:13 -05:00
tmpvar_32 = (((
(1.0 + (r5_20 * cos8_12.x))
+
(r6_19 * cos8_12.y)
) + (r7_18 * cos8_12.z)) + (r8_17 * cos8_12.w));
2012-10-07 23:41:18 -04:00
c_11 = tmpvar_32;
}
void TerrainWaveGrass (
inout vec4 vertex_33,
in float waveAmount_34,
in vec3 color_35,
out vec4 outColor_36
)
{
vec3 waveColor_37;
vec3 waveMove_38;
float lighting_39;
vec4 c_40;
vec4 s_41;
vec4 waves_42;
vec4 _waveZmove_43;
vec4 _waveXmove_44;
vec4 waveSpeed_45;
vec4 _waveZSize_46;
vec4 _waveXSize_47;
vec4 tmpvar_48;
tmpvar_48 = vec4(1.2, 2.0, 1.6, 4.8);
waveSpeed_45 = tmpvar_48;
vec4 tmpvar_49;
tmpvar_49 = vec4(0.024, 0.04, -0.12, 0.096);
_waveXmove_44 = tmpvar_49;
vec4 tmpvar_50;
tmpvar_50 = vec4(0.006, 0.02, -0.02, 0.1);
_waveZmove_43 = tmpvar_50;
vec3 tmpvar_51;
tmpvar_51 = vec3(0.0, 0.0, 0.0);
waveMove_38 = tmpvar_51;
vec4 tmpvar_52;
tmpvar_52 = (vec4(0.012, 0.02, 0.06, 0.024) * _WaveAndDistance.y);
_waveXSize_47 = tmpvar_52;
vec4 tmpvar_53;
tmpvar_53 = (vec4(0.006, 0.02, 0.02, 0.05) * _WaveAndDistance.y);
_waveZSize_46 = tmpvar_53;
vec4 tmpvar_54;
tmpvar_54 = (vertex_33.x * _waveXSize_47);
waves_42 = tmpvar_54;
vec4 tmpvar_55;
tmpvar_55 = (waves_42 + (vertex_33.z * _waveZSize_46));
waves_42 = tmpvar_55;
vec4 tmpvar_56;
tmpvar_56 = (waves_42 + (_WaveAndDistance.x * waveSpeed_45));
waves_42 = tmpvar_56;
vec4 tmpvar_57;
tmpvar_57 = fract (waves_42);
vec4 tmpvar_58;
tmpvar_58 = tmpvar_57;
waves_42 = tmpvar_58;
FastSinCos (waves_42, s_41, c_40);
vec4 tmpvar_59;
tmpvar_59 = (s_41 * s_41);
s_41 = tmpvar_59;
vec4 tmpvar_60;
tmpvar_60 = (s_41 * s_41);
s_41 = tmpvar_60;
vec4 tmpvar_61;
tmpvar_61 = normalize (vec4(1.0, 1.0, 0.4, 0.2));
float tmpvar_62;
tmpvar_62 = dot (s_41, tmpvar_61);
float tmpvar_63;
tmpvar_63 = (tmpvar_62 * 0.7);
lighting_39 = tmpvar_63;
vec4 tmpvar_64;
tmpvar_64 = (s_41 * waveAmount_34);
s_41 = tmpvar_64;
float tmpvar_65;
tmpvar_65 = dot (s_41, _waveXmove_44);
float tmpvar_66;
tmpvar_66 = tmpvar_65;
waveMove_38.x = tmpvar_66;
float tmpvar_67;
tmpvar_67 = dot (s_41, _waveZmove_43);
float tmpvar_68;
tmpvar_68 = tmpvar_67;
waveMove_38.z = vec3(tmpvar_68).z;
vec2 tmpvar_69;
tmpvar_69 = (vertex_33.xz - (waveMove_38.xz * _WaveAndDistance.z));
vertex_33.xz = tmpvar_69.xxy.xz;
vec3 tmpvar_70;
tmpvar_70 = vec3(lighting_39);
vec3 tmpvar_71;
tmpvar_71 = mix (vec3(0.5, 0.5, 0.5), _WavingTint.xyz, tmpvar_70);
vec3 tmpvar_72;
tmpvar_72 = tmpvar_71;
waveColor_37 = tmpvar_72;
vec3 tmpvar_73;
tmpvar_73 = ((color_35 * waveColor_37) * 2.0);
outColor_36.xyz = tmpvar_73.xyz.xyz;
float tmpvar_74;
tmpvar_74 = 1.0;
outColor_36.w = vec4(tmpvar_74).w;
}
void TerrainBillboardGrass (
inout vec4 pos_75,
in vec2 offset_76
)
{
vec3 grasspos_77;
vec3 tmpvar_78;
tmpvar_78 = (pos_75.xyz - _CameraPosition.xyz);
grasspos_77 = tmpvar_78;
float tmpvar_79;
tmpvar_79 = dot (grasspos_77, grasspos_77);
if ((tmpvar_79 > _WaveAndDistance.w)) {
vec2 tmpvar_80;
tmpvar_80 = vec2(0.0, 0.0);
offset_76 = tmpvar_80;
};
vec3 tmpvar_81;
tmpvar_81 = (pos_75.xyz + (offset_76.x * _CameraRight.xyz));
pos_75.xyz = tmpvar_81.xyz.xyz;
vec3 tmpvar_82;
tmpvar_82 = (pos_75.xyz + (offset_76.y * _CameraUp.xyz));
pos_75.xyz = tmpvar_82.xyz.xyz;
}
void vert (
inout appdata_full v_83
)
{
vec4 color_84;
float waveAmount_85;
TerrainBillboardGrass (v_83.vertex, v_83.tangent.xy);
float tmpvar_86;
tmpvar_86 = v_83.tangent.y;
waveAmount_85 = tmpvar_86;
TerrainWaveGrass (v_83.vertex, waveAmount_85, v_83.color.xyz, color_84);
vec4 tmpvar_87;
tmpvar_87 = color_84;
v_83.color = tmpvar_87;
}
vec3 WorldSpaceLightDir (
in vec4 v_88
)
{
vec3 worldPos_89;
vec3 tmpvar_90;
tmpvar_90 = (_Object2World * v_88).xyz;
worldPos_89 = tmpvar_90;
return (_WorldSpaceLightPos0.xyz - worldPos_89);
}
void PositionFog (
in vec4 v_91,
out vec4 pos_92,
out float fog_93
)
{
vec4 tmpvar_94;
tmpvar_94 = (gl_ModelViewProjectionMatrix * v_91);
pos_92 = tmpvar_94;
float tmpvar_95;
tmpvar_95 = pos_92.z;
fog_93 = tmpvar_95;
}
v2f_surf vert_surf (
in appdata_full v_96
)
{
v2f_surf o_97;
vert (v_96);
PositionFog (v_96.vertex, o_97.pos, o_97.fog);
vec2 tmpvar_98;
tmpvar_98 = ((v_96.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
o_97.hip_pack0 = tmpvar_98.xy.xy;
vec4 tmpvar_99;
tmpvar_99 = v_96.color;
o_97.lop_color = tmpvar_99;
mat3 tmpvar_100;
tmpvar_100 = xll_constructMat3 (_Object2World);
vec3 tmpvar_101;
tmpvar_101 = (tmpvar_100 * (v_96.normal * unity_Scale.w));
o_97.normal = tmpvar_101;
vec3 tmpvar_102;
tmpvar_102 = WorldSpaceLightDir (v_96.vertex);
vec3 tmpvar_103;
tmpvar_103 = tmpvar_102;
o_97.lightDir = tmpvar_103;
vec3 tmpvar_104;
tmpvar_104 = (_LightMatrix0 * (_Object2World * v_96.vertex)).xyz;
o_97._LightCoord = tmpvar_104;
return o_97;
}
void main ()
{
appdata_full xlt_v_105;
v2f_surf xl_retval_106;
vec4 tmpvar_107;
tmpvar_107 = gl_Vertex.xyzw;
vec4 tmpvar_108;
tmpvar_108 = tmpvar_107;
xlt_v_105.vertex = tmpvar_108;
vec4 tmpvar_109;
tmpvar_109 = TANGENT.xyzw;
vec4 tmpvar_110;
tmpvar_110 = tmpvar_109;
xlt_v_105.tangent = tmpvar_110;
vec3 tmpvar_111;
tmpvar_111 = gl_Normal.xyz;
vec3 tmpvar_112;
tmpvar_112 = tmpvar_111;
xlt_v_105.normal = tmpvar_112;
vec4 tmpvar_113;
tmpvar_113 = gl_MultiTexCoord0.xyzw;
vec4 tmpvar_114;
tmpvar_114 = tmpvar_113;
xlt_v_105.texcoord = tmpvar_114;
vec4 tmpvar_115;
tmpvar_115 = gl_MultiTexCoord1.xyzw;
vec4 tmpvar_116;
tmpvar_116 = tmpvar_115;
xlt_v_105.texcoord1 = tmpvar_116;
vec4 tmpvar_117;
tmpvar_117 = gl_Color.xyzw;
vec4 tmpvar_118;
tmpvar_118 = tmpvar_117;
xlt_v_105.color = tmpvar_118;
v2f_surf tmpvar_119;
tmpvar_119 = vert_surf (xlt_v_105);
v2f_surf tmpvar_120;
tmpvar_120 = tmpvar_119;
xl_retval_106 = tmpvar_120;
vec4 tmpvar_121;
tmpvar_121 = xl_retval_106.pos.xyzw;
vec4 tmpvar_122;
tmpvar_122 = tmpvar_121;
gl_Position = tmpvar_122;
vec4 tmpvar_123;
tmpvar_123.yzw = vec3(0.0, 0.0, 0.0);
tmpvar_123.x = xl_retval_106.fog;
vec4 tmpvar_124;
tmpvar_124 = tmpvar_123;
xlv_FOG = tmpvar_124;
vec4 tmpvar_125;
tmpvar_125.zw = vec2(0.0, 0.0);
tmpvar_125.xy = xl_retval_106.hip_pack0.xy;
vec4 tmpvar_126;
tmpvar_126 = tmpvar_125;
gl_TexCoord[0] = tmpvar_126;
vec4 tmpvar_127;
tmpvar_127 = xl_retval_106.lop_color.xyzw;
vec4 tmpvar_128;
tmpvar_128 = tmpvar_127;
gl_FrontColor = tmpvar_128;
vec4 tmpvar_129;
tmpvar_129.w = 0.0;
tmpvar_129.xyz = xl_retval_106.normal.xyz;
vec4 tmpvar_130;
tmpvar_130 = tmpvar_129;
gl_TexCoord[1] = tmpvar_130;
vec4 tmpvar_131;
tmpvar_131.w = 0.0;
tmpvar_131.xyz = xl_retval_106.lightDir.xyz;
vec4 tmpvar_132;
tmpvar_132 = tmpvar_131;
gl_TexCoord[2] = tmpvar_132;
vec4 tmpvar_133;
tmpvar_133.w = 0.0;
tmpvar_133.xyz = xl_retval_106._LightCoord.xyz;
vec4 tmpvar_134;
tmpvar_134 = tmpvar_133;
gl_TexCoord[3] = tmpvar_134;
}