// static std::shared_ptr< OBJData > OBJLoader::loadFile( QString objFilename ) { int lineNumber = 0; QString line = ""; std::shared_ptr< OBJData > pOBJData( new OBJData ); OBJMaterial* pCurrentMaterial = pOBJData->addMaterial( "" ); // default material name is the empty string OBJGroup* pCurrentGroup = pOBJData->addGroup( "" ); // default group name is the empty string bool succeeded = parseOBJ( objFilename, pOBJData ); if( !succeeded ) { // return null pOBJData.reset(); } return pOBJData; }
// static std::unique_ptr< OBJData > OBJLoader::loadFile( const std::string& objFilename, bool removeEmptyGroups ) { std::unique_ptr< OBJData > pOBJData( new OBJData ); bool succeeded = parseOBJ( objFilename, pOBJData.get() ); if( !succeeded ) { // Return null. pOBJData.reset(); } if( removeEmptyGroups ) { pOBJData->removeEmptyGroups(); } return pOBJData; }