if DISPLAY->SupportsPerVertexMatrixScale, then merge meshes with equal names. The allows some NoteSkins to be drawn in either 2 meshes or only 1 if vertex shaders are supported.

This commit is contained in:
Chris Danford
2005-10-21 06:36:08 +00:00
parent 2513b7aac1
commit 1903e07f56
6 changed files with 22 additions and 5 deletions
+1
View File
@@ -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) */
+1
View File
@@ -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,
+1
View File
@@ -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,
+6 -1
View File
@@ -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 )
+1
View File
@@ -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,
+12 -4
View File
@@ -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; i<meshTo.Triangles.size(); i++ )
for( unsigned i=iStartShiftingAtTriangleIndex; i<meshTo.Triangles.size(); i++ )
{
for( int j=0; j<3; j++ )
meshTo.Triangles[i].nVertexIndices[j] += iShiftTriangleVertexIndicesBy;
@@ -262,6 +262,14 @@ void RageModelGeometry::LoadMilkshapeAscii( const CString& _sPath, bool bNeedsNo
OptimizeBones();
if( DISPLAY->SupportsPerVertexMatrixScale() )
{
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 );