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 vlight;
};
varying vec4 xlv_FOG;
attribute vec4 TANGENT;
uniform vec4 unity_Scale;
uniform vec4 unity_SHC;
uniform vec4 unity_SHBr;
uniform vec4 unity_SHBg;
uniform vec4 unity_SHBb;
uniform vec4 unity_SHAr;
uniform vec4 unity_SHAg;
uniform vec4 unity_SHAb;
uniform vec3 unity_LightColor3;
uniform vec3 unity_LightColor2;
uniform vec3 unity_LightColor1;
uniform vec3 unity_LightColor0;
uniform vec4 unity_4LightPosZ0;
uniform vec4 unity_4LightPosY0;
uniform vec4 unity_4LightPosX0;
uniform vec4 unity_4LightAtten0;
uniform vec4 _WavingTint;
uniform vec4 _WaveAndDistance;
uniform mat4 _Object2World;
uniform vec4 _MainTex_ST;
uniform vec3 _CameraUp;
uniform vec3 _CameraRight;
uniform vec4 _CameraPosition;
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;
  tmpvar_31 = (((val_9 + (r1_16 * sin7_13.y)) + (r2_15 * sin7_13.z)) + (r3_14 * sin7_13.w));
  s_10 = tmpvar_31;
  vec4 tmpvar_32;
  tmpvar_32 = ((((1.0 + (r5_20 * cos8_12.x)) + (r6_19 * cos8_12.y)) + (r7_18 * cos8_12.z)) + (r8_17 * cos8_12.w));
  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 ShadeSH9 (
  in vec4 normal_88
)
{
  vec3 x3_89;
  float vC_90;
  vec3 x2_91;
  vec4 vB_92;
  vec3 x1_93;
  float tmpvar_94;
  tmpvar_94 = dot (unity_SHAr, normal_88);
  float tmpvar_95;
  tmpvar_95 = tmpvar_94;
  x1_93.x = tmpvar_95;
  float tmpvar_96;
  tmpvar_96 = dot (unity_SHAg, normal_88);
  float tmpvar_97;
  tmpvar_97 = tmpvar_96;
  x1_93.y = vec2(tmpvar_97).y;
  float tmpvar_98;
  tmpvar_98 = dot (unity_SHAb, normal_88);
  float tmpvar_99;
  tmpvar_99 = tmpvar_98;
  x1_93.z = vec3(tmpvar_99).z;
  vec4 tmpvar_100;
  tmpvar_100 = (normal_88.xyzz * normal_88.yzzx);
  vB_92 = tmpvar_100;
  float tmpvar_101;
  tmpvar_101 = dot (unity_SHBr, vB_92);
  float tmpvar_102;
  tmpvar_102 = tmpvar_101;
  x2_91.x = tmpvar_102;
  float tmpvar_103;
  tmpvar_103 = dot (unity_SHBg, vB_92);
  float tmpvar_104;
  tmpvar_104 = tmpvar_103;
  x2_91.y = vec2(tmpvar_104).y;
  float tmpvar_105;
  tmpvar_105 = dot (unity_SHBb, vB_92);
  float tmpvar_106;
  tmpvar_106 = tmpvar_105;
  x2_91.z = vec3(tmpvar_106).z;
  float tmpvar_107;
  tmpvar_107 = ((normal_88.x * normal_88.x) - (normal_88.y * normal_88.y));
  vC_90 = tmpvar_107;
  vec3 tmpvar_108;
  tmpvar_108 = (unity_SHC.xyz * vC_90);
  x3_89 = tmpvar_108;
  return ((x1_93 + x2_91) + x3_89);
}

vec3 Shade4PointLights (
  in vec4 lightPosX_109,
  in vec4 lightPosY_110,
  in vec4 lightPosZ_111,
  in vec3 lightColor0_112,
  in vec3 lightColor1_113,
  in vec3 lightColor2_114,
  in vec3 lightColor3_115,
  in vec4 lightAttenSq_116,
  in vec3 pos_117,
  in vec3 normal_118
)
{
  vec3 col_119;
  vec4 diff_120;
  vec4 atten_121;
  vec4 corr_122;
  vec4 ndotl_123;
  vec4 lengthSq_124;
  vec4 toLightZ_125;
  vec4 toLightY_126;
  vec4 toLightX_127;
  vec4 tmpvar_128;
  tmpvar_128 = (lightPosX_109 - pos_117.x);
  toLightX_127 = tmpvar_128;
  vec4 tmpvar_129;
  tmpvar_129 = (lightPosY_110 - pos_117.y);
  toLightY_126 = tmpvar_129;
  vec4 tmpvar_130;
  tmpvar_130 = (lightPosZ_111 - pos_117.z);
  toLightZ_125 = tmpvar_130;
  vec4 tmpvar_131;
  tmpvar_131 = vec4(0.0, 0.0, 0.0, 0.0);
  lengthSq_124 = tmpvar_131;
  vec4 tmpvar_132;
  tmpvar_132 = (lengthSq_124 + (toLightX_127 * toLightX_127));
  lengthSq_124 = tmpvar_132;
  vec4 tmpvar_133;
  tmpvar_133 = (lengthSq_124 + (toLightY_126 * toLightY_126));
  lengthSq_124 = tmpvar_133;
  vec4 tmpvar_134;
  tmpvar_134 = (lengthSq_124 + (toLightZ_125 * toLightZ_125));
  lengthSq_124 = tmpvar_134;
  vec4 tmpvar_135;
  tmpvar_135 = vec4(0.0, 0.0, 0.0, 0.0);
  ndotl_123 = tmpvar_135;
  vec4 tmpvar_136;
  tmpvar_136 = (ndotl_123 + (toLightX_127 * normal_118.x));
  ndotl_123 = tmpvar_136;
  vec4 tmpvar_137;
  tmpvar_137 = (ndotl_123 + (toLightY_126 * normal_118.y));
  ndotl_123 = tmpvar_137;
  vec4 tmpvar_138;
  tmpvar_138 = (ndotl_123 + (toLightZ_125 * normal_118.z));
  ndotl_123 = tmpvar_138;
  vec4 tmpvar_139;
  tmpvar_139 = inversesqrt (lengthSq_124);
  vec4 tmpvar_140;
  tmpvar_140 = tmpvar_139;
  corr_122 = tmpvar_140;
  vec4 tmpvar_141;
  tmpvar_141 = max (vec4(0.0, 0.0, 0.0, 0.0), (ndotl_123 * corr_122));
  vec4 tmpvar_142;
  tmpvar_142 = tmpvar_141;
  ndotl_123 = tmpvar_142;
  vec4 tmpvar_143;
  tmpvar_143 = (1.0 / (1.0 + (lengthSq_124 * lightAttenSq_116)));
  atten_121 = tmpvar_143;
  vec4 tmpvar_144;
  tmpvar_144 = (ndotl_123 * atten_121);
  diff_120 = tmpvar_144;
  vec3 tmpvar_145;
  tmpvar_145 = vec3(0.0, 0.0, 0.0);
  col_119 = tmpvar_145;
  vec3 tmpvar_146;
  tmpvar_146 = (col_119 + (lightColor0_112 * diff_120.x));
  col_119 = tmpvar_146;
  vec3 tmpvar_147;
  tmpvar_147 = (col_119 + (lightColor1_113 * diff_120.y));
  col_119 = tmpvar_147;
  vec3 tmpvar_148;
  tmpvar_148 = (col_119 + (lightColor2_114 * diff_120.z));
  col_119 = tmpvar_148;
  vec3 tmpvar_149;
  tmpvar_149 = (col_119 + (lightColor3_115 * diff_120.w));
  col_119 = tmpvar_149;
  return col_119;
}

void PositionFog (
  in vec4 v_150,
  out vec4 pos_151,
  out float fog_152
)
{
  vec4 tmpvar_153;
  tmpvar_153 = (gl_ModelViewProjectionMatrix * v_150);
  pos_151 = tmpvar_153;
  float tmpvar_154;
  tmpvar_154 = pos_151.z;
  fog_152 = tmpvar_154;
}

v2f_surf vert_surf (
  in appdata_full v_155
)
{
  vec3 worldPos_156;
  vec3 shlight_157;
  vec3 worldN_158;
  v2f_surf o_159;
  vert (v_155);
  PositionFog (v_155.vertex, o_159.pos, o_159.fog);
  vec2 tmpvar_160;
  tmpvar_160 = ((v_155.texcoord.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
  o_159.hip_pack0 = tmpvar_160.xy.xy;
  vec4 tmpvar_161;
  tmpvar_161 = v_155.color;
  o_159.lop_color = tmpvar_161;
  mat3 tmpvar_162;
  tmpvar_162 = xll_constructMat3 (_Object2World);
  vec3 tmpvar_163;
  tmpvar_163 = (tmpvar_162 * (v_155.normal * unity_Scale.w));
  worldN_158 = tmpvar_163;
  vec3 tmpvar_164;
  tmpvar_164 = worldN_158;
  o_159.normal = tmpvar_164;
  vec4 tmpvar_165;
  tmpvar_165.w = 1.0;
  tmpvar_165.xyz = worldN_158.xyz;
  vec3 tmpvar_166;
  tmpvar_166 = ShadeSH9 (tmpvar_165);
  vec3 tmpvar_167;
  tmpvar_167 = tmpvar_166;
  shlight_157 = tmpvar_167;
  vec3 tmpvar_168;
  tmpvar_168 = shlight_157;
  o_159.vlight = tmpvar_168;
  vec3 tmpvar_169;
  tmpvar_169 = (_Object2World * v_155.vertex).xyz;
  worldPos_156 = tmpvar_169;
  vec3 tmpvar_170;
  tmpvar_170 = Shade4PointLights (unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0, unity_LightColor0, unity_LightColor1, unity_LightColor2, unity_LightColor3, unity_4LightAtten0, worldPos_156, worldN_158);
  vec3 tmpvar_171;
  tmpvar_171 = (o_159.vlight + tmpvar_170);
  o_159.vlight = tmpvar_171;
  return o_159;
}

void main ()
{
  appdata_full xlt_v_172;
  v2f_surf xl_retval_173;
  vec4 tmpvar_174;
  tmpvar_174 = gl_Vertex.xyzw;
  vec4 tmpvar_175;
  tmpvar_175 = tmpvar_174;
  xlt_v_172.vertex = tmpvar_175;
  vec4 tmpvar_176;
  tmpvar_176 = TANGENT.xyzw;
  vec4 tmpvar_177;
  tmpvar_177 = tmpvar_176;
  xlt_v_172.tangent = tmpvar_177;
  vec3 tmpvar_178;
  tmpvar_178 = gl_Normal.xyz;
  vec3 tmpvar_179;
  tmpvar_179 = tmpvar_178;
  xlt_v_172.normal = tmpvar_179;
  vec4 tmpvar_180;
  tmpvar_180 = gl_MultiTexCoord0.xyzw;
  vec4 tmpvar_181;
  tmpvar_181 = tmpvar_180;
  xlt_v_172.texcoord = tmpvar_181;
  vec4 tmpvar_182;
  tmpvar_182 = gl_MultiTexCoord1.xyzw;
  vec4 tmpvar_183;
  tmpvar_183 = tmpvar_182;
  xlt_v_172.texcoord1 = tmpvar_183;
  vec4 tmpvar_184;
  tmpvar_184 = gl_Color.xyzw;
  vec4 tmpvar_185;
  tmpvar_185 = tmpvar_184;
  xlt_v_172.color = tmpvar_185;
  v2f_surf tmpvar_186;
  tmpvar_186 = vert_surf (xlt_v_172);
  v2f_surf tmpvar_187;
  tmpvar_187 = tmpvar_186;
  xl_retval_173 = tmpvar_187;
  vec4 tmpvar_188;
  tmpvar_188 = xl_retval_173.pos.xyzw;
  vec4 tmpvar_189;
  tmpvar_189 = tmpvar_188;
  gl_Position = tmpvar_189;
  vec4 tmpvar_190;
  tmpvar_190.yzw = vec3(0.0, 0.0, 0.0);
  tmpvar_190.x = xl_retval_173.fog;
  vec4 tmpvar_191;
  tmpvar_191 = tmpvar_190;
  xlv_FOG = tmpvar_191;
  vec4 tmpvar_192;
  tmpvar_192.zw = vec2(0.0, 0.0);
  tmpvar_192.xy = xl_retval_173.hip_pack0.xy;
  vec4 tmpvar_193;
  tmpvar_193 = tmpvar_192;
  gl_TexCoord[0] = tmpvar_193;
  vec4 tmpvar_194;
  tmpvar_194 = xl_retval_173.lop_color.xyzw;
  vec4 tmpvar_195;
  tmpvar_195 = tmpvar_194;
  gl_FrontColor = tmpvar_195;
  vec4 tmpvar_196;
  tmpvar_196.w = 0.0;
  tmpvar_196.xyz = xl_retval_173.normal.xyz;
  vec4 tmpvar_197;
  tmpvar_197 = tmpvar_196;
  gl_TexCoord[1] = tmpvar_197;
  vec4 tmpvar_198;
  tmpvar_198.w = 0.0;
  tmpvar_198.xyz = xl_retval_173.vlight.xyz;
  vec4 tmpvar_199;
  tmpvar_199 = tmpvar_198;
  gl_TexCoord[2] = tmpvar_199;
}

