void Application::_loadModel( const eq::Strings& models ) { eq::Strings files = models; while( !files.empty( )) { const std::string filename = files.back(); files.pop_back(); if( _isPlyfile( filename )) { _model = new Model; if( _model->readFromFile( filename.c_str( ))) { _modelDist = new ModelDist( _model ); _modelDist->registerTree( this ); _frameData.setModelID( _modelDist->getID( )); return; } delete _model; _model = 0; } else { const std::string basename = lunchbox::getFilename( filename ); if( basename == "." || basename == ".." ) continue; // recursively search directories const eq::Strings subFiles = lunchbox::searchDirectory( filename, ".*" ); for(eq::StringsCIter i = subFiles.begin(); i != subFiles.end(); ++i) files.push_back( filename + '/' + *i ); } } }
void Config::_loadModels() { if( !_models.empty( )) // only load on the first config run return; eq::Strings filenames = _initData.getFilenames(); while( !filenames.empty( )) { const std::string filename = filenames.back(); filenames.pop_back(); if( _isPlyfile( filename )) { Model* model = new Model; if( _initData.useInvertedFaces() ) model->useInvertedFaces(); if( !model->readFromFile( filename.c_str( ))) { LBWARN << "Can't load model: " << filename << std::endl; delete model; } else _models.push_back( model ); } else { const std::string basename = lunchbox::getFilename( filename ); if( basename == "." || basename == ".." ) continue; // recursively search directories const eq::Strings subFiles = lunchbox::searchDirectory( filename, "*" ); for(eq::StringsCIter i = subFiles.begin(); i != subFiles.end(); ++i) filenames.push_back( filename + '/' + *i ); } } }