make the centering matrix a stack, like the rest

This commit is contained in:
Glenn Maynard
2006-07-25 19:34:11 +00:00
parent 787b5ad09a
commit df153fc924
2 changed files with 9 additions and 3 deletions
+8 -1
View File
@@ -356,14 +356,21 @@ public:
// Obtain the current matrix at the top of the stack // Obtain the current matrix at the top of the stack
const RageMatrix* GetTop() { return &stack.back(); } const RageMatrix* GetTop() { return &stack.back(); }
void SetTop( const RageMatrix &m ) { stack.back() = m; }
}; };
static MatrixStack g_CenteringStack;
static MatrixStack g_ProjectionStack; static MatrixStack g_ProjectionStack;
static MatrixStack g_ViewStack; static MatrixStack g_ViewStack;
static MatrixStack g_WorldStack; static MatrixStack g_WorldStack;
static MatrixStack g_TextureStack; static MatrixStack g_TextureStack;
const RageMatrix* RageDisplay::GetCentering()
{
return g_CenteringStack.GetTop();
}
const RageMatrix* RageDisplay::GetProjectionTop() const RageMatrix* RageDisplay::GetProjectionTop()
{ {
return g_ProjectionStack.GetTop(); return g_ProjectionStack.GetTop();
@@ -644,7 +651,7 @@ RageMatrix RageDisplay::GetCenteringMatrix( float fTranslateX, float fTranslateY
void RageDisplay::UpdateCentering() void RageDisplay::UpdateCentering()
{ {
m_Centering = GetCenteringMatrix( (float) g_iTranslateX, (float) g_iTranslateY, (float) g_iAddWidth, (float) g_iAddHeight ); g_CenteringStack.SetTop( GetCenteringMatrix( (float) g_iTranslateX, (float) g_iTranslateY, (float) g_iAddWidth, (float) g_iAddHeight ) );
} }
bool RageDisplay::SaveScreenshot( RString sPath, GraphicsFileFormat format ) bool RageDisplay::SaveScreenshot( RString sPath, GraphicsFileFormat format )
+1 -2
View File
@@ -325,12 +325,11 @@ protected:
// //
// Matrix that adjusts position and scale of image on the screen // Matrix that adjusts position and scale of image on the screen
// //
RageMatrix m_Centering;
RageMatrix GetCenteringMatrix( float fTranslateX, float fTranslateY, float fAddWidth, float fAddHeight ) const; RageMatrix GetCenteringMatrix( float fTranslateX, float fTranslateY, float fAddWidth, float fAddHeight ) const;
void UpdateCentering(); void UpdateCentering();
// Called by the RageDisplay derivitives // Called by the RageDisplay derivitives
const RageMatrix* GetCentering() { return &m_Centering; } const RageMatrix* GetCentering();
const RageMatrix* GetProjectionTop(); const RageMatrix* GetProjectionTop();
const RageMatrix* GetViewTop(); const RageMatrix* GetViewTop();
const RageMatrix* GetWorldTop(); const RageMatrix* GetWorldTop();