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

293 lines
7.1 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;
vec2 hip_pack0;
vec4 lop_color;
};
attribute vec4 TANGENT;
uniform vec4 unity_LightShadowBias;
uniform vec4 _WavingTint;
uniform vec4 _WaveAndDistance;
uniform vec4 _MainTex_ST;
uniform vec3 _CameraUp;
uniform vec3 _CameraRight;
uniform vec4 _CameraPosition;
void FastSinCos (
in vec4 val_1,
out vec4 s_2,
out vec4 c_3
)
{
vec4 cos8_4;
vec4 sin7_5;
vec4 r3_6;
vec4 r2_7;
vec4 r1_8;
vec4 r8_9;
vec4 r7_10;
vec4 r6_11;
vec4 r5_12;
vec4 tmpvar_13;
tmpvar_13 = vec4(1.0, -0.161616, 0.0083333, -0.00019841);
sin7_5 = tmpvar_13;
vec4 tmpvar_14;
tmpvar_14 = vec4(-0.5, 0.0416667, -0.00138889, 2.48016e-05);
cos8_4 = tmpvar_14;
vec4 tmpvar_15;
tmpvar_15 = ((val_1 * 6.40885) - 3.14159);
val_1 = tmpvar_15;
vec4 tmpvar_16;
tmpvar_16 = (val_1 * val_1);
r5_12 = tmpvar_16;
vec4 tmpvar_17;
tmpvar_17 = (r5_12 * r5_12);
r6_11 = tmpvar_17;
vec4 tmpvar_18;
tmpvar_18 = (r6_11 * r5_12);
r7_10 = tmpvar_18;
vec4 tmpvar_19;
tmpvar_19 = (r6_11 * r5_12);
r8_9 = tmpvar_19;
vec4 tmpvar_20;
tmpvar_20 = (r5_12 * val_1);
r1_8 = tmpvar_20;
vec4 tmpvar_21;
tmpvar_21 = (r1_8 * r5_12);
r2_7 = tmpvar_21;
vec4 tmpvar_22;
tmpvar_22 = (r2_7 * r5_12);
r3_6 = tmpvar_22;
vec4 tmpvar_23;
tmpvar_23 = (((val_1 + (r1_8 * sin7_5.y)) + (r2_7 * sin7_5.z)) + (r3_6 * sin7_5.w));
s_2 = tmpvar_23;
vec4 tmpvar_24;
tmpvar_24 = ((((1.0 + (r5_12 * cos8_4.x)) + (r6_11 * cos8_4.y)) + (r7_10 * cos8_4.z)) + (r8_9 * cos8_4.w));
c_3 = tmpvar_24;
}
void TerrainWaveGrass (
inout vec4 vertex_25,
in float waveAmount_26,
in vec3 color_27,
out vec4 outColor_28
)
{
vec3 waveColor_29;
vec3 waveMove_30;
float lighting_31;
vec4 c_32;
vec4 s_33;
vec4 waves_34;
vec4 _waveZmove_35;
vec4 _waveXmove_36;
vec4 waveSpeed_37;
vec4 _waveZSize_38;
vec4 _waveXSize_39;
vec4 tmpvar_40;
tmpvar_40 = vec4(1.2, 2.0, 1.6, 4.8);
waveSpeed_37 = tmpvar_40;
vec4 tmpvar_41;
tmpvar_41 = vec4(0.024, 0.04, -0.12, 0.096);
_waveXmove_36 = tmpvar_41;
vec4 tmpvar_42;
tmpvar_42 = vec4(0.006, 0.02, -0.02, 0.1);
_waveZmove_35 = tmpvar_42;
vec3 tmpvar_43;
tmpvar_43 = vec3(0.0, 0.0, 0.0);
waveMove_30 = tmpvar_43;
vec4 tmpvar_44;
tmpvar_44 = (vec4(0.012, 0.02, 0.06, 0.024) * _WaveAndDistance.y);
_waveXSize_39 = tmpvar_44;
vec4 tmpvar_45;
tmpvar_45 = (vec4(0.006, 0.02, 0.02, 0.05) * _WaveAndDistance.y);
_waveZSize_38 = tmpvar_45;
vec4 tmpvar_46;
tmpvar_46 = (vertex_25.x * _waveXSize_39);
waves_34 = tmpvar_46;
vec4 tmpvar_47;
tmpvar_47 = (waves_34 + (vertex_25.z * _waveZSize_38));
waves_34 = tmpvar_47;
vec4 tmpvar_48;
tmpvar_48 = (waves_34 + (_WaveAndDistance.x * waveSpeed_37));
waves_34 = tmpvar_48;
vec4 tmpvar_49;
tmpvar_49 = fract (waves_34);
vec4 tmpvar_50;
tmpvar_50 = tmpvar_49;
waves_34 = tmpvar_50;
FastSinCos (waves_34, s_33, c_32);
vec4 tmpvar_51;
tmpvar_51 = (s_33 * s_33);
s_33 = tmpvar_51;
vec4 tmpvar_52;
tmpvar_52 = (s_33 * s_33);
s_33 = tmpvar_52;
vec4 tmpvar_53;
tmpvar_53 = normalize (vec4(1.0, 1.0, 0.4, 0.2));
float tmpvar_54;
tmpvar_54 = dot (s_33, tmpvar_53);
float tmpvar_55;
tmpvar_55 = (tmpvar_54 * 0.7);
lighting_31 = tmpvar_55;
vec4 tmpvar_56;
tmpvar_56 = (s_33 * waveAmount_26);
s_33 = tmpvar_56;
float tmpvar_57;
tmpvar_57 = dot (s_33, _waveXmove_36);
float tmpvar_58;
tmpvar_58 = tmpvar_57;
waveMove_30.x = tmpvar_58;
float tmpvar_59;
tmpvar_59 = dot (s_33, _waveZmove_35);
float tmpvar_60;
tmpvar_60 = tmpvar_59;
waveMove_30.z = vec3(tmpvar_60).z;
vec2 tmpvar_61;
tmpvar_61 = (vertex_25.xz - (waveMove_30.xz * _WaveAndDistance.z));
vertex_25.xz = tmpvar_61.xxy.xz;
vec3 tmpvar_62;
tmpvar_62 = vec3(lighting_31);
vec3 tmpvar_63;
tmpvar_63 = mix (vec3(0.5, 0.5, 0.5), _WavingTint.xyz, tmpvar_62);
vec3 tmpvar_64;
tmpvar_64 = tmpvar_63;
waveColor_29 = tmpvar_64;
vec3 tmpvar_65;
tmpvar_65 = ((color_27 * waveColor_29) * 2.0);
outColor_28.xyz = tmpvar_65.xyz.xyz;
float tmpvar_66;
tmpvar_66 = 1.0;
outColor_28.w = vec4(tmpvar_66).w;
}
void TerrainBillboardGrass (
inout vec4 pos_67,
in vec2 offset_68
)
{
vec3 grasspos_69;
vec3 tmpvar_70;
tmpvar_70 = (pos_67.xyz - _CameraPosition.xyz);
grasspos_69 = tmpvar_70;
float tmpvar_71;
tmpvar_71 = dot (grasspos_69, grasspos_69);
if ((tmpvar_71 > _WaveAndDistance.w)) {
vec2 tmpvar_72;
tmpvar_72 = vec2(0.0, 0.0);
offset_68 = tmpvar_72;
};
vec3 tmpvar_73;
tmpvar_73 = (pos_67.xyz + (offset_68.x * _CameraRight.xyz));
pos_67.xyz = tmpvar_73.xyz.xyz;
vec3 tmpvar_74;
tmpvar_74 = (pos_67.xyz + (offset_68.y * _CameraUp.xyz));
pos_67.xyz = tmpvar_74.xyz.xyz;
}
void vert (
inout appdata_full v_75
)
{
vec4 color_76;
float waveAmount_77;
TerrainBillboardGrass (v_75.vertex, v_75.tangent.xy);
float tmpvar_78;
tmpvar_78 = v_75.tangent.y;
waveAmount_77 = tmpvar_78;
TerrainWaveGrass (v_75.vertex, waveAmount_77, v_75.color.xyz, color_76);
vec4 tmpvar_79;
tmpvar_79 = color_76;
v_75.color = tmpvar_79;
}
v2f_surf vert_surf (
in appdata_full v_80
)
{
v2f_surf o_81;
vert (v_80);
vec2 tmpvar_82;
tmpvar_82 = ((v_80.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
o_81.hip_pack0 = tmpvar_82.xy.xy;
vec4 tmpvar_83;
tmpvar_83 = v_80.color;
o_81.lop_color = tmpvar_83;
vec4 tmpvar_84;
tmpvar_84 = (gl_ModelViewProjectionMatrix * v_80.vertex);
o_81.pos = tmpvar_84;
float tmpvar_85;
tmpvar_85 = (o_81.pos.z + unity_LightShadowBias.x);
o_81.pos.z = vec3(tmpvar_85).z;
if ((o_81.pos.z < -(o_81.pos.w))) {
float tmpvar_86;
tmpvar_86 = -(o_81.pos.w);
o_81.pos.z = vec3(tmpvar_86).z;
};
return o_81;
}
void main ()
{
appdata_full xlt_v_87;
v2f_surf xl_retval_88;
vec4 tmpvar_89;
tmpvar_89 = gl_Vertex.xyzw;
vec4 tmpvar_90;
tmpvar_90 = tmpvar_89;
xlt_v_87.vertex = tmpvar_90;
vec4 tmpvar_91;
tmpvar_91 = TANGENT.xyzw;
vec4 tmpvar_92;
tmpvar_92 = tmpvar_91;
xlt_v_87.tangent = tmpvar_92;
vec3 tmpvar_93;
tmpvar_93 = gl_Normal.xyz;
vec3 tmpvar_94;
tmpvar_94 = tmpvar_93;
xlt_v_87.normal = tmpvar_94;
vec4 tmpvar_95;
tmpvar_95 = gl_MultiTexCoord0.xyzw;
vec4 tmpvar_96;
tmpvar_96 = tmpvar_95;
xlt_v_87.texcoord = tmpvar_96;
vec4 tmpvar_97;
tmpvar_97 = gl_MultiTexCoord1.xyzw;
vec4 tmpvar_98;
tmpvar_98 = tmpvar_97;
xlt_v_87.texcoord1 = tmpvar_98;
vec4 tmpvar_99;
tmpvar_99 = gl_Color.xyzw;
vec4 tmpvar_100;
tmpvar_100 = tmpvar_99;
xlt_v_87.color = tmpvar_100;
v2f_surf tmpvar_101;
tmpvar_101 = vert_surf (xlt_v_87);
v2f_surf tmpvar_102;
tmpvar_102 = tmpvar_101;
xl_retval_88 = tmpvar_102;
vec4 tmpvar_103;
tmpvar_103 = xl_retval_88.pos.xyzw;
vec4 tmpvar_104;
tmpvar_104 = tmpvar_103;
gl_Position = tmpvar_104;
vec4 tmpvar_105;
tmpvar_105.zw = vec2(0.0, 0.0);
tmpvar_105.xy = xl_retval_88.hip_pack0.xy;
vec4 tmpvar_106;
tmpvar_106 = tmpvar_105;
gl_TexCoord[1] = tmpvar_106;
vec4 tmpvar_107;
tmpvar_107 = xl_retval_88.lop_color.xyzw;
vec4 tmpvar_108;
tmpvar_108 = tmpvar_107;
gl_FrontColor = tmpvar_108;
}