]> git.lizzy.rs Git - irrlicht.git/blob - media/pp_d3d9.hlsl
Merging r6075 through r6106 from trunk to ogl-es branch.
[irrlicht.git] / media / pp_d3d9.hlsl
1 \r
2 // Texture size to calculate texel center\r
3 float2 TextureSize;\r
4 \r
5 // Vertex shader output struct\r
6 struct VS_OUTPUT\r
7 {\r
8     float4 Position  : POSITION0;\r
9     float2 TexCoords : TEXCOORD0;\r
10 };\r
11 \r
12 VS_OUTPUT vertexMain(\r
13     float4 Position  : POSITION0, \r
14     float2 TexCoords : TEXCOORD0\r
15     )\r
16 {\r
17     VS_OUTPUT OUT;\r
18     OUT.Position = Position;\r
19     \r
20     // In practice, instead of passing in TextureSize,\r
21     // pass 1.0 / TextureSize for better performance\r
22     \r
23     // TexCoords is set to the texel center\r
24     OUT.TexCoords = TexCoords + 1.0 / TextureSize / 2.0;\r
25     \r
26     return OUT;\r
27 }\r
28 \r
29 // Texture sampler\r
30 sampler2D TextureSampler;\r
31 \r
32 float4 pixelMain ( float2 Texcoords : TEXCOORD0 ) : COLOR0\r
33 {\r
34     // Texture is sampled at Texcoords using tex2D\r
35     float4 Color = tex2D(TextureSampler, Texcoords);\r
36     \r
37     // Change Texcoords to sample pixels around\r
38     \r
39     // Inverse the color to produce negative image effect\r
40     Color.rgb = 1.0 - Color.rgb;\r
41     \r
42     return Color;\r
43 };\r