minor code improvements for the obj code

- make use of range for loops
- make use of empty() method for the std::vector
- removed unnecessary std::string initialization
- use ' ' instead of " " for the find methods (should be "faster")
- simplified some function
- make use of emplace_back instead of push_back (should be "faster")
- other small changes
This commit is contained in:
iamAdrianIusca
2020-02-13 00:10:07 +02:00
parent d38e541e89
commit fc4dd6455a
4 changed files with 39 additions and 52 deletions

View File

@@ -274,7 +274,7 @@ void ObjFileMtlImporter::getFloatValue( ai_real &value )
// Creates a material from loaded data.
void ObjFileMtlImporter::createMaterial()
{
std::string line( "" );
std::string line;
while( !IsLineEnd( *m_DataIt ) ) {
line += *m_DataIt;
++m_DataIt;
@@ -282,7 +282,7 @@ void ObjFileMtlImporter::createMaterial()
std::vector<std::string> token;
const unsigned int numToken = tokenize<std::string>( line, token, " \t" );
std::string name( "" );
std::string name;
if ( numToken == 1 ) {
name = AI_DEFAULT_MATERIAL_NAME;
} else {