struct SurfaceOutput {
  vec3 Albedo;
  vec3 Normal;
  vec3 Emission;
  float Specular;
  float Gloss;
  float Alpha;
};
struct Input {
  vec2 uv_MainTex;
  vec2 uv_Detail;
};
struct v2f_surf {
  vec4 pos;
  float fog;
  vec4 hip_pack0;
  vec3 normal;
  vec3 lightDir;
  vec4 _LightCoord;
};
varying vec4 xlv_FOG;
uniform sampler2D _MainTex;
uniform sampler2D _LightTextureB0;
uniform sampler2D _LightTexture0;
uniform vec4 _LightColor0;
uniform sampler2D _Detail;
uniform vec4 _Color;
void surf (
  in Input IN_1,
  inout SurfaceOutput o_2
)
{
  vec4 c_3;
  vec4 tmpvar_4;
  tmpvar_4 = texture2D (_MainTex, IN_1.uv_MainTex);
  vec4 tmpvar_5;
  tmpvar_5 = (tmpvar_4 * _Color);
  c_3 = tmpvar_5;
  vec4 tmpvar_6;
  tmpvar_6 = texture2D (_Detail, IN_1.uv_Detail);
  vec3 tmpvar_7;
  tmpvar_7 = (c_3.xyz * (tmpvar_6.xyz * 2.0));
  c_3.xyz = tmpvar_7.xyz.xyz;
  vec3 tmpvar_8;
  tmpvar_8 = c_3.xyz;
  o_2.Albedo = tmpvar_8;
  float tmpvar_9;
  tmpvar_9 = c_3.w;
  o_2.Alpha = tmpvar_9;
}

float UnitySpotCookie (
  in vec4 LightCoord_10
)
{
  vec4 tmpvar_11;
  tmpvar_11 = texture2D (_LightTexture0, ((LightCoord_10.xy / LightCoord_10.w) + 0.5));
  return tmpvar_11.w;
}

float UnitySpotAttenuate (
  in vec3 LightCoord_12
)
{
  float tmpvar_13;
  tmpvar_13 = dot (LightCoord_12, LightCoord_12);
  vec2 tmpvar_14;
  tmpvar_14 = vec2(tmpvar_13);
  vec2 tmpvar_15;
  tmpvar_15 = tmpvar_14.xy;
  vec4 tmpvar_16;
  tmpvar_16 = texture2D (_LightTextureB0, tmpvar_15);
  return tmpvar_16.w;
}

vec4 LightingLambert (
  in SurfaceOutput s_17,
  in vec3 lightDir_18,
  in float atten_19
)
{
  vec4 c_20;
  float diff_21;
  float tmpvar_22;
  tmpvar_22 = dot (s_17.Normal, lightDir_18);
  float tmpvar_23;
  tmpvar_23 = max (0.0, tmpvar_22);
  float tmpvar_24;
  tmpvar_24 = tmpvar_23;
  diff_21 = tmpvar_24;
  vec3 tmpvar_25;
  tmpvar_25 = ((s_17.Albedo * _LightColor0.xyz) * ((diff_21 * atten_19) * 2.0));
  c_20.xyz = tmpvar_25.xyz.xyz;
  float tmpvar_26;
  tmpvar_26 = s_17.Alpha;
  c_20.w = vec4(tmpvar_26).w;
  return c_20;
}

vec4 frag_surf (
  in v2f_surf IN_27
)
{
  vec4 c_28;
  vec3 lightDir_29;
  SurfaceOutput o_30;
  Input surfIN_31;
  vec2 tmpvar_32;
  tmpvar_32 = IN_27.hip_pack0.xy;
  surfIN_31.uv_MainTex = tmpvar_32;
  vec2 tmpvar_33;
  tmpvar_33 = IN_27.hip_pack0.zw;
  surfIN_31.uv_Detail = tmpvar_33;
  vec3 tmpvar_34;
  tmpvar_34 = vec3(0.0, 0.0, 0.0);
  o_30.Albedo = tmpvar_34;
  vec3 tmpvar_35;
  tmpvar_35 = vec3(0.0, 0.0, 0.0);
  o_30.Emission = tmpvar_35;
  float tmpvar_36;
  tmpvar_36 = 0.0;
  o_30.Specular = tmpvar_36;
  float tmpvar_37;
  tmpvar_37 = 0.0;
  o_30.Alpha = tmpvar_37;
  float tmpvar_38;
  tmpvar_38 = 0.0;
  o_30.Gloss = tmpvar_38;
  vec3 tmpvar_39;
  tmpvar_39 = IN_27.normal;
  o_30.Normal = tmpvar_39;
  surf (surfIN_31, o_30);
  vec3 tmpvar_40;
  tmpvar_40 = IN_27.lightDir;
  lightDir_29 = tmpvar_40;
  vec3 tmpvar_41;
  tmpvar_41 = normalize (lightDir_29);
  vec3 tmpvar_42;
  tmpvar_42 = tmpvar_41;
  lightDir_29 = tmpvar_42;
  float tmpvar_43;
  tmpvar_43 = UnitySpotCookie (IN_27._LightCoord);
  float tmpvar_44;
  tmpvar_44 = UnitySpotAttenuate (IN_27._LightCoord.xyz);
  vec4 tmpvar_45;
  tmpvar_45 = LightingLambert (o_30, lightDir_29, ((float((IN_27._LightCoord.z > 0.0)) * tmpvar_43) * tmpvar_44));
  vec4 tmpvar_46;
  tmpvar_46 = tmpvar_45;
  c_28 = tmpvar_46;
  float tmpvar_47;
  tmpvar_47 = 0.0;
  c_28.w = vec4(tmpvar_47).w;
  return c_28;
}

void main ()
{
  v2f_surf xlt_IN_48;
  vec4 xl_retval_49;
  vec4 tmpvar_50;
  tmpvar_50 = vec4(0.0, 0.0, 0.0, 0.0);
  xlt_IN_48.pos = tmpvar_50;
  float tmpvar_51;
  tmpvar_51 = xlv_FOG.x;
  xlt_IN_48.fog = tmpvar_51;
  vec4 tmpvar_52;
  tmpvar_52 = gl_TexCoord[0].xyzw;
  vec4 tmpvar_53;
  tmpvar_53 = tmpvar_52;
  xlt_IN_48.hip_pack0 = tmpvar_53;
  vec3 tmpvar_54;
  tmpvar_54 = gl_TexCoord[1].xyz;
  vec3 tmpvar_55;
  tmpvar_55 = tmpvar_54;
  xlt_IN_48.normal = tmpvar_55;
  vec3 tmpvar_56;
  tmpvar_56 = gl_TexCoord[2].xyz;
  vec3 tmpvar_57;
  tmpvar_57 = tmpvar_56;
  xlt_IN_48.lightDir = tmpvar_57;
  vec4 tmpvar_58;
  tmpvar_58 = gl_TexCoord[3].xyzw;
  vec4 tmpvar_59;
  tmpvar_59 = tmpvar_58;
  xlt_IN_48._LightCoord = tmpvar_59;
  vec4 tmpvar_60;
  tmpvar_60 = frag_surf (xlt_IN_48);
  vec4 tmpvar_61;
  tmpvar_61 = tmpvar_60;
  xl_retval_49 = tmpvar_61;
  vec4 tmpvar_62;
  tmpvar_62 = xl_retval_49.xyzw;
  vec4 tmpvar_63;
  tmpvar_63 = tmpvar_62;
  gl_FragData[0] = tmpvar_63;
}

