Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // invert.fx
- //
- //---------------------------------------------------------------------
- // Settings
- //---------------------------------------------------------------------
- float4x4 gWorldViewProjection : WORLDVIEWPROJECTION;
- texture sBaseTexture;
- //---------------------------------------------------------------------
- // Sampler
- //---------------------------------------------------------------------
- sampler BaseSampler = sampler_state
- {
- Texture = (sBaseTexture);
- AddressU = Mirror;
- AddressV = Mirror;
- MinFilter = Linear;
- MagFilter = Linear;
- MipFilter = Linear;
- };
- //---------------------------------------------------------------------
- // Structure of data sent to the pixel shader ( from the vertex shader )
- //---------------------------------------------------------------------
- struct VSInput
- {
- float3 Position : POSITION0;
- float2 TexCoord : TEXCOORD0;
- };
- struct PSInput
- {
- float4 Position : POSITION0;
- float2 TexCoord : TEXCOORD0;
- };
- //------------------------------------------------------------------------------------------
- // VertexShaderFunction
- //------------------------------------------------------------------------------------------
- PSInput VertexShaderFunction(VSInput VS)
- {
- PSInput PS = (PSInput)0;
- PS.Position = mul(float4(VS.Position, 1), gWorldViewProjection);
- PS.TexCoord = VS.TexCoord;
- return PS;
- }
- //------------------------------------------------------------------------------------------
- // PixelShaderFunction
- //------------------------------------------------------------------------------------------
- float4 PixelShaderFunction(PSInput PS) : COLOR0
- {
- float4 color = tex2D(BaseSampler, PS.TexCoord);
- color.rgb = float3(1 - color.r, 1 - color.g, 1 - color.b);
- color.rgb = saturate(color.rgb);
- return color;
- }
- //------------------------------------------------------------------------------------------
- // Techniques
- //------------------------------------------------------------------------------------------
- technique invert
- {
- pass P0
- {
- VertexShader = compile vs_2_0 VertexShaderFunction();
- PixelShader = compile ps_2_0 PixelShaderFunction();
- }
- }
- // Fallback
- technique fallback
- {
- pass P0
- {
- // Just draw normally
- }
- }
Add Comment
Please, Sign In to add comment