From aa55fb2edfb3a53480ce6e914b33ab523bb6b29e Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Sat, 14 Sep 2019 18:18:45 -0500 Subject: [PATCH] md3filter: Remove artificial export limits Ideally the file size should be calculated and allow up to 2GB which is unlikely to be run into. (MD2 export doesn't enforce limits either and has the exact same issue MD3 now has [invalid beyond 2GB].) --- src/libmm3d/md3filter.cc | 43 ---------------------------------------- 1 file changed, 43 deletions(-) diff --git a/src/libmm3d/md3filter.cc b/src/libmm3d/md3filter.cc index a8e71dcd..66804dfd 100644 --- a/src/libmm3d/md3filter.cc +++ b/src/libmm3d/md3filter.cc @@ -1920,13 +1920,6 @@ Model::ModelErrorE Md3Filter::writeSectionFile( const char * filename, Md3Filter } } - if ( numFrames > MD3_MAX_FRAMES ) - { - log_error( "Number of frames(%d) is larger than %d\n.\n", numFrames, MD3_MAX_FRAMES ); - m_model->setFilterSpecificError( transll( QT_TRANSLATE_NOOP( "LowLevel", "Too many animation frames for MD3 export." ) ).c_str() ); - return Model::ERROR_FILTER_SPECIFIC; - } - if ( animCount == 0 ) { animCount = 1; @@ -1954,10 +1947,6 @@ Model::ModelErrorE Md3Filter::writeSectionFile( const char * filename, Md3Filter MeshList::iterator mlit; int32_t numMeshes = 0; - size_t maxMeshTris = 0; - size_t maxMeshVerts = 0; - - std::string groupName; for ( mlit = meshes.begin(); mlit != meshes.end(); mlit++ ) { @@ -1969,49 +1958,17 @@ Model::ModelErrorE Md3Filter::writeSectionFile( const char * filename, Md3Filter if ( groupInSection( m_model->getGroupName( (*mlit).group ), section ) ) { numMeshes++; - if ( (*mlit).faces.size() > maxMeshTris ) { - maxMeshTris = (*mlit).faces.size(); - } - if ( (*mlit).vertices.size() > maxMeshVerts ) { - maxMeshVerts = (*mlit).vertices.size(); - } } } } int32_t numSkins = 0; - if ( numTags > MD3_MAX_TAGS ) - { - log_error( "Number of tags(%d) is larger than %d\n.\n", numTags, MD3_MAX_TAGS ); - m_model->setFilterSpecificError( transll( QT_TRANSLATE_NOOP( "LowLevel", "Too many points for MD3 export." ) ).c_str() ); - return Model::ERROR_FILTER_SPECIFIC; - } - if ( numMeshes > MD3_MAX_SURFACES ) - { - log_error( "Number of groups(%d) is larger than %d\n.\n", numMeshes, MD3_MAX_SURFACES ); - m_model->setFilterSpecificError( transll( QT_TRANSLATE_NOOP( "LowLevel", "Too many groups for MD3 export." ) ).c_str() ); - return Model::ERROR_FILTER_SPECIFIC; - } // numSkins is usually zero for MD3 header, there can be skins for each mesh though later int32_t offsetFrames = HEADER_SIZE; int32_t offsetTags = offsetFrames + numFrames * FRAME_SIZE; int32_t offsetMeshes = offsetTags + numFrames * numTags * TAG_SIZE; int32_t offsetEnd = offsetMeshes; - // MD3 limit tests - if ( maxMeshTris > MD3_MAX_TRIANGLES ) - { - log_error( "Number of triangles(%d) is larger than %d\n.\n", maxMeshTris, MD3_MAX_TRIANGLES ); - m_model->setFilterSpecificError( transll( QT_TRANSLATE_NOOP( "LowLevel", "Too many faces in a single group for MD3 export" ) ).c_str() ); - return Model::ERROR_FILTER_SPECIFIC; - } - if ( maxMeshVerts > MD3_MAX_VERTS ) - { - log_error( "Number of verticies(%d) is larger than %d\n.\n", maxMeshVerts, MD3_MAX_VERTS ); - m_model->setFilterSpecificError( transll( QT_TRANSLATE_NOOP( "LowLevel", "Too many vertices in a single group for MD3 export" ) ).c_str() ); - return Model::ERROR_FILTER_SPECIFIC; - } - // Open file for writing Model::ModelErrorE err = Model::ERROR_NONE; m_dst = openOutput( filename, err );