(360) Small code cleanups in fonts.cpp

This commit is contained in:
TwinAphex51224 2012-05-07 03:34:57 +02:00
parent d40c1b3be6
commit 4b7b47fbf1

View File

@ -270,14 +270,11 @@ 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"
@ -289,27 +286,13 @@ 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"
"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"
"return tex2D( FontTexture, In.TexCoord0 );\n"
"}\n";
typedef struct Font_Locals_t {