Mercurial > LightClone
view Data/Shaders/TexturedQuad.fx @ 38:2caa7c7e2cb5
Refactored program; Added dialog
author | koryspansel |
---|---|
date | Wed, 21 Sep 2011 21:40:19 -0700 |
parents | 7e3a0ae9c016 |
children | efd2b1ca5b77 |
line wrap: on
line source
extern uniform float4x4 kProjection; extern uniform float4x4 kWorld; extern uniform texture kTexture; extern uniform float4 kColor; /* * TextureSampler */ sampler TextureSampler = sampler_state { Texture = <kTexture>; MinFilter = POINT; MagFilter = POINT; AddressU = CLAMP; AddressV = CLAMP; }; /* * VertexInput */ struct VertexInput { /* * Position */ float3 Position : POSITION0; /* * TextureCoordinate */ float2 TextureCoordinate : TEXCOORD0; }; /* * VertexOutput */ struct VertexOutput { /* * Position */ float4 Position : POSITION0; /* * TextureCoordinate */ float2 TextureCoordinate : TEXCOORD0; }; /* * PixelInput */ struct PixelInput { /* * TextureCoordinate */ float2 TextureCoordinate : TEXCOORD0; /* * Color */ float4 Color : COLOR0; }; /* * PixelOutput */ struct PixelOutput { /* * Color */ float4 Color : COLOR0; }; /* * TexturedQuadVS */ VertexOutput TexturedQuadVS(VertexInput kInput) { VertexOutput kOutput; kOutput.Position = mul(float4(kInput.Position, 1.0f), mul(kWorld, kProjection)); kOutput.TextureCoordinate = kInput.TextureCoordinate; return kOutput; } /* * TexturedQuadPS */ PixelOutput TexturedQuadPS(PixelInput kInput) { PixelOutput kOutput; float4 kTexture = tex2D(TextureSampler, kInput.TextureCoordinate); kOutput.Color = float4(kTexture.rgb * kColor.rgb, kTexture.a); //kOutput.Color = kColor; return kOutput; } technique Default { pass Opaque { vertexShader = compile vs_2_0 TexturedQuadVS(); pixelShader = compile ps_2_0 TexturedQuadPS(); /* ZEnable = true; ZWriteEnable = true; ZFunc = LessEqual; */ AlphaBlendEnable = true; AlphaFunc = LessEqual; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; } }