void LocalInitData::parseArguments( const int argc, char** argv ) { try { std::string wsHelp = "Window System API ( one of: "; #ifdef AGL wsHelp += "AGL "; #endif #ifdef GLX wsHelp += "glX "; #endif #ifdef WGL wsHelp += "WGL "; #endif wsHelp += ")"; const std::string& desc = EqPly::getHelp(); TCLAP::CmdLine command( desc, ' ', eq::Version::getString( )); TCLAP::MultiArg<std::string> modelArg( "m", "model", "ply model file name or directory", false, "string", command ); TCLAP::ValueArg<std::string> portArg( "p", "port", "tracking device port", false, "/dev/ttyS0", "string", command ); TCLAP::SwitchArg colorArg( "b", "blackAndWhite", "Don't use colors from ply file", command, false ); TCLAP::SwitchArg residentArg( "r", "resident", "Keep client resident (see resident node documentation on website)", command, false ); TCLAP::ValueArg<uint32_t> framesArg( "n", "numFrames", "Maximum number of rendered frames", false, 0xffffffffu, "unsigned", command ); TCLAP::ValueArg<std::string> wsArg( "w", "windowSystem", wsHelp, false, "auto", "string", command ); TCLAP::ValueArg<std::string> modeArg( "c", "renderMode", "Rendering Mode (immediate, displayList, VBO)", false, "auto", "string", command ); TCLAP::SwitchArg glslArg( "g", "glsl", "Enable GLSL shaders", command, false ); TCLAP::SwitchArg invFacesArg( "i", "invertFaces", "Invert faces (valid during binary file creation)", command, false ); TCLAP::ValueArg<std::string> pathArg( "a", "cameraPath", "File containing camera path animation", false, "", "string", command ); TCLAP::SwitchArg overlayArg( "o", "noOverlay", "Disable overlay logo", command, false ); TCLAP::VariableSwitchArg ignoreEqArgs( "eq", "Ignored Equalizer options", command ); TCLAP::UnlabeledMultiArg< std::string > ignoreArgs( "ignore", "Ignored unlabeled arguments", false, "any", command ); TCLAP::SwitchArg roiArg( "d", "disableROI", "Disable ROI", command, false ); command.parse( argc, argv ); if( modelArg.isSet( )) { _filenames.clear(); _filenames = modelArg.getValue(); } if( portArg.isSet( )) _trackerPort = portArg.getValue(); if( wsArg.isSet( )) { std::string windowSystem = wsArg.getValue(); transform( windowSystem.begin(), windowSystem.end(), windowSystem.begin(), (int(*)(int))std::toupper ); setWindowSystem( windowSystem ); } _color = !colorArg.isSet(); if( framesArg.isSet( )) _maxFrames = framesArg.getValue(); if( residentArg.isSet( )) _isResident = true; if( modeArg.isSet() ) { std::string mode = modeArg.getValue(); transform( mode.begin(), mode.end(), mode.begin(), (int(*)(int))std::tolower ); if( mode == "immediate" ) setRenderMode( mesh::RENDER_MODE_IMMEDIATE ); else if( mode == "displaylist" ) setRenderMode( mesh::RENDER_MODE_DISPLAY_LIST ); else if( mode == "vbo" ) setRenderMode( mesh::RENDER_MODE_BUFFER_OBJECT ); } if( pathArg.isSet( )) _pathFilename = pathArg.getValue(); if( glslArg.isSet() ) enableGLSL(); if( invFacesArg.isSet() ) enableInvertedFaces(); if( overlayArg.isSet( )) disableLogo(); if( roiArg.isSet( )) disableROI(); } catch( const TCLAP::ArgException& exception ) { LBERROR << "Command line parse error: " << exception.error() << " for argument " << exception.argId() << std::endl; ::exit( EXIT_FAILURE ); } }
void LocalInitData::parseArguments( const int argc, char** argv ) { try { std::string wsHelp = "Window System API ( one of: "; #ifdef AGL wsHelp += "AGL "; #endif #ifdef GLX wsHelp += "glX "; #endif #ifdef WGL wsHelp += "WGL "; #endif wsHelp += ")"; std::string desc = EVolve::getHelp(); TCLAP::CmdLine command( desc ); TCLAP::ValueArg<std::string> modelArg( "m", "model", "raw model file name", false, "Bucky32x32x32.raw", "string", command ); TCLAP::SwitchArg residentArg( "r", "resident", "Keep client resident (see resident node documentation on website)", command, false ); TCLAP::ValueArg<uint32_t> framesArg( "n", "numFrames", "Maximum number of rendered frames", false, 0xffffffffu, "unsigned", command ); TCLAP::ValueArg<uint32_t> precisionArg( "p", "precision", "Rendering precision (default 2, bigger is better and slower)", false, 2, "unsigned", command ); TCLAP::ValueArg<float> brightnessArg( "b", "brightness", "brightness factor", false, 1.0f, "float", command ); TCLAP::ValueArg<float> alphaArg( "a", "alpha", "alpha attenuation", false, 1.0f, "float", command ); TCLAP::SwitchArg orthoArg( "o", "ortho", "use orthographic projection", command, false ); TCLAP::ValueArg<std::string> wsArg( "w", "windowSystem", wsHelp, false, "auto", "string", command ); TCLAP::VariableSwitchArg ignoreEqArgs( "eq", "Ignored Equalizer options", command ); TCLAP::UnlabeledMultiArg< std::string > ignoreArgs( "ignore", "Ignored unlabeled arguments", false, "any", command ); command.parse( argc, argv ); if( modelArg.isSet( )) setFilename( modelArg.getValue( )); if( wsArg.isSet( )) { std::string windowSystem = wsArg.getValue(); transform( windowSystem.begin(), windowSystem.end(), windowSystem.begin(), (int(*)(int))std::toupper ); setWindowSystem( windowSystem ); } if( framesArg.isSet( )) _maxFrames = framesArg.getValue(); if( precisionArg.isSet( )) setPrecision( precisionArg.getValue( )); if( brightnessArg.isSet( )) setBrightness( brightnessArg.getValue( )); if( alphaArg.isSet( )) setAlpha( alphaArg.getValue( )); if( residentArg.isSet( )) _isResident = true; if( orthoArg.isSet( )) _ortho = true; } catch( const TCLAP::ArgException& exception ) { LBERROR << "Command line parse error: " << exception.error() << " for argument " << exception.argId() << std::endl; ::exit( EXIT_FAILURE ); } }