diff --git a/360/fonts.cpp b/360/fonts.cpp index 71823cfd9b..34930d1a54 100644 --- a/360/fonts.cpp +++ b/360/fonts.cpp @@ -270,11 +270,14 @@ static const char g_strFontShader[] = "{\n" "float2 Pos : POSITION;\n" "float2 Tex : TEXCOORD0;\n" + "float4 ChannelSelector : TEXCOORD1;\n" "};\n" "struct VS_OUT\n" "{\n" "float4 Position : POSITION;\n" + "float4 Diffuse : COLOR0_center;\n" "float2 TexCoord0 : TEXCOORD0;\n" + "float4 ChannelSelector : TEXCOORD1;\n" "};\n" "uniform float4 Color : register(c1);\n" "uniform float2 TexScale : register(c2);\n" @@ -286,13 +289,27 @@ static const char g_strFontShader[] = "Out.Position.y = (In.Pos.y-0.5);\n" "Out.Position.z = ( 0.0 );\n" "Out.Position.w = ( 1.0 );\n" + "Out.Diffuse = Color;\n" "Out.TexCoord0.x = In.Tex.x * TexScale.x;\n" "Out.TexCoord0.y = In.Tex.y * TexScale.y;\n" + "Out.ChannelSelector = In.ChannelSelector;\n" "return Out;\n" "}\n" "float4 main_fragment( VS_OUT In ) : COLOR0\n" "{\n" - "return tex2D( FontTexture, In.TexCoord0 );\n" + "float4 FontTexel = tex2D( FontTexture, In.TexCoord0 );\n" + "if( dot( In.ChannelSelector, float4(1,1,1,1) ) )\n" + "{\n" + "float value = dot( FontTexel, In.ChannelSelector );\n" + "float4 Color;\n" + "Color.rgb = ( value > 0.5f ? 2*value-1 : 0.0f );\n" + "Color.a = 2 * ( value > 0.5f ? 1.0f : value );\n" + "return Color * In.Diffuse;\n" + "}\n" + "else\n" + "{\n" + "return FontTexel * In.Diffuse;\n" + "}\n" "}\n"; typedef struct Font_Locals_t {