From 35c718b9900ff906ec5b6d4de9f370065226d75d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 1 Jan 2005 21:59:35 +0000 Subject: [PATCH] Removing "fadecolor". Fading is useful, but being able to fade with a factor other than #FFFFFF00 has never been useful, and it complicates the code. Note that "diffuse" and fading do combine, so a sprite with diffuse,#FF0000 will still fade out correctly. --- stepmania/src/BitmapText.cpp | 6 ++---- stepmania/src/Sprite.cpp | 34 ++++++++++++---------------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index c5a1448aae..1c6a4849e8 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -222,12 +222,10 @@ void BitmapText::DrawChars() FadeSize.right = (1.0f-LeftPercent) * HorizRemaining; } - const RageColor &FadeColor = m_pTempState->fadecolor; - /* We fade from 0 to LeftColor, then from RightColor to 0. (We won't fade all the way to * 0 if the crop is beyond the outer edge.) */ - const RageColor RightColor = scale( FadeSize.right, FadeDist.right, 0, RageColor(1,1,1,1), FadeColor ); - const RageColor LeftColor = scale( FadeSize.left, FadeDist.left, 0, RageColor(1,1,1,1), FadeColor ); + const RageColor RightColor = scale( FadeSize.right, FadeDist.right, 0, RageColor(1,1,1,1), RageColor(1,1,1,0) ); + const RageColor LeftColor = scale( FadeSize.left, FadeDist.left, 0, RageColor(1,1,1,1), RageColor(1,1,1,0) ); const float StartFadeLeftPercent = m_pTempState->crop.left; const float StopFadeLeftPercent = m_pTempState->crop.left + FadeSize.left; diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 264da1f3ca..f9c22764ad 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -565,13 +565,11 @@ void Sprite::DrawPrimitives() FadeSize.bottom = (1.0f-TopPercent) * VertRemaining; } - const RageColor &FadeColor = m_pTempState->fadecolor; - /* Alpha value of the un-faded side of each fade rect: */ - const RageColor RightColor = scale( FadeSize.right, FadeDist.right, 0, RageColor(1,1,1,1), FadeColor ); - const RageColor LeftColor = scale( FadeSize.left, FadeDist.left, 0, RageColor(1,1,1,1), FadeColor ); - const RageColor TopColor = scale( FadeSize.top, FadeDist.top, 0, RageColor(1,1,1,1), FadeColor ); - const RageColor BottomColor = scale( FadeSize.bottom, FadeDist.bottom, 0, RageColor(1,1,1,1), FadeColor ); + const float RightAlpha = SCALE( FadeSize.right, FadeDist.right, 0, 1, 0 ); + const float LeftAlpha = SCALE( FadeSize.left, FadeDist.left, 0, 1, 0 ); + const float TopAlpha = SCALE( FadeSize.top, FadeDist.top, 0, 1, 0 ); + const float BottomAlpha = SCALE( FadeSize.bottom, FadeDist.bottom, 0, 1, 0 ); /* Draw the inside: */ TweenState ts = *m_pTempState; @@ -590,10 +588,8 @@ void Sprite::DrawPrimitives() ts.crop.right = 1 - (ts.crop.left + FadeSize.left); ts.crop.top += FadeDist.top; // lop off the corner if fading both x and y ts.crop.bottom += FadeDist.bottom; - ts.diffuse[0] *= FadeColor; // top left - ts.diffuse[2] *= FadeColor; // bottom left - ts.diffuse[3] *= LeftColor; // bottom right - ts.diffuse[1] *= LeftColor; // top right + ts.diffuse[3].a *= LeftAlpha; // bottom right + ts.diffuse[1].a *= LeftAlpha; // top right DrawTexture( &ts ); } @@ -606,10 +602,8 @@ void Sprite::DrawPrimitives() ts.crop.left = 1 - (ts.crop.right + FadeSize.right); ts.crop.top += FadeDist.top; ts.crop.bottom += FadeDist.bottom; - ts.diffuse[0] *= RightColor; // top left - ts.diffuse[2] *= RightColor; // bottom left - ts.diffuse[3] *= FadeColor; // bottom right - ts.diffuse[1] *= FadeColor; // top right + ts.diffuse[0] *= RightAlpha; // top left + ts.diffuse[2] *= RightAlpha; // bottom left DrawTexture( &ts ); } @@ -622,10 +616,8 @@ void Sprite::DrawPrimitives() ts.crop.bottom = 1 - (ts.crop.top + FadeSize.top); ts.crop.left += FadeDist.left; ts.crop.right += FadeDist.right; - ts.diffuse[0] *= FadeColor; // top left - ts.diffuse[2] *= TopColor; // bottom left - ts.diffuse[3] *= TopColor; // bottom right - ts.diffuse[1] *= FadeColor; // top right + ts.diffuse[2] *= TopAlpha; // bottom left + ts.diffuse[3] *= TopAlpha; // bottom right DrawTexture( &ts ); } @@ -638,10 +630,8 @@ void Sprite::DrawPrimitives() ts.crop.top = 1 - (ts.crop.bottom + FadeSize.bottom); ts.crop.left += FadeDist.left; ts.crop.right += FadeDist.right; - ts.diffuse[0] *= BottomColor; // top left - ts.diffuse[2] *= FadeColor; // bottom left - ts.diffuse[3] *= FadeColor; // bottom right - ts.diffuse[1] *= BottomColor; // top right + ts.diffuse[0] *= BottomAlpha; // top left + ts.diffuse[1] *= BottomAlpha; // top right DrawTexture( &ts ); } }