merge hold note wavy part rendering
This commit is contained in:
+117
-217
@@ -367,168 +367,52 @@ struct StripBuffer
|
|||||||
int Free() const { return size - Used(); }
|
int Free() const { return size - Used(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
void NoteDisplay::DrawHoldTopCap( const TapNote& tn, int iCol, float fBeat, bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, bool bIsAddition, float fPercentFadeToFail, float fColorScale,
|
void NoteDisplay::DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow,
|
||||||
bool bGlow, float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar )
|
float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar,
|
||||||
|
float fYTop, float fYBottom,
|
||||||
|
float fYStartPos, float fYEndPos,
|
||||||
|
bool bWrapping, bool bAnchorToBottom )
|
||||||
{
|
{
|
||||||
//
|
ASSERT( !vpSpr.empty() );
|
||||||
// Draw the top cap (always wavy)
|
|
||||||
//
|
|
||||||
StripBuffer queue;
|
|
||||||
|
|
||||||
vector<Sprite*> vpSpr;
|
Sprite *pSprite = vpSpr.front();
|
||||||
Sprite *pSprite = GetHoldSprite( m_HoldTopCap, NotePart_HoldTopCap, fBeat, tn.subType == TapNote::hold_head_roll, bIsBeingHeld && !cache->m_bHoldActiveIsAddLayer );
|
FOREACH( Sprite *, vpSpr, s )
|
||||||
pSprite->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
|
||||||
vpSpr.push_back( pSprite );
|
|
||||||
if( bIsBeingHeld && cache->m_bHoldActiveIsAddLayer )
|
|
||||||
{
|
{
|
||||||
Sprite *pSpr = GetHoldSprite( m_HoldTopCap, NotePart_HoldTopCap, fBeat, tn.subType == TapNote::hold_head_roll, true );
|
(*s)->SetZoom( ArrowEffects::GetZoom(m_pPlayerState) );
|
||||||
ASSERT( pSpr->GetUnzoomedWidth() == pSprite->GetUnzoomedWidth() );
|
ASSERT( (*s)->GetUnzoomedWidth() == pSprite->GetUnzoomedWidth() );
|
||||||
ASSERT( pSpr->GetUnzoomedHeight() == pSprite->GetUnzoomedHeight() );
|
ASSERT( (*s)->GetUnzoomedHeight() == pSprite->GetUnzoomedHeight() );
|
||||||
pSpr->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
|
||||||
vpSpr.push_back( pSpr );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DISPLAY->ClearAllTextures();
|
|
||||||
DISPLAY->SetCullMode( CULL_NONE );
|
|
||||||
DISPLAY->SetTextureWrapping(false);
|
|
||||||
|
|
||||||
// draw manually in small segments
|
// draw manually in small segments
|
||||||
const RectF *pRect = pSprite->GetCurrentTextureCoordRect();
|
const RectF *pRect = pSprite->GetCurrentTextureCoordRect();
|
||||||
const float fFrameWidth = pSprite->GetZoomedWidth();
|
const float fFrameWidth = pSprite->GetZoomedWidth();
|
||||||
const float fFrameHeight = pSprite->GetZoomedHeight();
|
const float fFrameHeight = pSprite->GetZoomedHeight();
|
||||||
const float fYCapTop = fYHead+cache->m_iStartDrawingHoldBodyOffsetFromHead-fFrameHeight;
|
|
||||||
const float fYCapBottom = fYHead+cache->m_iStartDrawingHoldBodyOffsetFromHead;
|
|
||||||
|
|
||||||
const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(iCol) > 0.5f;
|
|
||||||
|
|
||||||
if( bGlow )
|
|
||||||
fColorScale = 1;
|
|
||||||
|
|
||||||
float fDrawYCapTop;
|
|
||||||
float fDrawYCapBottom;
|
|
||||||
{
|
|
||||||
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceAfterTargetsPixels, m_fYReverseOffsetPixels );
|
|
||||||
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceBeforeTargetsPixels, m_fYReverseOffsetPixels );
|
|
||||||
fDrawYCapTop = max( fYCapTop, bReverse ? fYEndPos : fYStartPos );
|
|
||||||
fDrawYCapBottom = min( fYCapBottom, bReverse ? fYStartPos : fYEndPos );
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't draw any part of the head that is after the middle of the tail
|
|
||||||
fDrawYCapBottom = min( fYTail, fDrawYCapBottom );
|
|
||||||
|
|
||||||
bool bAllAreTransparent = true;
|
|
||||||
bool bLast = false;
|
|
||||||
|
|
||||||
float fY = fDrawYCapTop;
|
|
||||||
for( ; !bLast; fY += fYStep )
|
|
||||||
{
|
|
||||||
if( fY >= fDrawYCapBottom )
|
|
||||||
{
|
|
||||||
fY = fDrawYCapBottom;
|
|
||||||
bLast = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float fYOffset = ArrowEffects::GetYOffsetFromYPos( m_pPlayerState, iCol, fY, m_fYReverseOffsetPixels );
|
|
||||||
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, iCol, fYOffset );
|
|
||||||
const float fX = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
|
||||||
const float fXLeft = fX - fFrameWidth/2;
|
|
||||||
const float fXRight = fX + fFrameWidth/2;
|
|
||||||
const float fDistFromTop = fY - fYCapTop;
|
|
||||||
const float fTexCoordTop = SCALE( fDistFromTop, 0, fFrameHeight, pRect->top, pRect->bottom );
|
|
||||||
const float fTexCoordLeft = pRect->left;
|
|
||||||
const float fTexCoordRight = pRect->right;
|
|
||||||
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar );
|
|
||||||
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
|
||||||
|
|
||||||
if( fAlpha > 0 )
|
|
||||||
bAllAreTransparent = false;
|
|
||||||
|
|
||||||
queue.v[0].p = RageVector3(fXLeft, fY, fZ); queue.v[0].c = color; queue.v[0].t = RageVector2(fTexCoordLeft, fTexCoordTop);
|
|
||||||
queue.v[1].p = RageVector3(fXRight, fY, fZ); queue.v[1].c = color; queue.v[1].t = RageVector2(fTexCoordRight, fTexCoordTop);
|
|
||||||
queue.v+=2;
|
|
||||||
if( queue.Free() < 2 || bLast )
|
|
||||||
{
|
|
||||||
/* The queue is full. Render it, clear the buffer, and move back a step to
|
|
||||||
* start off the quad strip again. */
|
|
||||||
if( !bAllAreTransparent )
|
|
||||||
{
|
|
||||||
FOREACH( Sprite*, vpSpr, spr )
|
|
||||||
{
|
|
||||||
RageTexture* pTexture = (*spr)->GetTexture();
|
|
||||||
DISPLAY->SetTexture( TextureUnit_1, pTexture->GetTexHandle() );
|
|
||||||
DISPLAY->SetBlendMode( spr == vpSpr.begin() ? BLEND_NORMAL : BLEND_ADD );
|
|
||||||
queue.Draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
queue.Init();
|
|
||||||
bAllAreTransparent = true;
|
|
||||||
fY -= fYStep;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, bool bIsAddition, float fPercentFadeToFail, float fColorScale, bool bGlow,
|
|
||||||
float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar )
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Draw the body (always wavy)
|
|
||||||
//
|
|
||||||
StripBuffer queue;
|
|
||||||
|
|
||||||
vector<Sprite*> vpSpr;
|
|
||||||
Sprite *pSprite = GetHoldSprite( m_HoldBody, NotePart_HoldBody, fBeat, tn.subType == TapNote::hold_head_roll, bIsBeingHeld && !cache->m_bHoldActiveIsAddLayer );
|
|
||||||
pSprite->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
|
||||||
vpSpr.push_back( pSprite );
|
|
||||||
if( bIsBeingHeld && cache->m_bHoldActiveIsAddLayer )
|
|
||||||
{
|
|
||||||
Sprite *pSpr = GetHoldSprite( m_HoldBody, NotePart_HoldBody, fBeat, tn.subType == TapNote::hold_head_roll, true );
|
|
||||||
ASSERT( pSpr->GetUnzoomedWidth() == pSprite->GetUnzoomedWidth() );
|
|
||||||
ASSERT( pSpr->GetUnzoomedHeight() == pSprite->GetUnzoomedHeight() );
|
|
||||||
pSpr->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
|
||||||
vpSpr.push_back( pSpr );
|
|
||||||
}
|
|
||||||
|
|
||||||
DISPLAY->ClearAllTextures();
|
|
||||||
DISPLAY->SetCullMode( CULL_NONE );
|
|
||||||
DISPLAY->SetTextureWrapping( true );
|
|
||||||
|
|
||||||
// draw manually in small segments
|
|
||||||
const RectF *pRect = pSprite->GetCurrentTextureCoordRect();
|
|
||||||
const float fFrameWidth = pSprite->GetZoomedWidth();
|
|
||||||
const float fFrameHeight = pSprite->GetZoomedHeight();
|
|
||||||
const float fYBodyTop = fYHead + cache->m_iStartDrawingHoldBodyOffsetFromHead;
|
|
||||||
const float fYBodyBottom = fYTail + cache->m_iStopDrawingHoldBodyOffsetFromTail;
|
|
||||||
|
|
||||||
const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(iCol) > 0.5f;
|
|
||||||
bool bAnchorToBottom = bReverse && cache->m_bFlipHeadAndTailWhenReverse;
|
|
||||||
|
|
||||||
if( bGlow )
|
|
||||||
fColorScale = 1;
|
|
||||||
|
|
||||||
/* Only draw the section that's within the range specified. If a hold note is
|
/* Only draw the section that's within the range specified. If a hold note is
|
||||||
* very long, don't process or draw the part outside of the range. Don't change
|
* very long, don't process or draw the part outside of the range. Don't change
|
||||||
* fYBodyTop or fYBodyBottom; they need to be left alone to calculate texture
|
* fYTop or fYBottom; they need to be left alone to calculate texture coordinates. */
|
||||||
* coordinates. */
|
fYStartPos = max( fYTop, fYStartPos );
|
||||||
float fDrawYBodyTop;
|
fYEndPos = min( fYBottom, fYEndPos );
|
||||||
float fDrawYBodyBottom;
|
|
||||||
{
|
|
||||||
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceAfterTargetsPixels, m_fYReverseOffsetPixels );
|
|
||||||
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceBeforeTargetsPixels, m_fYReverseOffsetPixels );
|
|
||||||
|
|
||||||
fDrawYBodyTop = max( fYBodyTop, bReverse ? fYEndPos : fYStartPos );
|
if( bGlow )
|
||||||
fDrawYBodyBottom = min( fYBodyBottom, bReverse ? fYStartPos : fYEndPos );
|
fColorScale = 1;
|
||||||
}
|
|
||||||
|
|
||||||
// top to bottom
|
// top to bottom
|
||||||
bool bAllAreTransparent = true;
|
bool bAllAreTransparent = true;
|
||||||
bool bLast = false;
|
bool bLast = false;
|
||||||
float fVertTexCoordOffset = 0;
|
float fVertTexCoordOffset = 0;
|
||||||
for( float fY = fDrawYBodyTop; !bLast; fY += fYStep )
|
float fY = fYStartPos;
|
||||||
|
|
||||||
|
DISPLAY->ClearAllTextures();
|
||||||
|
DISPLAY->SetCullMode( CULL_NONE );
|
||||||
|
DISPLAY->SetTextureWrapping( bWrapping );
|
||||||
|
|
||||||
|
StripBuffer queue;
|
||||||
|
for( ; !bLast; fY += fYStep )
|
||||||
{
|
{
|
||||||
if( fY >= fDrawYBodyBottom )
|
if( fY >= fYEndPos )
|
||||||
{
|
{
|
||||||
fY = fDrawYBodyBottom;
|
fY = fYEndPos;
|
||||||
bLast = true;
|
bLast = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,13 +421,13 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool b
|
|||||||
const float fX = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
const float fX = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
||||||
const float fXLeft = fX - fFrameWidth/2;
|
const float fXLeft = fX - fFrameWidth/2;
|
||||||
const float fXRight = fX + fFrameWidth/2;
|
const float fXRight = fX + fFrameWidth/2;
|
||||||
const float fDistFromBodyBottom = fYBodyBottom - fY;
|
const float fDistFromBottom = fYBottom - fY;
|
||||||
const float fDistFromBodyTop = fY - fYBodyTop;
|
const float fDistFromTop = fY - fYTop;
|
||||||
float fTexCoordTop = SCALE( bAnchorToBottom ? fDistFromBodyBottom : fDistFromBodyTop, 0, fFrameHeight, pRect->top, pRect->bottom );
|
float fTexCoordTop = SCALE( bAnchorToBottom ? fDistFromBottom : fDistFromTop, 0, fFrameHeight, pRect->top, pRect->bottom );
|
||||||
/* For very large hold notes, shift the texture coordinates to be near 0, so we
|
/* For very large hold notes, shift the texture coordinates to be near 0, so we
|
||||||
* don't send very large values to the renderer. */
|
* don't send very large values to the renderer. */
|
||||||
if( fY == fDrawYBodyTop ) // first
|
if( fY == fYStartPos ) // first
|
||||||
fVertTexCoordOffset = floorf( fTexCoordTop );
|
fVertTexCoordOffset = floorf( fTexCoordTop );
|
||||||
fTexCoordTop -= fVertTexCoordOffset;
|
fTexCoordTop -= fVertTexCoordOffset;
|
||||||
const float fTexCoordLeft = pRect->left;
|
const float fTexCoordLeft = pRect->left;
|
||||||
const float fTexCoordRight = pRect->right;
|
const float fTexCoordRight = pRect->right;
|
||||||
@@ -577,101 +461,117 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool b
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NoteDisplay::DrawHoldTopCap( const TapNote& tn, int iCol, float fBeat, bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, bool bIsAddition, float fPercentFadeToFail, float fColorScale,
|
||||||
|
bool bGlow, float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Draw the top cap (always wavy)
|
||||||
|
//
|
||||||
|
vector<Sprite*> vpSpr;
|
||||||
|
Sprite *pSprite = GetHoldSprite( m_HoldTopCap, NotePart_HoldTopCap, fBeat, tn.subType == TapNote::hold_head_roll, bIsBeingHeld && !cache->m_bHoldActiveIsAddLayer );
|
||||||
|
vpSpr.push_back( pSprite );
|
||||||
|
if( bIsBeingHeld && cache->m_bHoldActiveIsAddLayer )
|
||||||
|
{
|
||||||
|
Sprite *pSpr = GetHoldSprite( m_HoldTopCap, NotePart_HoldTopCap, fBeat, tn.subType == TapNote::hold_head_roll, true );
|
||||||
|
vpSpr.push_back( pSpr );
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw manually in small segments
|
||||||
|
const float fFrameHeight = pSprite->GetZoomedHeight();
|
||||||
|
const float fYCapTop = fYHead+cache->m_iStartDrawingHoldBodyOffsetFromHead-fFrameHeight;
|
||||||
|
const float fYCapBottom = fYHead+cache->m_iStartDrawingHoldBodyOffsetFromHead;
|
||||||
|
|
||||||
|
const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(iCol) > 0.5f;
|
||||||
|
|
||||||
|
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceAfterTargetsPixels, m_fYReverseOffsetPixels );
|
||||||
|
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceBeforeTargetsPixels, m_fYReverseOffsetPixels );
|
||||||
|
if( bReverse )
|
||||||
|
swap( fYStartPos, fYEndPos );
|
||||||
|
|
||||||
|
// don't draw any part of the tail that is before the middle of the head
|
||||||
|
fYEndPos = min( fYEndPos, fYTail );
|
||||||
|
|
||||||
|
DrawHoldPart(
|
||||||
|
vpSpr,
|
||||||
|
iCol, fYStep, fPercentFadeToFail, fColorScale, bGlow,
|
||||||
|
fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar,
|
||||||
|
fYCapTop, fYCapBottom,
|
||||||
|
fYStartPos, fYEndPos,
|
||||||
|
false, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, bool bIsAddition, float fPercentFadeToFail, float fColorScale, bool bGlow,
|
||||||
|
float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar )
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Draw the body (always wavy)
|
||||||
|
//
|
||||||
|
vector<Sprite*> vpSpr;
|
||||||
|
Sprite *pSprite = GetHoldSprite( m_HoldBody, NotePart_HoldBody, fBeat, tn.subType == TapNote::hold_head_roll, bIsBeingHeld && !cache->m_bHoldActiveIsAddLayer );
|
||||||
|
vpSpr.push_back( pSprite );
|
||||||
|
if( bIsBeingHeld && cache->m_bHoldActiveIsAddLayer )
|
||||||
|
{
|
||||||
|
Sprite *pSpr = GetHoldSprite( m_HoldBody, NotePart_HoldBody, fBeat, tn.subType == TapNote::hold_head_roll, true );
|
||||||
|
vpSpr.push_back( pSpr );
|
||||||
|
}
|
||||||
|
|
||||||
|
const float fYBodyTop = fYHead + cache->m_iStartDrawingHoldBodyOffsetFromHead;
|
||||||
|
const float fYBodyBottom = fYTail + cache->m_iStopDrawingHoldBodyOffsetFromTail;
|
||||||
|
|
||||||
|
const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(iCol) > 0.5f;
|
||||||
|
bool bAnchorToBottom = bReverse && cache->m_bFlipHeadAndTailWhenReverse;
|
||||||
|
|
||||||
|
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceAfterTargetsPixels, m_fYReverseOffsetPixels );
|
||||||
|
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceBeforeTargetsPixels, m_fYReverseOffsetPixels );
|
||||||
|
if( bReverse )
|
||||||
|
swap( fYStartPos, fYEndPos );
|
||||||
|
|
||||||
|
DrawHoldPart(
|
||||||
|
vpSpr,
|
||||||
|
iCol, fYStep, fPercentFadeToFail, fColorScale, bGlow,
|
||||||
|
fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar,
|
||||||
|
fYBodyTop, fYBodyBottom,
|
||||||
|
fYStartPos, fYEndPos,
|
||||||
|
true, bAnchorToBottom );
|
||||||
|
}
|
||||||
|
|
||||||
void NoteDisplay::DrawHoldBottomCap( const TapNote& tn, int iCol, float fBeat, bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, bool bIsAddition, float fPercentFadeToFail, float fColorScale,
|
void NoteDisplay::DrawHoldBottomCap( const TapNote& tn, int iCol, float fBeat, bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, bool bIsAddition, float fPercentFadeToFail, float fColorScale,
|
||||||
bool bGlow, float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar )
|
bool bGlow, float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Draw the bottom cap (always wavy)
|
// Draw the bottom cap (always wavy)
|
||||||
//
|
//
|
||||||
StripBuffer queue;
|
|
||||||
|
|
||||||
vector<Sprite*> vpSpr;
|
vector<Sprite*> vpSpr;
|
||||||
Sprite* pSprite = GetHoldSprite( m_HoldBottomCap, NotePart_HoldBottomCap, fBeat, tn.subType == TapNote::hold_head_roll, bIsBeingHeld && !cache->m_bHoldActiveIsAddLayer );
|
Sprite* pSprite = GetHoldSprite( m_HoldBottomCap, NotePart_HoldBottomCap, fBeat, tn.subType == TapNote::hold_head_roll, bIsBeingHeld && !cache->m_bHoldActiveIsAddLayer );
|
||||||
pSprite->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
|
||||||
vpSpr.push_back( pSprite );
|
vpSpr.push_back( pSprite );
|
||||||
if( bIsBeingHeld && cache->m_bHoldActiveIsAddLayer )
|
if( bIsBeingHeld && cache->m_bHoldActiveIsAddLayer )
|
||||||
{
|
{
|
||||||
Sprite *pSpr = GetHoldSprite( m_HoldBottomCap, NotePart_HoldBottomCap, fBeat, tn.subType == TapNote::hold_head_roll, true );
|
Sprite *pSpr = GetHoldSprite( m_HoldBottomCap, NotePart_HoldBottomCap, fBeat, tn.subType == TapNote::hold_head_roll, true );
|
||||||
ASSERT( pSpr->GetUnzoomedWidth() == pSprite->GetUnzoomedWidth() );
|
|
||||||
ASSERT( pSpr->GetUnzoomedHeight() == pSprite->GetUnzoomedHeight() );
|
|
||||||
pSpr->SetZoom( ArrowEffects::GetZoom( m_pPlayerState ) );
|
|
||||||
vpSpr.push_back( pSpr );
|
vpSpr.push_back( pSpr );
|
||||||
}
|
}
|
||||||
|
|
||||||
DISPLAY->ClearAllTextures();
|
|
||||||
DISPLAY->SetCullMode( CULL_NONE );
|
|
||||||
DISPLAY->SetTextureWrapping(false);
|
|
||||||
|
|
||||||
// draw manually in small segments
|
// draw manually in small segments
|
||||||
const RectF *pRect = pSprite->GetCurrentTextureCoordRect();
|
|
||||||
const float fFrameWidth = pSprite->GetZoomedWidth();
|
|
||||||
const float fFrameHeight = pSprite->GetZoomedHeight();
|
const float fFrameHeight = pSprite->GetZoomedHeight();
|
||||||
const float fYCapTop = fYTail+cache->m_iStopDrawingHoldBodyOffsetFromTail;
|
const float fYCapTop = fYTail+cache->m_iStopDrawingHoldBodyOffsetFromTail;
|
||||||
const float fYCapBottom = fYTail+cache->m_iStopDrawingHoldBodyOffsetFromTail+fFrameHeight;
|
const float fYCapBottom = fYTail+cache->m_iStopDrawingHoldBodyOffsetFromTail+fFrameHeight;
|
||||||
|
|
||||||
const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(iCol) > 0.5f;
|
const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(iCol) > 0.5f;
|
||||||
|
|
||||||
if( bGlow )
|
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceAfterTargetsPixels, m_fYReverseOffsetPixels );
|
||||||
fColorScale = 1;
|
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceBeforeTargetsPixels, m_fYReverseOffsetPixels );
|
||||||
|
if( bReverse )
|
||||||
|
swap( fYStartPos, fYEndPos );
|
||||||
|
|
||||||
float fDrawYCapTop;
|
|
||||||
float fDrawYCapBottom;
|
|
||||||
{
|
|
||||||
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceAfterTargetsPixels, m_fYReverseOffsetPixels );
|
|
||||||
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fDrawDistanceBeforeTargetsPixels, m_fYReverseOffsetPixels );
|
|
||||||
fDrawYCapTop = max( fYCapTop, bReverse ? fYEndPos : fYStartPos );
|
|
||||||
fDrawYCapBottom = min( fYCapBottom, bReverse ? fYStartPos : fYEndPos );
|
|
||||||
}
|
|
||||||
|
|
||||||
bool bAllAreTransparent = true;
|
|
||||||
bool bLast = false;
|
|
||||||
// don't draw any part of the tail that is before the middle of the head
|
// don't draw any part of the tail that is before the middle of the head
|
||||||
float fY=max( fDrawYCapTop, fYHead );
|
fYStartPos = max( fYStartPos, fYHead );
|
||||||
for( ; !bLast; fY += fYStep )
|
|
||||||
{
|
|
||||||
if( fY >= fDrawYCapBottom )
|
|
||||||
{
|
|
||||||
fY = fDrawYCapBottom;
|
|
||||||
bLast = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float fYOffset = ArrowEffects::GetYOffsetFromYPos( m_pPlayerState, iCol, fY, m_fYReverseOffsetPixels );
|
DrawHoldPart(
|
||||||
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, iCol, fYOffset );
|
vpSpr,
|
||||||
const float fX = ArrowEffects::GetXPos( m_pPlayerState, iCol, fYOffset );
|
iCol, fYStep, fPercentFadeToFail, fColorScale, bGlow,
|
||||||
const float fXLeft = fX - fFrameWidth/2;
|
fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar,
|
||||||
const float fXRight = fX + fFrameWidth/2;
|
fYCapTop, fYCapBottom,
|
||||||
const float fDistFromTop = fY - fYCapTop;
|
fYStartPos, fYEndPos,
|
||||||
const float fTexCoordTop = SCALE( fDistFromTop, 0, fFrameHeight, pRect->top, pRect->bottom );
|
false, false );
|
||||||
const float fTexCoordLeft = pRect->left;
|
|
||||||
const float fTexCoordRight = pRect->right;
|
|
||||||
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar );
|
|
||||||
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
|
|
||||||
|
|
||||||
if( fAlpha > 0 )
|
|
||||||
bAllAreTransparent = false;
|
|
||||||
|
|
||||||
queue.v[0].p = RageVector3(fXLeft, fY, fZ); queue.v[0].c = color; queue.v[0].t = RageVector2(fTexCoordLeft, fTexCoordTop);
|
|
||||||
queue.v[1].p = RageVector3(fXRight, fY, fZ); queue.v[1].c = color; queue.v[1].t = RageVector2(fTexCoordRight, fTexCoordTop);
|
|
||||||
queue.v+=2;
|
|
||||||
if( queue.Free() < 2 || bLast )
|
|
||||||
{
|
|
||||||
/* The queue is full. Render it, clear the buffer, and move back a step to
|
|
||||||
* start off the quad strip again. */
|
|
||||||
if( !bAllAreTransparent )
|
|
||||||
{
|
|
||||||
FOREACH( Sprite*, vpSpr, spr )
|
|
||||||
{
|
|
||||||
RageTexture* pTexture = (*spr)->GetTexture();
|
|
||||||
DISPLAY->SetTexture( TextureUnit_1, pTexture->GetTexHandle() );
|
|
||||||
DISPLAY->SetBlendMode( spr == vpSpr.begin() ? BLEND_NORMAL : BLEND_ADD );
|
|
||||||
queue.Draw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
queue.Init();
|
|
||||||
bAllAreTransparent = true;
|
|
||||||
fY -= fYStep;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDisplay::DrawHoldHeadTail( const TapNote& tn, Actor* pActor, NotePart part, int iCol, float fBeat, float fY, bool bIsAddition, float fPercentFadeToFail, float fColorScale,
|
void NoteDisplay::DrawHoldHeadTail( const TapNote& tn, Actor* pActor, NotePart part, int iCol, float fBeat, float fY, bool bIsAddition, float fPercentFadeToFail, float fColorScale,
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ private:
|
|||||||
bool bGlow, float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar );
|
bool bGlow, float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar );
|
||||||
void DrawHoldHeadTail( const TapNote& tn, Actor* pActor, NotePart part, int iCol, float fBeat, float fYHead, bool bIsAddition, float fPercentFadeToFail, float fColorScale,
|
void DrawHoldHeadTail( const TapNote& tn, Actor* pActor, NotePart part, int iCol, float fBeat, float fYHead, bool bIsAddition, float fPercentFadeToFail, float fColorScale,
|
||||||
bool bGlow, bool bUseLighting, float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar );
|
bool bGlow, bool bUseLighting, float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar );
|
||||||
|
void DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow,
|
||||||
|
float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar,
|
||||||
|
float fYTop, float fYBottom, float fYStartPos, float fYEndPos, bool bWrapping, bool bAnchorToBottom );
|
||||||
|
|
||||||
const PlayerState *m_pPlayerState; // to look up PlayerOptions
|
const PlayerState *m_pPlayerState; // to look up PlayerOptions
|
||||||
NoteMetricCache_t *cache;
|
NoteMetricCache_t *cache;
|
||||||
|
|||||||
Reference in New Issue
Block a user