Set the perspective when drawing in a subclass of ActorFrame, not just for children of subclasses.

This commit is contained in:
Steve Checkoway
2006-10-26 06:03:12 +00:00
parent a5edb172bf
commit 8588b48a15
3 changed files with 21 additions and 14 deletions
+2 -2
View File
@@ -103,11 +103,11 @@ public:
void Draw(); // calls, EarlyAbortDraw, BeginDraw, DrawPrimitives, EndDraw void Draw(); // calls, EarlyAbortDraw, BeginDraw, DrawPrimitives, EndDraw
virtual bool EarlyAbortDraw() const { return false; } // return true to early abort drawing of this Actor 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 SetGlobalRenderStates(); // Actor should call this at beginning of their DrawPrimitives()
virtual void SetTextureRenderStates(); // Actor should call this after setting a texture virtual void SetTextureRenderStates(); // Actor should call this after setting a texture
virtual void DrawPrimitives() {}; // Derivatives should override 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 // TODO: make Update non virtual and change all classes to override UpdateInternal
// instead. // instead.
+15 -10
View File
@@ -173,11 +173,9 @@ void ActorFrame::MoveToHead( Actor* pActor )
m_SubActors.insert( m_SubActors.begin(), pActor ); m_SubActors.insert( m_SubActors.begin(), pActor );
} }
void ActorFrame::BeginDraw()
void ActorFrame::DrawPrimitives()
{ {
ASSERT_M( !m_bClearZBuffer, "ClearZBuffer not supported on ActorFrames" ); Actor::BeginDraw();
if( m_fFOV != -1 ) if( m_fFOV != -1 )
{ {
DISPLAY->CameraPushMatrix(); DISPLAY->CameraPushMatrix();
@@ -189,14 +187,18 @@ void ActorFrame::DrawPrimitives()
DISPLAY->SetLighting( m_bLighting ); DISPLAY->SetLighting( m_bLighting );
if( m_bLighting ) if( m_bLighting )
DISPLAY->SetLightDirectional( DISPLAY->SetLightDirectional(
0, 0,
RageColor(1,1,1,1), RageColor(1,1,1,1),
RageColor(1,1,1,1), RageColor(1,1,1,1),
RageColor(1,1,1,1), RageColor(1,1,1,1),
RageVector3(0,0,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 // Don't set Actor-defined render states because we won't be drawing
// any geometry that belongs to this object. // any geometry that belongs to this object.
@@ -215,9 +217,11 @@ void ActorFrame::DrawPrimitives()
for( unsigned i=0; i<m_SubActors.size(); i++ ) for( unsigned i=0; i<m_SubActors.size(); i++ )
m_SubActors[i]->Draw(); m_SubActors[i]->Draw();
} }
}
void ActorFrame::EndDraw()
{
if( m_bOverrideLighting ) if( m_bOverrideLighting )
{ {
// TODO: pop state instead of turning lighting off // TODO: pop state instead of turning lighting off
@@ -229,6 +233,7 @@ void ActorFrame::DrawPrimitives()
{ {
DISPLAY->CameraPopMatrix(); DISPLAY->CameraPopMatrix();
} }
Actor::EndDraw();
} }
void ActorFrame::PlayCommandOnChildren( const RString &sCommandName ) void ActorFrame::PlayCommandOnChildren( const RString &sCommandName )
+2
View File
@@ -43,7 +43,9 @@ public:
virtual void UpdateInternal( float fDeltaTime ); virtual void UpdateInternal( float fDeltaTime );
virtual void ProcessMessages( float fDeltaTime ); virtual void ProcessMessages( float fDeltaTime );
virtual void BeginDraw();
virtual void DrawPrimitives(); virtual void DrawPrimitives();
virtual void EndDraw();
// propagated commands // propagated commands
virtual void SetDiffuse( RageColor c ); virtual void SetDiffuse( RageColor c );