uniform mat4 _Object2World;
uniform mat4 _World2Object;
uniform vec3 _Tonemap_blackLevel;
uniform vec3 _Tonemap_toeLength;
uniform vec3 _Tonemap_heel;
uniform vec3 _Tonemap_shoulder;
uniform vec3 _Tonemap_colorScale1;
uniform vec3 _Tonemap_colorScale2;
uniform vec3 _HybridSunDir;
uniform vec4 _HybridSunCol;
uniform vec3 GridLightTextureStartCell;
uniform vec3 GridLightTextureCellSize;
uniform sampler2D GridLightTexture;
uniform vec4 IngameGridLimit;
uniform vec4 LightPos[30];
uniform vec4 LightCol[30];
uniform vec4 _MainTex_ST;
attribute vec4 TANGENT;
varying vec3 xlv_TEXCOORD0;
varying vec3 xlv_TEXCOORD1;
varying vec3 xlv_COLOR;
varying vec2 xlv_TEXCOORD2;
void main ()
{
  vec3 tmpvar_1;
  tmpvar_1 = (_Object2World * gl_Vertex).xyz;
  mat3 tmpvar_2;
  tmpvar_2[0] = _Object2World[0].xyz;
  tmpvar_2[1] = _Object2World[1].xyz;
  tmpvar_2[2] = _Object2World[2].xyz;
  vec3 tmpvar_3;
  tmpvar_3 = normalize((tmpvar_2 * gl_Normal));
  vec4 nn_4;
  vec4 tmpvar_5;
  tmpvar_5 = ((gl_MultiTexCoord1.xyxy * vec4(2.0, 2.0, 0.0, 0.0)) + vec4(-1.0, -1.0, 1.01, -1.0));
  nn_4.w = tmpvar_5.w;
  float tmpvar_6;
  tmpvar_6 = dot (tmpvar_5.xyz, -(tmpvar_5.xyw));
  nn_4.z = tmpvar_6;
  nn_4.xy = (tmpvar_5.xy * sqrt(tmpvar_6));
  vec3 tmpvar_7;
  vec3 tmpvar_8;
  tmpvar_8 = (gl_Color.xyz * 3.0);
  tmpvar_7 = (tmpvar_8 * tmpvar_8);
  ivec4 tmpvar_9;
  tmpvar_9 = ivec4((texture2DLod (GridLightTexture, clamp (
    ((tmpvar_1 - GridLightTextureStartCell) * GridLightTextureCellSize)
  .xz, IngameGridLimit.xy, IngameGridLimit.zw), 0.0) * 255.0));
  vec4 tmpvar_10;
  vec4 tmpvar_11;
  vec4 tmpvar_12;
  vec4 tmpvar_13;
  vec4 tmpvar_14;
  vec4 tmpvar_15;
  vec4 tmpvar_16;
  vec4 tmpvar_17;
  tmpvar_10 = LightPos[tmpvar_9.x];
  tmpvar_11 = LightCol[tmpvar_9.x];
  tmpvar_12 = LightPos[tmpvar_9.y];
  tmpvar_13 = LightCol[tmpvar_9.y];
  tmpvar_14 = LightPos[tmpvar_9.z];
  tmpvar_15 = LightCol[tmpvar_9.z];
  tmpvar_16 = LightPos[tmpvar_9.w];
  tmpvar_17 = LightCol[tmpvar_9.w];
  vec3 hybridCol_18;
  vec4 atten_19;
  float wAgg_20;
  vec3 lAgg_21;
  vec3 tmpvar_22;
  tmpvar_22 = (tmpvar_10.xyz - tmpvar_1);
  float tmpvar_23;
  tmpvar_23 = dot (tmpvar_22, tmpvar_22);
  vec3 tmpvar_24;
  tmpvar_24 = (tmpvar_22 * inversesqrt(tmpvar_23));
  vec4 tmpvar_25;
  tmpvar_25.yzw = atten_19.yzw;
  tmpvar_25.x = max ((1.0 - (
    (tmpvar_23 * tmpvar_10.w)
   * 0.8)), 0.0);
  vec4 tmpvar_26;
  tmpvar_26.yzw = tmpvar_25.yzw;
  tmpvar_26.x = (tmpvar_25.x * tmpvar_25.x);
  float tmpvar_27;
  tmpvar_27 = ((tmpvar_26.x * tmpvar_11.w) * max (dot (tmpvar_24, tmpvar_3), 0.05));
  lAgg_21 = (tmpvar_27 * tmpvar_24);
  wAgg_20 = (0.001 + tmpvar_27);
  vec3 tmpvar_28;
  tmpvar_28 = (tmpvar_12.xyz - tmpvar_1);
  float tmpvar_29;
  tmpvar_29 = dot (tmpvar_28, tmpvar_28);
  vec3 tmpvar_30;
  tmpvar_30 = (tmpvar_28 * inversesqrt(tmpvar_29));
  vec4 tmpvar_31;
  tmpvar_31.xzw = tmpvar_26.xzw;
  tmpvar_31.y = max ((1.0 - (
    (tmpvar_29 * tmpvar_12.w)
   * 0.8)), 0.0);
  vec4 tmpvar_32;
  tmpvar_32.xzw = tmpvar_31.xzw;
  tmpvar_32.y = (tmpvar_31.y * tmpvar_31.y);
  float tmpvar_33;
  tmpvar_33 = ((tmpvar_32.y * tmpvar_13.w) * max (dot (tmpvar_30, tmpvar_3), 0.05));
  lAgg_21 = (lAgg_21 + (tmpvar_33 * tmpvar_30));
  wAgg_20 = (wAgg_20 + tmpvar_33);
  vec3 tmpvar_34;
  tmpvar_34 = (tmpvar_14.xyz - tmpvar_1);
  float tmpvar_35;
  tmpvar_35 = dot (tmpvar_34, tmpvar_34);
  vec3 tmpvar_36;
  tmpvar_36 = (tmpvar_34 * inversesqrt(tmpvar_35));
  vec4 tmpvar_37;
  tmpvar_37.xyw = tmpvar_32.xyw;
  tmpvar_37.z = max ((1.0 - (
    (tmpvar_35 * tmpvar_14.w)
   * 0.8)), 0.0);
  vec4 tmpvar_38;
  tmpvar_38.xyw = tmpvar_37.xyw;
  tmpvar_38.z = (tmpvar_37.z * tmpvar_37.z);
  float tmpvar_39;
  tmpvar_39 = ((tmpvar_38.z * tmpvar_15.w) * max (dot (tmpvar_36, tmpvar_3), 0.05));
  lAgg_21 = (lAgg_21 + (tmpvar_39 * tmpvar_36));
  wAgg_20 = (wAgg_20 + tmpvar_39);
  vec3 tmpvar_40;
  tmpvar_40 = (tmpvar_16.xyz - tmpvar_1);
  float tmpvar_41;
  tmpvar_41 = dot (tmpvar_40, tmpvar_40);
  vec3 tmpvar_42;
  tmpvar_42 = (tmpvar_40 * inversesqrt(tmpvar_41));
  vec4 tmpvar_43;
  tmpvar_43.xyz = tmpvar_38.xyz;
  tmpvar_43.w = max ((1.0 - (
    (tmpvar_41 * tmpvar_16.w)
   * 0.8)), 0.0);
  vec4 tmpvar_44;
  tmpvar_44.xyz = tmpvar_43.xyz;
  tmpvar_44.w = (tmpvar_43.w * tmpvar_43.w);
  atten_19 = tmpvar_44;
  float tmpvar_45;
  tmpvar_45 = ((tmpvar_44.w * tmpvar_17.w) * max (dot (tmpvar_42, tmpvar_3), 0.05));
  lAgg_21 = (lAgg_21 + (tmpvar_45 * tmpvar_42));
  wAgg_20 = (wAgg_20 + tmpvar_45);
  float tmpvar_46;
  tmpvar_46 = (dot (tmpvar_7, vec3(0.22, 0.707, 0.071)) * 2.0);
  lAgg_21 = (lAgg_21 + ((
    ((nn_4.xyz * 2.0) + vec3(0.0, 0.0, -1.0))
   * 
    (gl_Color.w * 2.0)
  ) * tmpvar_46));
  wAgg_20 = (wAgg_20 + tmpvar_46);
  hybridCol_18 = (tmpvar_7 + (tmpvar_11.xyz * tmpvar_26.x));
  hybridCol_18 = (hybridCol_18 + (tmpvar_13.xyz * tmpvar_32.y));
  hybridCol_18 = (hybridCol_18 + (tmpvar_15.xyz * tmpvar_38.z));
  hybridCol_18 = (hybridCol_18 + (tmpvar_17.xyz * tmpvar_44.w));
  vec3 x_47;
  x_47 = (hybridCol_18 * 0.25);
  vec3 tmpvar_48;
  vec3 tmpvar_49;
  tmpvar_49 = (_Tonemap_blackLevel * 0.25);
  tmpvar_48 = max ((x_47 - tmpvar_49), vec3(0.0, 0.0, 0.0));
  x_47 = ((tmpvar_48 * (
    (_Tonemap_colorScale1 * tmpvar_48)
   + _Tonemap_heel)) / ((tmpvar_48 * 
    ((_Tonemap_colorScale2 * tmpvar_48) + _Tonemap_shoulder)
  ) + _Tonemap_toeLength));
  vec3 x_50;
  x_50 = ((_HybridSunCol.xyz * dot (tmpvar_3, _HybridSunDir)) * 0.25);
  vec3 tmpvar_51;
  tmpvar_51 = max ((x_50 - tmpvar_49), vec3(0.0, 0.0, 0.0));
  x_50 = ((tmpvar_51 * (
    (_Tonemap_colorScale1 * tmpvar_51)
   + _Tonemap_heel)) / ((tmpvar_51 * 
    ((_Tonemap_colorScale2 * tmpvar_51) + _Tonemap_shoulder)
  ) + _Tonemap_toeLength));
  vec3 tmpvar_52;
  vec3 tmpvar_53;
  tmpvar_52 = TANGENT.xyz;
  tmpvar_53 = (((gl_Normal.yzx * TANGENT.zxy) - (gl_Normal.zxy * TANGENT.yzx)) * TANGENT.w);
  mat3 tmpvar_54;
  tmpvar_54[0].x = tmpvar_52.x;
  tmpvar_54[0].y = tmpvar_53.x;
  tmpvar_54[0].z = gl_Normal.x;
  tmpvar_54[1].x = tmpvar_52.y;
  tmpvar_54[1].y = tmpvar_53.y;
  tmpvar_54[1].z = gl_Normal.y;
  tmpvar_54[2].x = tmpvar_52.z;
  tmpvar_54[2].y = tmpvar_53.z;
  tmpvar_54[2].z = gl_Normal.z;
  mat3 tmpvar_55;
  tmpvar_55[0] = _World2Object[0].xyz;
  tmpvar_55[1] = _World2Object[1].xyz;
  tmpvar_55[2] = _World2Object[2].xyz;
  gl_Position = (gl_ModelViewProjectionMatrix * gl_Vertex);
  xlv_TEXCOORD0 = (tmpvar_54 * (tmpvar_55 * (lAgg_21 / wAgg_20)));
  xlv_TEXCOORD1 = (x_47 * 4.0);
  xlv_COLOR = (x_50 * 4.0);
  xlv_TEXCOORD2 = ((gl_MultiTexCoord0.xy * _MainTex_ST.xy) + _MainTex_ST.zw);
}


// stats: 133 alu 1 tex 0 flow
// inputs: 6
//  #0: gl_MultiTexCoord1 (high float) 4x1 [-1] loc 9
//  #1: gl_MultiTexCoord0 (high float) 4x1 [-1] loc 8
//  #2: gl_Color (high float) 4x1 [-1] loc 3
//  #3: gl_Normal (high float) 3x1 [-1] loc 2
//  #4: gl_Vertex (high float) 4x1 [-1] loc 0
//  #5: TANGENT (high float) 4x1 [-1]
// uniforms: 17 (total size: 0)
//  #0: gl_ModelViewProjectionMatrix (high float) 4x4 [-1]
//  #1: _Object2World (high float) 4x4 [-1]
//  #2: _World2Object (high float) 4x4 [-1]
//  #3: _Tonemap_blackLevel (high float) 3x1 [-1]
//  #4: _Tonemap_toeLength (high float) 3x1 [-1]
//  #5: _Tonemap_heel (high float) 3x1 [-1]
//  #6: _Tonemap_shoulder (high float) 3x1 [-1]
//  #7: _Tonemap_colorScale1 (high float) 3x1 [-1]
//  #8: _Tonemap_colorScale2 (high float) 3x1 [-1]
//  #9: _HybridSunDir (high float) 3x1 [-1]
//  #10: _HybridSunCol (high float) 4x1 [-1]
//  #11: GridLightTextureStartCell (high float) 3x1 [-1]
//  #12: GridLightTextureCellSize (high float) 3x1 [-1]
//  #13: IngameGridLimit (high float) 4x1 [-1]
//  #14: LightPos (high float) 4x1 [30]
//  #15: LightCol (high float) 4x1 [30]
//  #16: _MainTex_ST (high float) 4x1 [-1]
// textures: 1
//  #0: GridLightTexture (high 2d) 0x0 [-1]
