// --------------------------------------------------------------------------------------------- // // SolidColor Effect // --------------------------------------------------------------------------------------------- // // // Fills any polygons drawn with it in a solid color // /// Concatenated view and projection matrix float4x4 ViewProjection : VIEWPROJECTION; /// Color of the text when rendered float4 TextColor : TEXTCOLOR; // --------------------------------------------------------------------------------------------- // // Supporting Structures // --------------------------------------------------------------------------------------------- // /// Vertex shader output values. These are sent to the pixel shader. struct VertexShaderOutput { /// Position in screen coordinates float4 Position : POSITION0; /// Color of the vertex float4 Color : COLOR0; }; // --------------------------------------------------------------------------------------------- // // Vertex Shader // --------------------------------------------------------------------------------------------- // /// Transforms a vertex into view space /// Position of the vertex in world coordinates /// Color of the vertex /// The transformed vertex VertexShaderOutput VertexShaderFunction(float4 position : POSITION0) { VertexShaderOutput output; output.Position = mul(position, ViewProjection); output.Color = TextColor; return output; } // --------------------------------------------------------------------------------------------- // // Pixel Shader // --------------------------------------------------------------------------------------------- // /// Calculates the color of a pixel /// Color the pixel will have /// The calculated color of the pixel float4 PixelShaderFunction(float4 color : COLOR0) : COLOR0 { return color; }; // --------------------------------------------------------------------------------------------- // // Techniques // --------------------------------------------------------------------------------------------- // technique SolidColorTechnique { pass FillPass { CullMode = None; ZEnable = false; ZWriteEnable = false; AlphaBlendEnable = true; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } }