diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index d254f7b10f..9e8751eba5 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -145,6 +145,7 @@ public: virtual bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ) = 0; virtual bool SupportsThreadedRendering() { return false; } + virtual bool SupportsPerVertexMatrixScale() = 0; /* return 0 if failed or internal texture resource handle * (unsigned in OpenGL, texture pointer in D3D) */ diff --git a/stepmania/src/RageDisplay_D3D.h b/stepmania/src/RageDisplay_D3D.h index e3a6ea82a5..c90966578d 100644 --- a/stepmania/src/RageDisplay_D3D.h +++ b/stepmania/src/RageDisplay_D3D.h @@ -19,6 +19,7 @@ public: void SetBlendMode( BlendMode mode ); bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ); bool SupportsThreadedRendering(); + bool SupportsPerVertexMatrixScale() { return false; } unsigned CreateTexture( PixelFormat pixfmt, RageSurface* img, diff --git a/stepmania/src/RageDisplay_Null.h b/stepmania/src/RageDisplay_Null.h index 6694e1fb67..2c66cab366 100644 --- a/stepmania/src/RageDisplay_Null.h +++ b/stepmania/src/RageDisplay_Null.h @@ -16,6 +16,7 @@ public: VideoModeParams GetVideoModeParams() const { return m_Params; } void SetBlendMode( BlendMode mode ) { } bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ) { return true; } + bool SupportsPerVertexMatrixScale() { return false; } unsigned CreateTexture( PixelFormat pixfmt, RageSurface* img, diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 0c3bf7ea7e..f7ce7660be 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -1198,7 +1198,7 @@ void RageCompiledGeometryHWOGL::Draw( int iMeshIndex ) const if( meshInfo.m_bNeedsTextureMatrixScale ) { - if( false ) //g_bTextureMatrixShader != 0 ) + if( g_bTextureMatrixShader != 0 ) { /* If we're using texture matrix scales, set up that buffer, too, and enable the * vertex shader. This shader doesn't support all OpenGL state, so only enable it @@ -1998,6 +1998,11 @@ bool RageDisplay_OGL::SupportsTextureFormat( PixelFormat pixfmt, bool bRealtime } } +bool RageDisplay_OGL::SupportsPerVertexMatrixScale() +{ + return g_bTextureMatrixShader != 0; +} + void RageDisplay_OGL::SetSphereEnvironmentMapping( bool b ) { if( b ) diff --git a/stepmania/src/RageDisplay_OGL.h b/stepmania/src/RageDisplay_OGL.h index cc28a90ebb..450b601743 100644 --- a/stepmania/src/RageDisplay_OGL.h +++ b/stepmania/src/RageDisplay_OGL.h @@ -19,6 +19,7 @@ public: VideoModeParams GetVideoModeParams() const; void SetBlendMode( BlendMode mode ); bool SupportsTextureFormat( PixelFormat pixfmt, bool realtime=false ); + bool SupportsPerVertexMatrixScale(); unsigned CreateTexture( PixelFormat pixfmt, RageSurface* img, diff --git a/stepmania/src/RageModelGeometry.cpp b/stepmania/src/RageModelGeometry.cpp index 059457f6b7..87a516e0a1 100644 --- a/stepmania/src/RageModelGeometry.cpp +++ b/stepmania/src/RageModelGeometry.cpp @@ -61,12 +61,12 @@ void RageModelGeometry::MergeMeshes( int iFromIndex, int iToIndex ) msMesh& meshTo = m_Meshes[ iToIndex ]; int iShiftTriangleVertexIndicesBy = meshTo.Vertices.size(); - int iStartShiftingTriangleAtIndex = meshTo.Triangles.size(); + int iStartShiftingAtTriangleIndex = meshTo.Triangles.size(); - meshTo.Vertices.insert( meshTo.Vertices.end(), meshFrom.Vertices.end(), meshFrom.Vertices.end() ); - meshTo.Triangles.insert( meshTo.Triangles.end(), meshFrom.Triangles.end(), meshFrom.Triangles.end() ); + meshTo.Vertices.insert( meshTo.Vertices.end(), meshFrom.Vertices.begin(), meshFrom.Vertices.end() ); + meshTo.Triangles.insert( meshTo.Triangles.end(), meshFrom.Triangles.begin(), meshFrom.Triangles.end() ); - for( unsigned i=iStartShiftingTriangleAtIndex; iSupportsPerVertexMatrixScale() ) + { + if( m_Meshes.size() == 2 && m_Meshes[0].sName == m_Meshes[1].sName ) + { + MergeMeshes( 1, 0 ); + } + } + // send the finalized vertices to the graphics card m_pCompiledGeometry->Set( m_Meshes, bNeedsNormals );