clean up detection and handling of drivers with problematic AA lines

only draw topmost screen if topmost screen isn't transparent (speeds up options menus in editor)
optimized beat bar drawing in NoteField
This commit is contained in:
Chris Danford
2003-02-20 21:22:18 +00:00
parent d7a04ab91c
commit 848ad6e2be
15 changed files with 65 additions and 28 deletions
+3 -3
View File
@@ -144,11 +144,11 @@ void Actor::BeginDraw() // set the world matrix and calculate actor properties
DISPLAY->Scale( m_temp.scale.x, m_temp.scale.y, m_temp.scale.z );
if( m_temp.rotation.x != 0 )
// if( m_temp.rotation.x != 0 )
DISPLAY->RotateX( m_temp.rotation.x );
if( m_temp.rotation.y != 0 )
// if( m_temp.rotation.y != 0 )
DISPLAY->RotateY( m_temp.rotation.y );
if( m_temp.rotation.z != 0 )
// if( m_temp.rotation.z != 0 )
DISPLAY->RotateZ( m_temp.rotation.z );
}
+7 -1
View File
@@ -191,7 +191,13 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
v[i].c = PlayerToColor( (PlayerNumber)p );
}
DISPLAY->DrawLoop( v, NUM_RADAR_CATEGORIES, RADAR_EDGE_WIDTH );
switch( PREFSMAN->m_iPolygonRadar )
{
case 0: DISPLAY->DrawLoop_LinesAndPoints( v, NUM_RADAR_CATEGORIES, RADAR_EDGE_WIDTH ); break;
case 1: DISPLAY->DrawLoop_Polys( v, NUM_RADAR_CATEGORIES, RADAR_EDGE_WIDTH ); break;
default:
case -1: DISPLAY->DrawLoop( v, NUM_RADAR_CATEGORIES, RADAR_EDGE_WIDTH ); break;
}
}
}
+20 -7
View File
@@ -23,6 +23,7 @@
#include "RageLog.h"
#include <math.h>
#include "ThemeManager.h"
#include "RageDisplay.h"
const float HOLD_NOTE_BITS_PER_BEAT = 6;
@@ -31,8 +32,6 @@ const float ROWS_BETWEEN_HOLD_BITS = 1 / HOLD_NOTE_BITS_PER_ROW;
NoteField::NoteField()
{
m_rectMeasureBar.TurnShadowOff();
m_textMeasureNumber.LoadFromFont( THEME->GetPathTo("Fonts","normal") );
m_textMeasureNumber.SetZoom( 1.0f );
@@ -96,6 +95,10 @@ void NoteField::DrawBeatBar( const float fBeat )
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
RageVertex v[4]; // upper-left, upper-right, lower-right, lower-left
memset( v, 0, sizeof(v) );
int iSegWidth;
int iSpaceWidth;
float fBrightness;
@@ -109,14 +112,24 @@ void NoteField::DrawBeatBar( const float fBeat )
}
CLAMP( fBrightness, 0, 1 );
DISPLAY->SetTexture( NULL );
DISPLAY->SetTextureModeModulate();
DISPLAY->SetBlendModeNormal();
float fWidth = GetWidth();
for( float f=-fWidth/2; f<+fWidth/2; )
{
m_rectMeasureBar.StretchTo( RectF(f,0,f+iSegWidth,0) );
m_rectMeasureBar.SetY( fYPos );
m_rectMeasureBar.SetZoomY( bIsMeasure ? 6.f : 3.f );
m_rectMeasureBar.SetDiffuse( RageColor(1,1,1,0.5f*fBrightness) );
m_rectMeasureBar.Draw();
v[0].c = v[1].c = v[2].c = v[3].c = RageColor(1,1,1,0.5f*fBrightness);
float fLeft = f;
float fRight = f+iSegWidth;
float fHeight = bIsMeasure ? 6.f : 3.f;
v[0].p = RageVector3( fLeft, fYPos-fHeight/2, 0 ); // upper-left
v[1].p = RageVector3( fRight, fYPos-fHeight/2, 0 ); // upper-right
v[2].p = RageVector3( fRight, fYPos+fHeight/2, 0 ); // lower-right
v[3].p = RageVector3( fLeft, fYPos+fHeight/2, 0 ); // lower-left
DISPLAY->DrawQuad( v );
f += iSegWidth + iSpaceWidth;
}
-1
View File
@@ -60,7 +60,6 @@ protected:
NoteDisplay m_NoteDisplay[MAX_NOTE_TRACKS];
// used in MODE_EDIT
Quad m_rectMeasureBar;
BitmapText m_textMeasureNumber;
Quad m_rectMarkerBar;
Quad m_rectAreaHighlight;
+8 -7
View File
@@ -23,8 +23,6 @@
#include "RageTypes.h"
#include "GameConstantsAndTypes.h"
#include "StepMania.h"
/* XXX: remove this once we add oglspecs_t::DisableAALines */
#include "PrefsManager.h"
#include <math.h>
@@ -102,13 +100,17 @@ RageDisplay::RageDisplay( bool windowed, int width, int height, int bpp, int rat
glGetFloatv(GL_POINT_SIZE_RANGE, m_oglspecs->point_range);
glGetFloatv(GL_POINT_SIZE_GRANULARITY, &m_oglspecs->point_granularity);
LOG->Info("Point size range: %f-%f +%f", m_oglspecs->point_range[0], m_oglspecs->point_range[1], m_oglspecs->point_granularity);
m_oglspecs->bAALinesCauseProblems = strncmp((const char*)glGetString(GL_RENDERER),"3Dfx/Voodoo3 (tm)/2 TMUs/16 MB SDRAM/ICD (Nov 2 2000)",sizeof("3Dfx/Voodoo3"))==0;
if( m_oglspecs->bAALinesCauseProblems )
LOG->Info("Anti-aliased lines are known to cause problems with this driver.");
}
bool RageDisplay::IsSoftwareRenderer()
{
return
( stricmp((const char*)glGetString(GL_VENDOR),"Microsoft Corporation")==0 ) &&
( stricmp((const char*)glGetString(GL_RENDERER),"GDI Generic")==0 );
( strcmp((const char*)glGetString(GL_VENDOR),"Microsoft Corporation")==0 ) &&
( strcmp((const char*)glGetString(GL_RENDERER),"GDI Generic")==0 );
}
void RageDisplay::SetupOpenGL()
@@ -469,7 +471,7 @@ bool RageDisplay::IsWindowed() const
{
return true; // FIXME
}
void RageDisplay::DrawQuad( const RageVertex v[4] ) // upper-left, upper-right, lower-left, lower-right
void RageDisplay::DrawQuad( const RageVertex v[4] ) // upper-left, upper-right, lower-right, lower-left
{
DrawQuads( v, 4 );
}
@@ -618,8 +620,7 @@ void RageDisplay::DrawLoop_LinesAndPoints( const RageVertex v[], int iNumVerts,
void RageDisplay::DrawLoop( const RageVertex v[], int iNumVerts, float LineWidth )
{
/* XXX: -1, 0, 1 */
if(PREFSMAN->m_iPolygonRadar == 1)
if( m_oglspecs->bAALinesCauseProblems )
DrawLoop_Polys(v, iNumVerts, LineWidth);
else
DrawLoop_LinesAndPoints(v, iNumVerts, LineWidth);
+2 -2
View File
@@ -71,6 +71,8 @@ public:
void DrawFan( const RageVertex v[], int iNumVerts );
void DrawStrip( const RageVertex v[], int iNumVerts );
void DrawLoop( const RageVertex v[], int iNumVerts, float LineWidth );
void DrawLoop_LinesAndPoints( const RageVertex v[], int iNumVerts, float LineWidth );
void DrawLoop_Polys( const RageVertex v[], int iNumVerts, float LineWidth );
void FlushQueue();
int GetMaxTextureSize() const;
@@ -102,8 +104,6 @@ protected:
void RageDisplay::DumpOpenGLDebugInfo();
void DrawPolyLine(const RageVertex &p1, const RageVertex &p2, float LineWidth );
void DrawLoop_LinesAndPoints( const RageVertex v[], int iNumVerts, float LineWidth );
void DrawLoop_Polys( const RageVertex v[], int iNumVerts, float LineWidth );
};
+3
View File
@@ -44,6 +44,9 @@ struct oglspecs_t {
bool EXT_texture_env_combine,
WGL_EXT_swap_control,
EXT_paletted_texture;
/* Is AA known to cause problems in this driver? (Voodoo3) */
bool bAALinesCauseProblems;
};
/* Extension functions we use. Put these in a namespace instead of in oglspecs_t,
+1
View File
@@ -20,6 +20,7 @@
Screen::Screen()
{
m_bIsTransparent = false;
}
Screen::~Screen()
+5 -1
View File
@@ -39,8 +39,10 @@ public:
void SendScreenMessage( const ScreenMessage SM, const float fDelay );
void ClearMessageQueue();
void ClearMessageQueue( const ScreenMessage SM ); // clear of a specific SM
protected:
bool IsTransparent() { return m_bIsTransparent; }
protected:
// structure for holding messages sent to a Screen
struct QueuedScreenMessage {
ScreenMessage SM;
@@ -48,6 +50,8 @@ protected:
};
vector<QueuedScreenMessage> m_QueuedMessages;
bool m_bIsTransparent; // screens below us need to be drawn first
public:
// let subclass override if they want
+7 -4
View File
@@ -113,7 +113,7 @@ void ScreenManager::Update( float fDeltaTime )
void ScreenManager::Restore()
{
// Draw all CurrentScreens (back to front)
// Restore all CurrentScreens (back to front)
for( unsigned i=0; i<m_ScreenStack.size(); i++ )
m_ScreenStack[i]->Restore();
}
@@ -126,9 +126,12 @@ void ScreenManager::Invalidate()
void ScreenManager::Draw()
{
// Draw all CurrentScreens (back to front)
for( unsigned i=0; i<m_ScreenStack.size(); i++ )
m_ScreenStack[i]->Draw();
if( !m_ScreenStack.empty() && !m_ScreenStack.back()->IsTransparent() ) // top screen isn't transparent
m_ScreenStack.back()->Draw();
else
for( unsigned i=0; i<m_ScreenStack.size(); i++ ) // Draw all screens bottom to top
m_ScreenStack[i]->Draw();
if( m_textSystemMessage.GetDiffuse().a != 0 )
m_textSystemMessage.Draw();
+2
View File
@@ -40,6 +40,8 @@ int ScreenMiniMenu::s_iLastAnswers[MAX_MINI_MENU_LINES];
ScreenMiniMenu::ScreenMiniMenu( MiniMenuDefinition* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel )
{
m_bIsTransparent = true; // draw screens below us
m_SMSendOnOK = SM_SendOnOK;
m_SMSendOnCancel = SM_SendOnCancel;
m_Def = *pDef;
+2
View File
@@ -28,6 +28,8 @@ const float PROMPT_Y = CENTER_Y + 120;
ScreenPrompt::ScreenPrompt( ScreenMessage SM_SendWhenDone, CString sText, bool bYesNoPrompt, bool bDefaultAnswer, void(*OnYes)(), void(*OnNo)() )
{
m_bIsTransparent = true; // draw screens below us
m_SMSendWhenDone = SM_SendWhenDone;
m_bYesNoPrompt = bYesNoPrompt;
m_bAnswer = bDefaultAnswer;
+2
View File
@@ -37,6 +37,8 @@ const float ANSWER_HEIGHT = 30;
*/
ScreenTextEntry::ScreenTextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer), void(*OnCancel)() )
{
m_bIsTransparent = true; // draw screens below us
m_SMSendWhenDone = SM_SendWhenDone;
m_pOnOK = OnOK;
m_pOnCancel = OnCancel;
@@ -172,7 +172,8 @@ int InputHandler_Win32_Pump::dev_t::GetPadEvent()
return -1;
if(ret == 0) {
LOG->Warn(werr_ssprintf(GetLastError(), "Error reading Pump pad"));
// this prints too much info in Win98
// LOG->Warn(werr_ssprintf(GetLastError(), "Error reading Pump pad"));
return -1;
}
+1 -1
View File
@@ -19,7 +19,7 @@
!define PRODUCT_NAME_VER "${PRODUCT_NAME} ${VERSION}"
Name "${PRODUCT_NAME}"
OutFile "StepMania-CVS-20030219.exe"
OutFile "StepMania-CVS-20030220.exe"
;OutFile "StepMania301.exe"
; Some default compiler settings (uncomment and change at will):