irrlicht/media/pp_d3d9.hlsl
cutealien 8310a3fbad Avoid warning and make local variable lower-case.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6000 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-12-12 16:32:41 +00:00

44 lines
1004 B
HLSL

// Texture size to calculate texel center
float2 TextureSize;
// Vertex shader output struct
struct VS_OUTPUT
{
float4 Position : POSITION0;
float2 TexCoords : TEXCOORD0;
};
VS_OUTPUT vertexMain(
float4 Position : POSITION0,
float2 TexCoords : TEXCOORD0
)
{
VS_OUTPUT OUT;
OUT.Position = Position;
// In practice, instead of passing in TextureSize,
// pass 1.0 / TextureSize for better performance
// TexCoords is set to the texel center
OUT.TexCoords = TexCoords + 1.0 / TextureSize / 2.0;
return OUT;
}
// Texture sampler
sampler2D TextureSampler;
float4 pixelMain ( float2 Texcoords : TEXCOORD0 ) : COLOR0
{
// Texture is sampled at Texcoords using tex2D
float4 Color = tex2D(TextureSampler, Texcoords);
// Change Texcoords to sample pixels around
// Inverse the color to produce negative image effect
Color.rgb = 1.0 - Color.rgb;
return Color;
};