debut de texture translation
This commit is contained in:
37
enginecustom/translate.ps
Normal file
37
enginecustom/translate.ps
Normal file
@@ -0,0 +1,37 @@
|
||||
/////////////
|
||||
// GLOBALS //
|
||||
/////////////
|
||||
Texture2D shaderTexture : register(t0);
|
||||
SamplerState SampleType : register(s0);
|
||||
|
||||
cbuffer TranslationBuffer
|
||||
{
|
||||
float textureTranslation;
|
||||
};
|
||||
|
||||
|
||||
//////////////
|
||||
// TYPEDEFS //
|
||||
//////////////
|
||||
struct PixelInputType
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Pixel Shader
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
float4 TranslatePixelShader(PixelInputType input) : SV_TARGET
|
||||
{
|
||||
float4 textureColor;
|
||||
|
||||
|
||||
// Translate the position where we sample the pixel from.
|
||||
input.tex.x += textureTranslation;
|
||||
|
||||
// Sample the pixel color from the texture using the sampler at this texture coordinate location.
|
||||
textureColor = shaderTexture.Sample(SampleType, input.tex);
|
||||
|
||||
return textureColor;
|
||||
}
|
||||
Reference in New Issue
Block a user