view Data/Shaders/TexturedQuad.fx @ 32:c227be6a15fe

Fixed drag and drop handling; Just needs to be hooked up now
author koryspansel
date Tue, 20 Sep 2011 21:26:22 -0700
parents 7e3a0ae9c016
children efd2b1ca5b77
line wrap: on
line source

extern uniform float4x4	kProjection;
extern uniform float4x4 kWorld;
extern uniform texture	kTexture;
extern uniform float4	kColor;

/*
 * TextureSampler
 */
sampler TextureSampler = sampler_state
{
	Texture		= <kTexture>;
	MinFilter	= POINT;
	MagFilter	= POINT;
	AddressU	= CLAMP;
	AddressV	= CLAMP;
};

/*
 * VertexInput
 */
struct VertexInput
{
	/*
	 * Position
	 */
	float3 Position : POSITION0;

	/*
	 * TextureCoordinate
	 */
	float2 TextureCoordinate : TEXCOORD0;
};

/*
 * VertexOutput
 */
struct VertexOutput
{
	/*
	 * Position
	 */
	float4 Position : POSITION0;

	/*
	 * TextureCoordinate
	 */
	float2 TextureCoordinate : TEXCOORD0;
};

/*
 * PixelInput
 */
struct PixelInput
{
	/*
	 * TextureCoordinate
	 */
	float2 TextureCoordinate : TEXCOORD0;

	/*
	 * Color
	 */
	float4 Color : COLOR0;
};

/*
 * PixelOutput
 */
struct PixelOutput
{
	/*
	 * Color
	 */
	float4 Color : COLOR0;
};

/*
 * TexturedQuadVS
 */
VertexOutput TexturedQuadVS(VertexInput kInput)
{
	VertexOutput kOutput;

	kOutput.Position			= mul(float4(kInput.Position, 1.0f), mul(kWorld, kProjection));
	kOutput.TextureCoordinate	= kInput.TextureCoordinate;

	return kOutput;
}

/*
 * TexturedQuadPS
 */
PixelOutput TexturedQuadPS(PixelInput kInput)
{
	PixelOutput kOutput;

	float4 kTexture = tex2D(TextureSampler, kInput.TextureCoordinate);

	kOutput.Color = float4(kTexture.rgb * kColor.rgb, kTexture.a);
	//kOutput.Color = kColor;

	return kOutput;
}

technique Default
{
	pass Opaque
	{
		vertexShader		= compile vs_2_0 TexturedQuadVS();
		pixelShader			= compile ps_2_0 TexturedQuadPS();

		/*
		ZEnable				= true;
		ZWriteEnable		= true;
		ZFunc				= LessEqual;
		*/

		AlphaBlendEnable	= true;
		AlphaFunc			= LessEqual;
		SrcBlend			= SrcAlpha;
		DestBlend			= InvSrcAlpha;
	}
}