From e83bbc40da14149503103aa69354b4c233d46598 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 15 May 2004 18:35:03 +0000 Subject: [PATCH] fix ActorFrame ZTest propogation --- stepmania/src/Actor.cpp | 7 ++----- stepmania/src/Actor.h | 9 ++++----- stepmania/src/MusicWheelItem.cpp | 6 +++--- stepmania/src/MusicWheelItem.h | 2 +- stepmania/src/NoteDisplay.cpp | 3 ++- stepmania/src/RageDisplay.cpp | 3 ++- stepmania/src/RageDisplay.h | 2 -- stepmania/src/RageDisplay_D3D.cpp | 1 + stepmania/src/RageDisplay_D3D.h | 1 - stepmania/src/RageDisplay_OGL.h | 1 - stepmania/src/ScreenSelectMusic.cpp | 2 +- stepmania/src/ScrollingList.cpp | 6 +++--- 12 files changed, 19 insertions(+), 24 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 1a6b152a30..b7a681d77f 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -729,7 +729,7 @@ void Actor::HandleCommand( const ParsedCommand &command ) else if( sName=="additiveblend" ) SetBlendMode( bParam(1) ? BLEND_ADD : BLEND_NORMAL ); else if( sName=="blend" ) SetBlendMode( sParam(1) ); else if( sName=="zbuffer" ) SetUseZBuffer( bParam(1) ); - else if( sName=="ztest" ) SetZTest( bParam(1) ); + else if( sName=="ztest" ) SetZTestMode( bParam(1)?ZTEST_WRITE_ON_PASS:ZTEST_OFF ); else if( sName=="ztestmode" ) SetZTestMode( sParam(1) ); else if( sName=="zwrite" ) SetZWrite( bParam(1) ); else if( sName=="clearzbuffer" ) SetClearZBuffer( bParam(1) ); @@ -890,10 +890,7 @@ void Actor::SetZTestMode( CString s ) s.MakeLower(); // for metrics backward compatibility - if (s=="1") SetZTestMode( ZTEST_WRITE_ON_PASS ); - else if(s=="0") SetZTestMode( ZTEST_OFF ); - - else if(s=="off") SetZTestMode( ZTEST_OFF ); + if(s=="off") SetZTestMode( ZTEST_OFF ); else if(s=="writeonpass") SetZTestMode( ZTEST_WRITE_ON_PASS ); else if(s=="writeonfail") SetZTestMode( ZTEST_WRITE_ON_FAIL ); else ASSERT(0); diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 1237d01593..c2d675ee56 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -293,14 +293,13 @@ public: // // render states // - void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; } + void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; } void SetBlendMode( CString ); - void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; } - void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; } - void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); } + void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; } + void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; } + void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); } virtual void SetZTestMode( ZTestMode mode ) { m_ZTestMode = mode; } virtual void SetZTestMode( CString ); - void SetZTest( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); } virtual void SetZWrite( bool b ) { m_bZWrite = b; } virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; } virtual void SetCullMode( CString ); diff --git a/stepmania/src/MusicWheelItem.cpp b/stepmania/src/MusicWheelItem.cpp index 5da66e9781..e282c8c15f 100644 --- a/stepmania/src/MusicWheelItem.cpp +++ b/stepmania/src/MusicWheelItem.cpp @@ -316,12 +316,12 @@ void MusicWheelItem::DrawPrimitives() } -void MusicWheelItem::SetZTest( bool b ) +void MusicWheelItem::SetZTestMode( ZTestMode mode ) { - ActorFrame::SetZTest( b ); + ActorFrame::SetZTestMode( mode ); // set all sub-Actors - m_All.SetZTest( b ); + m_All.SetZTestMode( mode ); } void MusicWheelItem::SetZWrite( bool b ) diff --git a/stepmania/src/MusicWheelItem.h b/stepmania/src/MusicWheelItem.h index adc70209ee..5dd3f05441 100644 --- a/stepmania/src/MusicWheelItem.h +++ b/stepmania/src/MusicWheelItem.h @@ -30,7 +30,7 @@ public: virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); - virtual void SetZTest( bool b ); + virtual void SetZTestMode( ZTestMode mode ); virtual void SetZWrite( bool b ); void LoadFromWheelItemData( WheelItemData* pWID ); diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index dcd2881ef2..753d1147d6 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -807,7 +807,8 @@ void NoteDisplay::DrawHold( const HoldNote& hn, bool bIsBeingHeld, bool bIsActiv DISPLAY->SetTextureModeGlow(); else DISPLAY->SetTextureModeModulate(); - DISPLAY->SetZBuffer( WavyPartsNeedZBuffer ); + DISPLAY->SetZTestMode( WavyPartsNeedZBuffer?ZTEST_WRITE_ON_PASS:ZTEST_OFF ); + DISPLAY->SetZWrite( WavyPartsNeedZBuffer ); if( !bFlipHeadAndTail ) DrawHoldBottomCap( hn, bIsBeingHeld, fYHead, fYTail, fYStep, iCol, fPercentFadeToFail, fColorScale, bDrawGlowOnly ); diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index ca7af0bf86..1161761116 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -197,7 +197,8 @@ void RageDisplay::SetDefaultRenderStates() { SetLighting( false ); SetCullMode( CULL_NONE ); - SetZBuffer( false ); + SetZWrite( false ); + SetZTestMode( ZTEST_OFF ); SetAlphaTest( true ); SetBlendMode( BLEND_NORMAL ); SetTextureFiltering( true ); diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index ebc691e8c5..34a4e5187c 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -195,10 +195,8 @@ public: virtual bool IsZTestEnabled() const = 0; virtual bool IsZWriteEnabled() const = 0; virtual void SetZWrite( bool b ) = 0; - void SetZTest( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); } virtual void SetZTestMode( ZTestMode mode ) = 0; virtual void ClearZBuffer() = 0; - void SetZBuffer( bool b ) { SetZWrite(b); SetZTest(b); } // shortcut virtual void SetCullMode( CullMode mode ) = 0; diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index a09f6341d6..3468aeb1a4 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -1056,6 +1056,7 @@ void RageDisplay_D3D::SetZTestMode( ZTestMode mode ) case ZTEST_WRITE_ON_FAIL: dw = D3DCMP_GREATER; break; default: ASSERT( 0 ); } + g_pd3dDevice->SetRenderState( D3DRS_ZFUNC, dw ); } void RageDisplay_D3D::ClearZBuffer() diff --git a/stepmania/src/RageDisplay_D3D.h b/stepmania/src/RageDisplay_D3D.h index ef60c807f4..a4b7240f75 100644 --- a/stepmania/src/RageDisplay_D3D.h +++ b/stepmania/src/RageDisplay_D3D.h @@ -53,7 +53,6 @@ public: bool IsZWriteEnabled() const; bool IsZTestEnabled() const; void SetZWrite( bool b ); - void SetZTest( bool b ); void SetZTestMode( ZTestMode mode ); void ClearZBuffer(); void SetCullMode( CullMode mode ); diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index a2e458c877..c42977a84c 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -42,7 +42,6 @@ public: bool IsZWriteEnabled() const; bool IsZTestEnabled() const; void SetZWrite( bool b ); - void SetZTest( bool b ); void SetZTestMode( ZTestMode mode ); void ClearZBuffer(); void SetCullMode( CullMode mode ); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 9ae9be6138..c985c53d17 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -131,7 +131,7 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : ScreenWithMenuEleme // this is loaded SetSong and TweenToSong m_Banner.SetName( "Banner" ); - m_Banner.SetZTest( true ); // do have to pass the z test + m_Banner.SetZTestMode( ZTEST_WRITE_ON_PASS ); // do have to pass the z test m_Banner.ScaleToClipped( BANNER_WIDTH, BANNER_HEIGHT ); SET_XY( m_Banner ); this->AddChild( &m_Banner ); diff --git a/stepmania/src/ScrollingList.cpp b/stepmania/src/ScrollingList.cpp index 1d997052d0..a074e06697 100644 --- a/stepmania/src/ScrollingList.cpp +++ b/stepmania/src/ScrollingList.cpp @@ -515,7 +515,7 @@ void ScrollingList::DrawPrimitives() if(!m_iBouncingState) m_apCSprites[iIndexToDraw1]->SetZoom( 1.0f - (ZOOM_OFFSET * i) ); m_apCSprites[iIndexToDraw1]->SetDiffuse( COLOR_SELECTED + RageColor(0,0,0,(1.0f - (FADE_OFFSET * i))) ); - m_apCSprites[iIndexToDraw1]->SetZTest( true ); // do have to pass the z test + m_apCSprites[iIndexToDraw1]->SetZTestMode( ZTEST_WRITE_ON_PASS ); // do have to pass the z test m_sprBannerMask.SetXY(m_apCSprites[iIndexToDraw1]->GetX(), m_apCSprites[iIndexToDraw1]->GetY()); m_sprBannerMask.SetZoom( m_apCSprites[iIndexToDraw1]->GetZoom()); m_sprBannerMask.Draw(); @@ -548,12 +548,12 @@ void ScrollingList::DrawPrimitives() m_apCSprites[iIndexToDraw2]->SetZoom( 1.0f - (ZOOM_OFFSET * i) ); m_apCSprites[iIndexToDraw1]->SetDiffuse( COLOR_NOT_SELECTED + RageColor(0,0,0,(- (FADE_OFFSET * i))) ); m_apCSprites[iIndexToDraw2]->SetDiffuse( COLOR_NOT_SELECTED + RageColor(0,0,0,(- (FADE_OFFSET * i))) ); - m_apCSprites[iIndexToDraw1]->SetZTest( true ); // do have to pass the z test + m_apCSprites[iIndexToDraw1]->SetZTestMode( ZTEST_WRITE_ON_PASS ); // do have to pass the z test m_sprBannerMask.SetXY(m_apCSprites[iIndexToDraw1]->GetX(), m_apCSprites[iIndexToDraw1]->GetY()); m_sprBannerMask.SetZoom( m_apCSprites[iIndexToDraw1]->GetZoom()); m_sprBannerMask.Draw(); m_apCSprites[iIndexToDraw1]->Draw(); - m_apCSprites[iIndexToDraw2]->SetZTest( true ); // do have to pass the z test + m_apCSprites[iIndexToDraw2]->SetZTestMode( ZTEST_WRITE_ON_PASS ); // do have to pass the z test m_sprBannerMask.SetXY(m_apCSprites[iIndexToDraw2]->GetX(), m_apCSprites[iIndexToDraw1]->GetY()); m_sprBannerMask.SetZoom( m_apCSprites[iIndexToDraw2]->GetZoom()); m_sprBannerMask.Draw();