diff --git a/stepmania/src/RageDisplay.cpp b/stepmania/src/RageDisplay.cpp index 569b046bab..7cc4e65359 100644 --- a/stepmania/src/RageDisplay.cpp +++ b/stepmania/src/RageDisplay.cpp @@ -473,6 +473,23 @@ void RageDisplay::LoadMenuPerspective( float fovDegrees, float fVanishPointX, fl -fVanishPointX+SCREEN_CENTER_X, -fVanishPointY+SCREEN_CENTER_Y, 0, 0.0f, 1.0f, 0.0f) ); } + + const float fDAR = GetVideoModeParams().fDisplayAspectRatio; + const float fOutputDAR = GetVideoModeParams().fOutputDisplayAspectRatio; + + if( fOutputDAR != -1 && fabsf(fDAR-fOutputDAR) > 0.001f ) + { + if( fOutputDAR > fDAR ) + { + /* Letterboxed horizontally (showing widescreen on a regular monitor). */ + float fYAdjust = fDAR / fOutputDAR; + g_ProjectionStack.Scale( 1, fYAdjust, 1 ); + } else { + /* Letterboxed vertically (showing 4:3 on a widescreen monitor). */ + float fXAdjust = fOutputDAR / fDAR; + g_ProjectionStack.Scale( fXAdjust, 1, 1 ); + } + } } @@ -719,6 +736,41 @@ void RageDisplay::DrawCircle( const RageSpriteVertex &v, float radius ) this->DrawCircleInternal( v, radius ); } +RageCompiledGeometry::~RageCompiledGeometry() +{ + m_bNeedsNormals = false; +} + +void RageCompiledGeometry::Set( const vector &vMeshes, bool bNeedsNormals ) +{ + m_bNeedsNormals = bNeedsNormals; + + size_t totalVerts = 0; + size_t totalTriangles = 0; + + m_vMeshInfo.resize( vMeshes.size() ); + for( unsigned i=0; i &Vertices = mesh.Vertices; + const vector &Triangles = mesh.Triangles; + + MeshInfo& meshInfo = m_vMeshInfo[i]; + + meshInfo.iVertexStart = totalVerts; + meshInfo.iVertexCount = Vertices.size(); + meshInfo.iTriangleStart = totalTriangles; + meshInfo.iTriangleCount = Triangles.size(); + + totalVerts += Vertices.size(); + totalTriangles += Triangles.size(); + } + + this->Allocate( vMeshes ); + + Change( vMeshes ); +} + /* * Copyright (c) 2001-2004 Chris Danford, Glenn Maynard * All rights reserved. diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index f963a008c0..05d8f63906 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -17,48 +17,17 @@ const int MAX_TEXTURE_UNITS = 2; class RageCompiledGeometry { public: - virtual ~RageCompiledGeometry() - { - m_bNeedsNormals = false; - } + virtual ~RageCompiledGeometry(); - void Set( const vector &vMeshes, bool bNeedsNormals ) - { - m_bNeedsNormals = bNeedsNormals; - - size_t totalVerts = 0; - size_t totalTriangles = 0; - - m_vMeshInfo.resize( vMeshes.size() ); - for( unsigned i=0; i &Vertices = mesh.Vertices; - const vector &Triangles = mesh.Triangles; - - MeshInfo& meshInfo = m_vMeshInfo[i]; - - meshInfo.iVertexStart = totalVerts; - meshInfo.iVertexCount = Vertices.size(); - meshInfo.iTriangleStart = totalTriangles; - meshInfo.iTriangleCount = Triangles.size(); - - totalVerts += Vertices.size(); - totalTriangles += Triangles.size(); - } - - this->Allocate( vMeshes ); - - Change( vMeshes ); - } + void Set( const vector &vMeshes, bool bNeedsNormals ); virtual void Allocate( const vector &vMeshes ) = 0; // allocate space virtual void Change( const vector &vMeshes ) = 0; // new data must be the same size as was passed to Set() virtual void Draw( int iMeshIndex ) const = 0; protected: - size_t GetTotalVertices() { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iVertexStart + m_vMeshInfo.back().iVertexCount; } - size_t GetTotalTriangles() { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iTriangleStart + m_vMeshInfo.back().iTriangleCount; } + size_t GetTotalVertices() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iVertexStart + m_vMeshInfo.back().iVertexCount; } + size_t GetTotalTriangles() const { if( m_vMeshInfo.empty() ) return 0; return m_vMeshInfo.back().iTriangleStart + m_vMeshInfo.back().iTriangleCount; } struct MeshInfo {