Split ModelView matrix stack into View and World stacks.

Add "hallway" and "distant" mods.
This commit is contained in:
Chris Danford
2003-09-21 02:36:28 +00:00
parent c93b1592c2
commit c8f7c02036
13 changed files with 205 additions and 127 deletions
+9 -3
View File
@@ -924,9 +924,12 @@ void BGAnimationLayer::Update( float fDeltaTime )
void BGAnimationLayer::Draw()
{
float fLastFOV = DISPLAY->GetMenuPerspectiveFOV();
if( m_fFOV != -1 )
DISPLAY->LoadMenuPerspective( m_fFOV );
{
DISPLAY->CameraPushMatrix();
DISPLAY->LoadMenuPerspective( m_fFOV, CENTER_X, CENTER_Y );
}
if( m_bLighting )
{
DISPLAY->SetLighting( true );
@@ -942,7 +945,10 @@ void BGAnimationLayer::Draw()
m_pActors[i]->Draw();
if( m_fFOV != -1 )
DISPLAY->LoadMenuPerspective( fLastFOV );
{
DISPLAY->CameraPopMatrix();
}
if( m_bLighting )
{
DISPLAY->SetLightOff( 0 );
+3 -3
View File
@@ -184,7 +184,7 @@ void DancingCharacters::Update( float fDelta )
void DancingCharacters::DrawPrimitives()
{
DISPLAY->EnterPerspective( 45, false );
DISPLAY->CameraPushMatrix();
float fPercentIntoSweep;
if(m_fThisCameraStartBeat == m_fThisCameraEndBeat)
@@ -200,7 +200,7 @@ void DancingCharacters::DrawPrimitives()
RageVector3 m_LookAt( 0, m_fLookAtHeight, 0 );
DISPLAY->LookAt(
DISPLAY->LoadLookAt( 45,
m_CameraPoint,
m_LookAt,
RageVector3(0,1,0) );
@@ -232,5 +232,5 @@ void DancingCharacters::DrawPrimitives()
}
DISPLAY->ExitPerspective();
DISPLAY->CameraPopMatrix();
}
+3 -6
View File
@@ -26,7 +26,7 @@ NoteFieldMode::NoteFieldMode()
void NoteFieldMode::BeginDrawTrack(int tn)
{
DISPLAY->PushMatrix();
DISPLAY->CameraPushMatrix();
/* It's useful to be able to use Actors like this, functioning only
* for a transformation. However, this is a big waste of matrix
@@ -36,7 +36,7 @@ void NoteFieldMode::BeginDrawTrack(int tn)
m_CenterTrack[tn].BeginDraw();
if(m_fFov)
DISPLAY->EnterPerspective(m_fFov, true, m_fNear, m_fFar);
DISPLAY->LoadMenuPerspective(m_fFov, CENTER_X, CENTER_Y);
m_Position.BeginDraw();
if(tn != -1)
@@ -49,14 +49,11 @@ void NoteFieldMode::EndDrawTrack(int tn)
m_PositionTrack[tn].EndDraw();
m_Position.EndDraw();
if(m_fFov)
DISPLAY->ExitPerspective();
if(tn != -1)
m_CenterTrack[tn].EndDraw();
m_Center.EndDraw();
DISPLAY->PopMatrix();
DISPLAY->CameraPopMatrix();
}
template <class T>
+11 -14
View File
@@ -398,27 +398,24 @@ void PlayerMinus::DrawPrimitives()
m_Combo.Draw();
float fTilt = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fPerspectiveTilt;
float fSkew = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fSkew;
bool bReverse = GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].GetReversePercentForColumn(0)>0.5;
float fReverseScale = bReverse ? -1.0f : 1.0f;
fTilt *= bReverse ? 1.0f : -1.0f;
if( fTilt != 0 )
{
DISPLAY->EnterPerspective(45, false);
DISPLAY->CameraPushMatrix();
// construct view and project matrix
RageVector3 Up( 0.0f, 1.0f, 0.0f );
RageVector3 Eye( CENTER_X, CENTER_Y+SCALE(fTilt*fReverseScale,-1,1,-350,350), 500 );
// give a push the receptors toward the edge of the screen so they aren't so far in the middle
float fYOffset = SCALE(fTilt,-1,+1,10*fReverseScale,60*fReverseScale);
RageVector3 At( CENTER_X, CENTER_Y+fYOffset, 0 );
DISPLAY->LoadMenuPerspective( 45, SCALE(fSkew,0.f,1.f,this->GetX(),CENTER_X), CENTER_Y );
DISPLAY->LookAt(Eye, At, Up);
}
float fOriginalY = m_pNoteField->GetY();
m_pNoteField->SetY( fOriginalY + SCALE(fTilt,-1.f,+1.f,0,bReverse?+30:-40) );
m_pNoteField->SetZ( SCALE(fTilt,-1.f,+1.f,-50,+50) );
m_pNoteField->SetRotationX( SCALE(fTilt,-1.f,+1.f,-30,+30) );
m_pNoteField->Draw();
if( fTilt != 0 )
DISPLAY->ExitPerspective();
m_pNoteField->SetY( fOriginalY );
DISPLAY->CameraPopMatrix();
if( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fBlind == 0 )
{
+14 -7
View File
@@ -36,6 +36,7 @@ void PlayerOptions::Init()
m_bTimingAssist = false;
m_bProTiming = false;
m_fPerspectiveTilt = 0;
m_fSkew = 0;
m_sPositioning = ""; // "null"
m_sNoteSkin = "default";
}
@@ -56,6 +57,7 @@ void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds )
fapproach( m_fDark, other.m_fDark, fDeltaSeconds );
fapproach( m_fBlind, other.m_fBlind, fDeltaSeconds );
fapproach( m_fPerspectiveTilt, other.m_fPerspectiveTilt, fDeltaSeconds );
fapproach( m_fSkew, other.m_fSkew, fDeltaSeconds );
}
CString PlayerOptions::GetString()
@@ -141,11 +143,14 @@ CString PlayerOptions::GetString()
if( m_bTimingAssist ) sReturn += "TimingAssist, ";
if( m_bProTiming ) sReturn += "ProTiming, ";
switch( (int)m_fPerspectiveTilt )
{
case -1: sReturn += "Incoming, "; break;
case +1: sReturn += "Space, "; break;
}
if( m_fSkew==1 && m_fPerspectiveTilt==-1 )
sReturn += "Incoming, ";
else if( m_fSkew==1 && m_fPerspectiveTilt==+1 )
sReturn += "Space, ";
else if( m_fSkew==0 && m_fPerspectiveTilt==-1 )
sReturn += "Hallway, ";
else if( m_fSkew==0 && m_fPerspectiveTilt==+1 )
sReturn += "Distant, ";
if( !m_sPositioning.empty() )
sReturn += m_sPositioning + ", ";
@@ -228,8 +233,10 @@ void PlayerOptions::FromString( CString sOptions )
else if( sBit == "blind" ) m_fBlind = 1;
else if( sBit == "timingassist")m_bTimingAssist = true;
else if( sBit == "protiming") m_bProTiming = true;
else if( sBit == "incoming" ) m_fPerspectiveTilt = -1;
else if( sBit == "space" ) m_fPerspectiveTilt = +1;
else if( sBit == "incoming" ) { m_fSkew = 1; m_fPerspectiveTilt = -1; }
else if( sBit == "space" ) { m_fSkew = 1; m_fPerspectiveTilt = +1; }
else if( sBit == "hallway" ) { m_fSkew = 0; m_fPerspectiveTilt = -1; }
else if( sBit == "distant" ) { m_fSkew = 0; m_fPerspectiveTilt = +1; }
else if( GAMESTATE->m_pPosition->IsValidModeForAnyStyle(sBit) )
m_sPositioning = sBit;
else if( NOTESKIN->DoesNoteSkinExist(sBit) )
+1
View File
@@ -91,6 +91,7 @@ struct PlayerOptions
bool m_bTimingAssist;
bool m_bProTiming;
float m_fPerspectiveTilt; // -1 = near, 0 = overhead, +1 = space
float m_fSkew; // 0 = vanish point is in center of player, 1 = vanish point is in center of screen
CString m_sPositioning; /* The current positioning mode, or empty to use the normal positions. */
CString m_sNoteSkin;
+97 -50
View File
@@ -205,7 +205,7 @@ void RageDisplay::SetDefaultRenderStates()
SetAlphaTest( true );
SetBlendMode( BLEND_NORMAL );
SetTextureFiltering( true );
LoadMenuPerspective(0); // 0 FOV = ortho
LoadMenuPerspective(0, CENTER_X, CENTER_Y); // 0 FOV = ortho
}
@@ -223,8 +223,7 @@ public:
LoadIdentity();
}
// Pops the top of the stack, returns the current top
// *after* popping the top.
// Pops the top of the stack.
void Pop()
{
stack.pop_back();
@@ -350,83 +349,112 @@ public:
MatrixStack g_ProjectionStack;
MatrixStack g_ModelViewStack;
MatrixStack g_ViewStack;
MatrixStack g_WorldStack;
const RageMatrix* RageDisplay::GetProjection()
const RageMatrix* RageDisplay::GetProjectionTop()
{
return g_ProjectionStack.GetTop();
}
const RageMatrix* RageDisplay::GetModelViewTop()
const RageMatrix* RageDisplay::GetViewTop()
{
return g_ModelViewStack.GetTop();
return g_ViewStack.GetTop();
}
const RageMatrix* RageDisplay::GetWorldTop()
{
return g_WorldStack.GetTop();
}
void RageDisplay::PushMatrix()
{
g_ModelViewStack.Push();
g_WorldStack.Push();
}
void RageDisplay::PopMatrix()
{
g_ModelViewStack.Pop();
g_WorldStack.Pop();
}
void RageDisplay::Translate( float x, float y, float z )
{
g_ModelViewStack.TranslateLocal(x, y, z);
g_WorldStack.TranslateLocal(x, y, z);
}
void RageDisplay::TranslateWorld( float x, float y, float z )
{
g_ModelViewStack.Translate(x, y, z);
g_WorldStack.Translate(x, y, z);
}
void RageDisplay::Scale( float x, float y, float z )
{
g_ModelViewStack.ScaleLocal(x, y, z);
g_WorldStack.ScaleLocal(x, y, z);
}
void RageDisplay::RotateX( float deg )
{
g_ModelViewStack.RotateXLocal( deg );
g_WorldStack.RotateXLocal( deg );
}
void RageDisplay::RotateY( float deg )
{
g_ModelViewStack.RotateYLocal( deg );
g_WorldStack.RotateYLocal( deg );
}
void RageDisplay::RotateZ( float deg )
{
g_ModelViewStack.RotateZLocal( deg );
g_WorldStack.RotateZLocal( deg );
}
void RageDisplay::PostMultMatrix( const RageMatrix &m )
{
g_ModelViewStack.MultMatrix( m );
g_WorldStack.MultMatrix( m );
}
void RageDisplay::PreMultMatrix( const RageMatrix &m )
{
g_ModelViewStack.MultMatrixLocal( m );
g_WorldStack.MultMatrixLocal( m );
}
void RageDisplay::LoadIdentity()
{
g_ModelViewStack.LoadIdentity();
g_WorldStack.LoadIdentity();
}
float g_fLastMenuPerspectiveFOV = -1;
float RageDisplay::GetMenuPerspectiveFOV()
/*
void RageDisplay::LoadPerspectiveOffCenter(
float fovDegrees,
float fCenterX,
float fCenterY )
{
return g_fLastMenuPerspectiveFOV;
CLAMP( fovDegrees, 0.1f, 179.9f );
float fovRadians = fovDegrees / 180.f * PI;
float theta = fovRadians/2;
float fDistCameraFromImage = SCREEN_WIDTH/2 / tanf( theta );
// It's the caller's responsibility to push first.
g_ProjectionStack.LoadMatrix(
GetFrustrumMatrix(
(-fCenterX)/fDistCameraFromImage,
(-fCenterX+SCREEN_WIDTH)/fDistCameraFromImage,
(-fCenterY+SCREEN_HEIGHT)/fDistCameraFromImage,
(-fCenterY)/fDistCameraFromImage,
1,
fDistCameraFromImage+1000 ) );
// g_ProjectionStack.TranslateLocal( -fCenterX, -fCenterY, 0 );
g_WorldStack.LoadMatrix(
RageLookAt(
0, 0, fDistCameraFromImage,
0, 0, 0,
0.0f, 1.0f, 0.0f) );
}
*/
void RageDisplay::LoadMenuPerspective(float fovDegrees)
void RageDisplay::LoadMenuPerspective( float fovDegrees, float fVanishPointX, float fVanishPointY )
{
g_fLastMenuPerspectiveFOV = fovDegrees;
/* fovDegrees == 0 looks the same as an ortho projection. However,
* we don't want to mess with the ModelView stack because
* EnterPerspectiveMode's preserve location feature expectes there
@@ -438,7 +466,7 @@ void RageDisplay::LoadMenuPerspective(float fovDegrees)
{
float left = 0, right = SCREEN_WIDTH, bottom = SCREEN_HEIGHT, top = 0;
g_ProjectionStack.LoadMatrix( GetOrthoMatrix(left, right, bottom, top, SCREEN_NEAR, SCREEN_FAR) );
g_ModelViewStack.LoadIdentity();
g_ViewStack.LoadIdentity();
}
else
{
@@ -447,20 +475,27 @@ void RageDisplay::LoadMenuPerspective(float fovDegrees)
float theta = fovRadians/2;
float fDistCameraFromImage = SCREEN_WIDTH/2 / tanf( theta );
fVanishPointX = SCALE( fVanishPointX, SCREEN_LEFT, SCREEN_RIGHT, SCREEN_RIGHT, SCREEN_LEFT );
fVanishPointY = SCALE( fVanishPointY, SCREEN_TOP, SCREEN_BOTTOM, SCREEN_BOTTOM, SCREEN_TOP );
fVanishPointX -= CENTER_X;
fVanishPointY -= CENTER_Y;
/* It's the caller's responsibility to push first. */
g_ProjectionStack.LoadMatrix(
GetFrustrumMatrix(
-(SCREEN_WIDTH/2)/fDistCameraFromImage,
+(SCREEN_WIDTH/2)/fDistCameraFromImage,
+(SCREEN_HEIGHT/2)/fDistCameraFromImage,
-(SCREEN_HEIGHT/2)/fDistCameraFromImage,
(fVanishPointX-SCREEN_WIDTH/2)/fDistCameraFromImage,
(fVanishPointX+SCREEN_WIDTH/2)/fDistCameraFromImage,
(fVanishPointY+SCREEN_HEIGHT/2)/fDistCameraFromImage,
(fVanishPointY-SCREEN_HEIGHT/2)/fDistCameraFromImage,
1,
fDistCameraFromImage+1000 ) );
g_ModelViewStack.MultMatrixLocal(
g_ViewStack.LoadMatrix(
RageLookAt(
CENTER_X, CENTER_Y, fDistCameraFromImage,
CENTER_X, CENTER_Y, 0,
-fVanishPointX+CENTER_X, -fVanishPointY+CENTER_Y, fDistCameraFromImage,
-fVanishPointX+CENTER_X, -fVanishPointY+CENTER_Y, 0,
0.0f, 1.0f, 0.0f) );
}
}
@@ -483,19 +518,20 @@ void RageDisplay::LoadMenuPerspective(float fovDegrees)
* When finished, the current position will be the "viewpoint" (at 0,0). negative
* Z goes into the screen, positive X and Y is right and down.
*/
void RageDisplay::EnterPerspective(float fov, bool preserve_loc, float near_clip, float far_clip)
{
g_ProjectionStack.Push();
g_ModelViewStack.Push();
float aspect = SCREEN_WIDTH/(float)SCREEN_HEIGHT;
g_ProjectionStack.LoadMatrix( GetPerspectiveMatrix(fov, aspect, near_clip, far_clip) );
/* Flip the Y coordinate, so positive numbers go down. */
g_ProjectionStack.Scale(1, -1, 1);
if( preserve_loc )
{
//RageMatrix matTop = *g_ModelViewStack.GetTop();
//void RageDisplay::EnterPerspective(float fov, bool preserve_loc, float near_clip, float far_clip)
//{
// g_ProjectionStack.Push();
// g_WorldStack.Push();
//
// float aspect = SCREEN_WIDTH/(float)SCREEN_HEIGHT;
// g_ProjectionStack.LoadMatrix( GetPerspectiveMatrix(fov, aspect, near_clip, far_clip) );
// /* Flip the Y coordinate, so positive numbers go down. */
// g_ProjectionStack.Scale(1, -1, 1);
//
// if( preserve_loc )
// {
//
//RageMatrix matTop = *g_WorldStack.GetTop();
/* TODO: Come up with a more general way to handle this.
* It looks kind of hacky. -Chris */
// {
@@ -530,21 +566,32 @@ void RageDisplay::EnterPerspective(float fov, bool preserve_loc, float near_clip
// /* Reset the matrix back to identity. */
// glMatrixMode( GL_MODELVIEW );
// glLoadIdentity();
}
// }
//}
void RageDisplay::CameraPushMatrix()
{
g_ProjectionStack.Push();
g_ViewStack.Push();
}
void RageDisplay::ExitPerspective()
void RageDisplay::CameraPopMatrix()
{
g_ProjectionStack.Pop();
g_ModelViewStack.Pop();
g_ViewStack.Pop();
}
/* gluLookAt. The result is pre-multiplied to the matrix (M = L * M) instead of
* post-multiplied. */
void RageDisplay::LookAt(const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up)
void RageDisplay::LoadLookAt(float fov, const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up)
{
PreMultMatrix(RageLookAt(Eye.x, Eye.y, Eye.z, At.x, At.y, At.z, Up.x, Up.y, Up.z));
float aspect = SCREEN_WIDTH/(float)SCREEN_HEIGHT;
g_ProjectionStack.LoadMatrix( GetPerspectiveMatrix(fov, aspect, 1, 1000) );
/* Flip the Y coordinate, so positive numbers go down. */
g_ProjectionStack.Scale(1, -1, 1);
g_ViewStack.LoadMatrix(RageLookAt(Eye.x, Eye.y, Eye.z, At.x, At.y, At.z, Up.x, Up.y, Up.z));
}
RageMatrix RageDisplay::GetFrustrumMatrix(
+17 -12
View File
@@ -219,6 +219,7 @@ public:
void ProcessStatsOnFlip();
void StatsAddVerts( int iNumVertsRendered );
/* World matrix stack functions. */
void PushMatrix();
void PopMatrix();
void Translate( float x, float y, float z );
@@ -231,13 +232,17 @@ public:
void PostMultMatrix( const RageMatrix &f );
void PreMultMatrix( const RageMatrix &f );
void LoadIdentity();
float GetMenuPerspectiveFOV();
void LoadMenuPerspective(float fovDegrees);
void EnterPerspective(float fov, bool preserve_loc = true, float znear = 1, float zfar = 1000);
void ExitPerspective();
void LookAt(const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up);
virtual RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ) = 0;
/* Projection and View matrix stack functions. */
void CameraPushMatrix();
void CameraPopMatrix();
void LoadMenuPerspective( float fovDegrees, float fVanishPointX, float fVanishPointY );
void LoadLookAt( float fov, const RageVector3 &Eye, const RageVector3 &At, const RageVector3 &Up );
SDL_Surface *CreateSurfaceFromPixfmt( PixelFormat pixfmt, void *pixels, int width, int height, int pitch );
PixelFormat FindPixelFormat( int bpp, int Rmask, int Gmask, int Bmask, int Amask );
protected:
RageMatrix GetFrustrumMatrix(
float left,
float right,
@@ -247,13 +252,13 @@ public:
float zfar );
RageMatrix GetPerspectiveMatrix(float fovy, float aspect, float zNear, float zFar);
SDL_Surface *CreateSurfaceFromPixfmt( PixelFormat pixfmt, void *pixels, int width, int height, int pitch );
PixelFormat FindPixelFormat( int bpp, int Rmask, int Gmask, int Bmask, int Amask );
protected:
const RageMatrix* GetProjection();
const RageMatrix* GetModelViewTop();
// Different for D3D and OpenGL. Not sure why they're not compatible. -Chris
virtual RageMatrix GetOrthoMatrix( float l, float r, float b, float t, float zn, float zf ) = 0;
// Called by the RageDisplay derivitives
const RageMatrix* GetProjectionTop();
const RageMatrix* GetViewTop();
const RageMatrix* GetWorldTop();
};
+3 -2
View File
@@ -647,11 +647,12 @@ void RageDisplay_D3D::SaveScreenshot( CString sPath )
RageDisplay::VideoModeParams RageDisplay_D3D::GetVideoModeParams() const { return g_CurrentParams; }
#define SEND_CURRENT_MATRICES \
g_pd3dDevice->SetTransform( D3DTS_PROJECTION, (D3DMATRIX*)GetProjection() ); \
g_pd3dDevice->SetTransform( D3DTS_PROJECTION, (D3DMATRIX*)GetProjectionTop() ); \
g_pd3dDevice->SetTransform( D3DTS_VIEW, (D3DMATRIX*)GetViewTop() ); \
RageMatrix m; \
/* Convert to OpenGL-style "pixel-centered" coords */ \
RageMatrixTranslation( &m, -0.5f, -0.5f, 0 ); \
RageMatrixMultiply( &m, &m, GetModelViewTop() ); \
RageMatrixMultiply( &m, &m, GetWorldTop() ); \
g_pd3dDevice->SetTransform( D3DTS_WORLD, (D3DMATRIX*)&m );
+21 -23
View File
@@ -692,6 +692,14 @@ static void SetupVertices( const RageSpriteVertex v[], int iNumVerts )
glNormalPointer(GL_FLOAT, 0, Normal);
}
#define SEND_CURRENT_MATRICES \
glMatrixMode( GL_PROJECTION ); \
glLoadMatrixf( (const float*)GetProjectionTop() ); \
RageMatrix modelView; \
RageMatrixMultiply( &modelView, GetViewTop(), GetWorldTop() ); \
glMatrixMode( GL_MODELVIEW ); \
glLoadMatrixf( (const float*)&modelView ); \
static void SetupVertices( const RageModelVertex v[], int iNumVerts )
{
static float *Vertex, *Texture, *Normal;
@@ -737,10 +745,7 @@ void RageDisplay_OGL::DrawQuads( const RageSpriteVertex v[], int iNumVerts )
if(iNumVerts == 0)
return;
glMatrixMode( GL_PROJECTION );
glLoadMatrixf( (const float*)GetProjection() );
glMatrixMode( GL_MODELVIEW );
glLoadMatrixf( (const float*)GetModelViewTop() );
SEND_CURRENT_MATRICES;
SetupVertices( v, iNumVerts );
glDrawArrays( GL_QUADS, 0, iNumVerts );
@@ -752,9 +757,9 @@ void RageDisplay_OGL::DrawFan( const RageSpriteVertex v[], int iNumVerts )
{
ASSERT( iNumVerts >= 3 );
glMatrixMode( GL_PROJECTION );
glLoadMatrixf( (const float*)GetProjection() );
glMatrixMode( GL_MODELVIEW );
glLoadMatrixf( (const float*)GetModelViewTop() );
SEND_CURRENT_MATRICES;
SetupVertices( v, iNumVerts );
glDrawArrays( GL_TRIANGLE_FAN, 0, iNumVerts );
StatsAddVerts( iNumVerts );
@@ -763,10 +768,9 @@ void RageDisplay_OGL::DrawFan( const RageSpriteVertex v[], int iNumVerts )
void RageDisplay_OGL::DrawStrip( const RageSpriteVertex v[], int iNumVerts )
{
ASSERT( iNumVerts >= 3 );
glMatrixMode( GL_PROJECTION );
glLoadMatrixf( (const float*)GetProjection() );
glMatrixMode( GL_MODELVIEW );
glLoadMatrixf( (const float*)GetModelViewTop() );
SEND_CURRENT_MATRICES;
SetupVertices( v, iNumVerts );
glDrawArrays( GL_TRIANGLE_STRIP, 0, iNumVerts );
StatsAddVerts( iNumVerts );
@@ -777,10 +781,9 @@ void RageDisplay_OGL::DrawTriangles( const RageSpriteVertex v[], int iNumVerts )
if( iNumVerts == 0 )
return;
ASSERT( (iNumVerts%3) == 0 );
glMatrixMode( GL_PROJECTION );
glLoadMatrixf( (const float*)GetProjection() );
glMatrixMode( GL_MODELVIEW );
glLoadMatrixf( (const float*)GetModelViewTop() );
SEND_CURRENT_MATRICES;
SetupVertices( v, iNumVerts );
glDrawArrays( GL_TRIANGLES, 0, iNumVerts );
StatsAddVerts( iNumVerts );
@@ -791,10 +794,8 @@ void RageDisplay_OGL::DrawIndexedTriangles( const RageModelVertex v[], int iNumV
if( iNumIndices == 0 )
return;
ASSERT( (iNumIndices%3) == 0 );
glMatrixMode( GL_PROJECTION );
glLoadMatrixf( (const float*)GetProjection() );
glMatrixMode( GL_MODELVIEW );
glLoadMatrixf( (const float*)GetModelViewTop() );
SEND_CURRENT_MATRICES;
SetupVertices( v, iNumVerts );
// glInterleavedArrays( RageSpriteVertexFormat, sizeof(RageSpriteVertex), v );
@@ -812,10 +813,7 @@ void RageDisplay_OGL::DrawLineStrip( const RageSpriteVertex v[], int iNumVerts,
return;
}
glMatrixMode( GL_PROJECTION );
glLoadMatrixf( (const float*)GetProjection() );
glMatrixMode( GL_MODELVIEW );
glLoadMatrixf( (const float*)GetModelViewTop() );
SEND_CURRENT_MATRICES;
/* Draw a nice AA'd line loop. One problem with this is that point and line
* sizes don't always precisely match, which doesn't look quite right.
+15 -5
View File
@@ -160,6 +160,8 @@ void ScreenPlayerOptions::ImportOptions()
m_OptionRow[PO_PERSPECTIVE].choices.push_back( "INCOMING" );
m_OptionRow[PO_PERSPECTIVE].choices.push_back( "OVERHEAD" );
m_OptionRow[PO_PERSPECTIVE].choices.push_back( "SPACE" );
m_OptionRow[PO_PERSPECTIVE].choices.push_back( "HALLWAY" );
m_OptionRow[PO_PERSPECTIVE].choices.push_back( "DISTANT" );
CStringArray arrayPosNames;
GAMESTATE->m_pPosition->GetNamesForCurrentGame(arrayPosNames);
@@ -275,10 +277,14 @@ void ScreenPlayerOptions::ImportOptions()
/* Default: */
m_iSelectedOption[p][PO_PERSPECTIVE] = 1;
if(po.m_fPerspectiveTilt == -1)
if( po.m_fSkew==1 && po.m_fPerspectiveTilt==-1 )
m_iSelectedOption[p][PO_PERSPECTIVE] = 0;
else if(po.m_fPerspectiveTilt == 1)
else if( po.m_fSkew==1 && po.m_fPerspectiveTilt==1 )
m_iSelectedOption[p][PO_PERSPECTIVE] = 2;
else if( po.m_fSkew==0 && po.m_fPerspectiveTilt==-1 )
m_iSelectedOption[p][PO_PERSPECTIVE] = 3;
else if( po.m_fSkew==0 && po.m_fPerspectiveTilt==1 )
m_iSelectedOption[p][PO_PERSPECTIVE] = 4;
else /* po.m_fPerspectiveTilt == 0 */
{
vector<CString> &choices = m_OptionRow[PO_PERSPECTIVE].choices;
@@ -377,9 +383,13 @@ void ScreenPlayerOptions::ExportOptions()
switch(m_iSelectedOption[p][PO_PERSPECTIVE])
{
case 0: po.m_fPerspectiveTilt = -1; break;
case 2: po.m_fPerspectiveTilt = 1; break;
default:po.m_fPerspectiveTilt = 0; break;
case 0: po.m_fSkew = 1; po.m_fPerspectiveTilt = -1; break;
case 1: po.m_fSkew = 1; po.m_fPerspectiveTilt = 0; break;
case 2: po.m_fSkew = 0; po.m_fPerspectiveTilt = 1; break;
case 3: po.m_fSkew = 0; po.m_fPerspectiveTilt = -1; break;
case 4: po.m_fSkew = 0; po.m_fPerspectiveTilt = 1; break;
default:
ASSERT(0);
}
if(m_iSelectedOption[p][PO_PERSPECTIVE] > 2)
{
+8
View File
@@ -69,4 +69,12 @@ protected:
float m_fLockInputSecs;
};
//
// Aliases
//
class ScreenSelectStyle5th : public ScreenSelectMaster
{
};
#endif
+3 -2
View File
@@ -262,14 +262,15 @@ ScreenSelectMusic::~ScreenSelectMusic()
void ScreenSelectMusic::DrawPrimitives()
{
DISPLAY->LoadMenuPerspective(FOV);
DISPLAY->CameraPushMatrix();
DISPLAY->LoadMenuPerspective(FOV, CENTER_X, CENTER_Y);
m_Menu.DrawBottomLayer();
Screen::DrawPrimitives();
m_Menu.DrawTopLayer();
m_sprOptionsMessage.Draw();
DISPLAY->LoadMenuPerspective(0);
DISPLAY->CameraPopMatrix();
}
void ScreenSelectMusic::TweenSongPartsOnScreen( bool Initial )