#define IN_HLSL
#include "../shdrConsts.h"

//-----------------------------------------------------------------------------
// Structures
//-----------------------------------------------------------------------------
struct ConnectData
{
   float2 texCoord        : TEXCOORD0;
   float3 reflectVec      : TEXCOORD1;
   float3 normal          : TEXCOORD2;
};


struct Fragout
{
   float4 col  : COLOR0;
   float4 col1 : COLOR1;
};


//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
Fragout main( ConnectData IN,
              uniform sampler2D diffuseMap      : register(S0),
              uniform samplerCUBE cubeMap       : register(S1)
)
{
   Fragout OUT;

   float4 diffuseColor = tex2D(diffuseMap, IN.texCoord);
   float4 cubeColor = texCUBE(cubeMap, IN.reflectVec);
   float3 diffusePlusCube = diffuseColor.rgb + cubeColor.rgb;

//OUT.col = cubeColor;

   OUT.col.a = 1.0;
//   OUT.rgb = diffusePlusCube;
   
   OUT.col.rgb = lerp( diffuseColor.rgb, diffusePlusCube, diffuseColor.a );

   OUT.col1 = float4( IN.normal.x, IN.normal.y, IN.normal.z, 0.0f );

   return OUT;
}
