//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000
//
//   vsa shaderdump19/SKIN2006.pso /Fcshaderdump19/SKIN2006.pso.dis
//
//
// Parameters:
//
float4 AmbientColor : register(c1);
sampler2D AttenuationMap : register(s4);
sampler2D BaseMap : register(s0);
sampler2D NormalMap : register(s1);
float4 PSLightColor[4] : register(c2);
float4 TESR_SkinData : register(c8);
float4 TESR_SkinColor : register(c9);



//
//
// Registers:
//
//   Name           Reg   Size
//   -------------- ----- ----
//   AmbientColor   const_1       1
//   PSLightColor[0]   const_2        1
//   PSLightColor[1]   const_3        1
//   PSLightColor[2]   const_4        1
//   BaseMap        texture_0       1
//   NormalMap      texture_1       1
//   AttenuationMap texture_4       1
//


// Structures:

struct VS_OUTPUT {
    float2 BaseUV : TEXCOORD0;
    float3 texcoord_1 : TEXCOORD1_centroid;
    float3 texcoord_2 : TEXCOORD2_centroid;
    float3 texcoord_3 : TEXCOORD3_centroid;
    float4 texcoord_4 : TEXCOORD4;
    float4 texcoord_5 : TEXCOORD5;
    float3 texcoord_7 : TEXCOORD7_centroid; 
    
 
};

struct PS_OUTPUT {
    float4 color_0 : COLOR0;
};

// Code:
#include "..\Includes\Skin.hlsl"


PS_OUTPUT main(VS_OUTPUT IN) {
    PS_OUTPUT OUT;

#define	expand(v)		(((v) - 0.5) / 0.5)
#define	compress(v)		(((v) * 0.5) + 0.5)
#define	shade(n, l)		max(dot(n, l), 0)
#define	shades(n, l)		saturate(dot(n, l))
#define	weight(v)		dot(v, 1)
#define	sqr(v)			((v) * (v))

    float1 att0;
    float1 att12;
    float1 att13;
    float1 att4;

    float3 q11;
    float3 q2;
    float1 q6;
    float1 q7;
    float3 q8;
    float3 q9;
    float4 r0;
    float3 r3;
    float3 norm;            
    float3 cam;  
      
    cam = normalize(IN.texcoord_7.xyz);
    norm = normalize(expand(tex2D(NormalMap, IN.BaseUV.xy).xyz));
   
    r0.xyzw = tex2D(BaseMap, IN.BaseUV.xy);
    att13.x = tex2D(AttenuationMap, IN.texcoord_5.zw);
    att0.x = tex2D(AttenuationMap, IN.texcoord_5.xy);
    att4.x = tex2D(AttenuationMap, IN.texcoord_4.xy);
    att12.x = tex2D(AttenuationMap, IN.texcoord_4.zw);
   
    q6.x = 1 - shade(norm.xyz, cam);
    q7.x = q6.x * sqr(q6.x);
    q11.xyz = (shade(norm.xyz, normalize(IN.texcoord_3.xyz)) * PSLightColor[2].rgb) + ((q7.x * PSLightColor[2].rgb) * 0.5);
    q8.xyz = (shade(norm.xyz, normalize(IN.texcoord_2.xyz)) * PSLightColor[1].rgb) + ((q7.x * PSLightColor[1].rgb) * 0.5);
    q9.xyz = (shade(norm.xyz, IN.texcoord_1.xyz) * PSLightColor[0].rgb) + ((q7.x * PSLightColor[0].rgb) * 0.5); 
     
    q11 = Skin(q11, PSLightColor[2].rgb, cam, IN.texcoord_3.xyz, norm);
    q8 = Skin(q8, PSLightColor[1].rgb, cam, IN.texcoord_2.xyz, norm); 
    q9 = Skin(q9, PSLightColor[0].rgb, cam, IN.texcoord_1.xyz, norm);
    
    
    
    r3.xyz = (saturate((1 - att4.x) - att12.x) * q8.xyz) + q9.xyz;
    OUT.color_0.a = r0.w;
    OUT.color_0.rgb = ((saturate((1 - att0.x) - att13.x) * q11.xyz) + r3.xyz) + AmbientColor.rgb;

    return OUT;
};

// approximately 52 instruction slots used (6 texture, 46 arithmetic)
