simplify (still more complicated than cropping/fading should be ...)

This commit is contained in:
Glenn Maynard
2005-01-04 02:10:09 +00:00
parent e00d5fe834
commit 36a56f51fd
+6 -12
View File
@@ -241,30 +241,24 @@ void BitmapText::DrawChars()
{ {
int i = start*4; int i = start*4;
float fAlpha = 1.0f;
if( FadeSize.left > 0.001f ) if( FadeSize.left > 0.001f )
{ {
/* Add .5, so we fade wrt. the center of the vert, not the left side. */ /* Add .5, so we fade wrt. the center of the vert, not the left side. */
float fPercent = SCALE( start+0.5f, fLeftFadeStartGlyph, fLeftFadeStopGlyph, 0.0f, 1.0f ); float fPercent = SCALE( start+0.5f, fLeftFadeStartGlyph, fLeftFadeStopGlyph, 0.0f, 1.0f );
fPercent = clamp( fPercent, 0.0f, 1.0f ); fPercent = clamp( fPercent, 0.0f, 1.0f );
fPercent *= LeftAlpha; fAlpha *= fPercent * LeftAlpha;
verts[i+0].c.a = (unsigned char)( verts[i+0].c.a * fPercent ); // top left
verts[i+1].c.a = (unsigned char)( verts[i+1].c.a * fPercent ); // bottom left
verts[i+2].c.a = (unsigned char)( verts[i+2].c.a * fPercent ); // bottom right
verts[i+3].c.a = (unsigned char)( verts[i+3].c.a * fPercent ); // top right
} }
if( FadeSize.right > 0.001f ) if( FadeSize.right > 0.001f )
{ {
float fPercent = SCALE( start+0.5f, fRightFadeStartGlyph, fRightFadeStopGlyph, 1.0f, 0.0f ); float fPercent = SCALE( start+0.5f, fRightFadeStartGlyph, fRightFadeStopGlyph, 1.0f, 0.0f );
fPercent = clamp( fPercent, 0.0f, 1.0f ); fPercent = clamp( fPercent, 0.0f, 1.0f );
fPercent *= RightAlpha; fAlpha *= fPercent * RightAlpha;
verts[i+0].c.a = (unsigned char)( verts[i+0].c.a * fPercent ); // top left
verts[i+1].c.a = (unsigned char)( verts[i+1].c.a * fPercent ); // bottom left
verts[i+2].c.a = (unsigned char)( verts[i+2].c.a * fPercent ); // bottom right
verts[i+3].c.a = (unsigned char)( verts[i+3].c.a * fPercent ); // top right
} }
for( int j = 0; j < 4; ++j )
verts[i+j].c.a = (unsigned char)( verts[i+j].c.a * fAlpha );
} }
} }