From 8588b48a15cc7120285cf21fd2224bcd5c8bae5d Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Thu, 26 Oct 2006 06:03:12 +0000 Subject: [PATCH] Set the perspective when drawing in a subclass of ActorFrame, not just for children of subclasses. --- stepmania/src/Actor.h | 4 ++-- stepmania/src/ActorFrame.cpp | 29 +++++++++++++++++------------ stepmania/src/ActorFrame.h | 2 ++ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index c6b6db5de7..cfe6d539a0 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -103,11 +103,11 @@ public: void Draw(); // calls, EarlyAbortDraw, BeginDraw, DrawPrimitives, EndDraw virtual bool EarlyAbortDraw() const { return false; } // return true to early abort drawing of this Actor - void BeginDraw(); // pushes transform onto world matrix stack + virtual void BeginDraw(); // pushes transform onto world matrix stack virtual void SetGlobalRenderStates(); // Actor should call this at beginning of their DrawPrimitives() virtual void SetTextureRenderStates(); // Actor should call this after setting a texture virtual void DrawPrimitives() {}; // Derivatives should override - void EndDraw(); // pops transform from world matrix stack + virtual void EndDraw(); // pops transform from world matrix stack // TODO: make Update non virtual and change all classes to override UpdateInternal // instead. diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index e206138808..5fc34dd276 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -173,11 +173,9 @@ void ActorFrame::MoveToHead( Actor* pActor ) m_SubActors.insert( m_SubActors.begin(), pActor ); } - -void ActorFrame::DrawPrimitives() +void ActorFrame::BeginDraw() { - ASSERT_M( !m_bClearZBuffer, "ClearZBuffer not supported on ActorFrames" ); - + Actor::BeginDraw(); if( m_fFOV != -1 ) { DISPLAY->CameraPushMatrix(); @@ -189,14 +187,18 @@ void ActorFrame::DrawPrimitives() DISPLAY->SetLighting( m_bLighting ); if( m_bLighting ) DISPLAY->SetLightDirectional( - 0, - RageColor(1,1,1,1), - RageColor(1,1,1,1), - RageColor(1,1,1,1), - RageVector3(0,0,1) ); - } - + 0, + RageColor(1,1,1,1), + RageColor(1,1,1,1), + RageColor(1,1,1,1), + RageVector3(0,0,1) ); + } +} + +void ActorFrame::DrawPrimitives() +{ + ASSERT_M( !m_bClearZBuffer, "ClearZBuffer not supported on ActorFrames" ); // Don't set Actor-defined render states because we won't be drawing // any geometry that belongs to this object. @@ -215,9 +217,11 @@ void ActorFrame::DrawPrimitives() for( unsigned i=0; iDraw(); } +} - +void ActorFrame::EndDraw() +{ if( m_bOverrideLighting ) { // TODO: pop state instead of turning lighting off @@ -229,6 +233,7 @@ void ActorFrame::DrawPrimitives() { DISPLAY->CameraPopMatrix(); } + Actor::EndDraw(); } void ActorFrame::PlayCommandOnChildren( const RString &sCommandName ) diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index fc6e47254d..8cc3a3268a 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -43,7 +43,9 @@ public: virtual void UpdateInternal( float fDeltaTime ); virtual void ProcessMessages( float fDeltaTime ); + virtual void BeginDraw(); virtual void DrawPrimitives(); + virtual void EndDraw(); // propagated commands virtual void SetDiffuse( RageColor c );