float4x4 worldViewProj : WorldViewProjection;
float4x4 viewProj : ViewProjection;
float4x4 world : World;

#define BONEMODE_4x3 1

#include "generic.fx"
#include "mrt.fx"

texture diffuseTexture : Diffuse
<
	string ResourceName = "default_color.dds";
>;

sampler TextureSampler = sampler_state 
{
    texture = <diffuseTexture>;
    AddressU  = CLAMP;        
    AddressV  = CLAMP;
    AddressW  = CLAMP;
    MIPFILTER = LINEAR;
    MINFILTER = LINEAR;
    MAGFILTER = LINEAR;
};

Material            matSettings     : MATERIAL;
float alphaInUse : ALPHA_TEST;

struct vertexInputUnboned {
    float4 position				: POSITION;
    float2 texCoordDiffuse		: TEXCOORD0;
};

struct vertexOutput {
    float4 hPosition		: POSITION;
    float2 texCoordDiffuse	: TEXCOORD0;
};

vertexOutput VS_Shared(float4 pos, float2 uv)
{
    vertexOutput OUT;

    OUT.texCoordDiffuse = uv;
    OUT.hPosition = mul( pos , viewProj);
    return OUT;
}

vertexOutput VS_TransformUnboned(vertexInputUnboned IN) 
{
    float4 pos;
    
    pos = mul(IN.position, world);
    return VS_Shared(pos, IN.texCoordDiffuse);
}

PS_OUTPUT PS_Textured( vertexOutput IN)
{
    float4 outColor = tex2D(TextureSampler, IN.texCoordDiffuse);
    outColor.xyz *= matSettings.Diffuse_Opacity.xyz;
        
    PS_OUTPUT Out;
    SetPSOutput( Out, outColor, 0 );
    return Out;
}


//-----------------------------------
technique unboned
{
    pass p0 
    {		
		VertexShader = compile vs_2_0 VS_TransformUnboned();
		PixelShader  = compile ps_2_0 PS_Textured();
		alphatestenable = true;
		alpharef = 128;
		alphafunc = greaterequal;
		cullmode = none;
    }
}
