From 91aafcd4c18e96f49fc33e8fb9768354487f3ad1 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sat, 19 Jun 2004 21:00:38 +0000 Subject: [PATCH] move all graphics API calls into RageDisplay_* --- stepmania/src/Model.cpp | 7 +++---- stepmania/src/RageDisplay.h | 4 ++++ stepmania/src/RageDisplay_OGL.cpp | 17 +++++++++++++++++ stepmania/src/RageDisplay_OGL.h | 4 ++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index 6ae7f56c38..7a3a5dfb05 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -11,7 +11,6 @@ #include "ActorUtil.h" #include #include "ModelManager.h" -#include "SDL_opengl.h" const float FRAMES_PER_SECOND = 30; const CString DEFAULT_ANIMATION_NAME = "default"; @@ -425,12 +424,12 @@ bool Model::EarlyAbortDraw() void Model::DrawCelShaded() { this->SetGlow(RageColor(0,0,0,1)); - glPolygonMode (GL_BACK, GL_LINE); - glLineWidth(4.0f); + DISPLAY->SetPolygonMode( POLYGON_LINE ); + DISPLAY->SetLineWidth( 4 ); this->Draw(); DISPLAY->ClearZBuffer(); this->SetGlow(RageColor(1,1,1,0)); - glPolygonMode(GL_BACK, GL_FILL); + DISPLAY->SetPolygonMode( POLYGON_FILL ); this->Draw(); } diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index 2c96841373..a8dfc99833 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -232,6 +232,10 @@ public: void DrawQuad( const RageSpriteVertex v[] ) { DrawQuads(v,4); } /* alias. upper-left, upper-right, lower-left, lower-right */ + // hacks for cell-shaded models + virtual void SetPolygonMode( PolygonMode pm ) {} + virtual void SetLineWidth( int iWidth ) {} + enum GraphicsFileFormat { SAVE_LOSSLESS, // bmp diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 039b077b98..363f8a21f1 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -1814,6 +1814,23 @@ void RageDisplay_OGL::UpdateTexture( delete img; } +void RageDisplay_OGL::SetPolygonMode( PolygonMode pm ) +{ + GLenum m; + switch( pm ) + { + case POLYGON_FILL: m = GL_FILL; break; + case POLYGON_LINE: m = GL_LINE; break; + default: ASSERT(0); return; + } + glPolygonMode( GL_FRONT_AND_BACK, m ); +} + +void RageDisplay_OGL::SetLineWidth( int iWidth ) +{ + glLineWidth( iWidth ); +} + CString RageDisplay_OGL::GetTextureDiagnostics( unsigned id ) const { return ""; diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index a1783889e4..b734a7b127 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -65,6 +65,10 @@ public: RageCompiledGeometry* CreateCompiledGeometry(); void DeleteCompiledGeometry( RageCompiledGeometry* p ); + // hacks for cell-shaded models + virtual void SetPolygonMode( PolygonMode pm ); + virtual void SetLineWidth( int iWidth ); + CString GetTextureDiagnostics( unsigned id ) const; protected: