Mercurial > LightClone
view Data/Shaders/TexturedQuad.fx @ 51:efd2b1ca5b77
Clean up gui
author | koryspansel <koryspansel@bendbroadband.com> |
---|---|
date | Tue, 27 Sep 2011 09:42:01 -0700 |
parents | 7e3a0ae9c016 |
children |
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; }; /* * VertexInput1 */ struct VertexInput1 { /* * Position */ float3 Position : POSITION0; /* * TextureCoordinate */ float2 TextureCoordinate : TEXCOORD0; /* * Color */ float4 Color : COLOR0; }; /* * VertexOutput */ struct VertexOutput { /* * Position */ float4 Position : POSITION0; /* * TextureCoordinate */ float2 TextureCoordinate : TEXCOORD0; }; /* * VertexOutput1 */ struct VertexOutput1 { /* * Position */ float4 Position : POSITION0; /* * TextureCoordinate */ float2 TextureCoordinate : TEXCOORD0; /* * Color */ float4 Color : COLOR0; }; /* * 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; } /* * TexturedQuadVS */ VertexOutput1 TexturedQuadVS1(VertexInput1 kInput) { VertexOutput1 kOutput; kOutput.Position = mul(float4(kInput.Position, 1.0f), kProjection); kOutput.TextureCoordinate = kInput.TextureCoordinate; kOutput.Color = kInput.Color; 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; } /* * TexturedQuadPS */ PixelOutput TexturedQuadPS1(PixelInput kInput) { PixelOutput kOutput; float4 kTexture = tex2D(TextureSampler, kInput.TextureCoordinate); kOutput.Color = float4(kTexture.rgb * kInput.Color.rgb, kTexture.a); 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; } } technique Color { pass Opaque { vertexShader = compile vs_2_0 TexturedQuadVS1(); pixelShader = compile ps_2_0 TexturedQuadPS1(); ZEnable = true; ZWriteEnable = true; //ZFunc = LessEqual; AlphaBlendEnable = true; AlphaFunc = LessEqual; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; } }