45 lines
1.0 KiB
HLSL
45 lines
1.0 KiB
HLSL
|
//-----------------------------------------------------------------------------
|
||
|
// SpriteEffect.fx
|
||
|
//
|
||
|
// Microsoft XNA Community Game Platform
|
||
|
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||
|
//-----------------------------------------------------------------------------
|
||
|
|
||
|
#include "Macros.fxh"
|
||
|
|
||
|
|
||
|
DECLARE_TEXTURE(Texture, 0);
|
||
|
|
||
|
|
||
|
BEGIN_CONSTANTS
|
||
|
MATRIX_CONSTANTS
|
||
|
|
||
|
float4x4 MatrixTransform _vs(c0) _cb(c0);
|
||
|
|
||
|
END_CONSTANTS
|
||
|
|
||
|
|
||
|
void SpriteVertexShader(inout float4 color : COLOR0,
|
||
|
inout float2 texCoord : TEXCOORD0,
|
||
|
inout float4 position : SV_Position)
|
||
|
{
|
||
|
position = mul(position, MatrixTransform);
|
||
|
}
|
||
|
|
||
|
|
||
|
float4 SpritePixelShader(float4 color : COLOR0,
|
||
|
float2 texCoord : TEXCOORD0) : SV_Target0
|
||
|
{
|
||
|
return SAMPLE_TEXTURE(Texture, texCoord) * color;
|
||
|
}
|
||
|
|
||
|
|
||
|
technique SpriteBatch
|
||
|
{
|
||
|
pass
|
||
|
{
|
||
|
VertexShader = compile vs_2_0 SpriteVertexShader();
|
||
|
PixelShader = compile ps_2_0 SpritePixelShader();
|
||
|
}
|
||
|
}
|