Beispiel #1
0
LocalInitData& LocalInitData::operator = ( const LocalInitData& from )
{
    _maxFrames   = from._maxFrames;
    _color       = from._color;
    _isResident  = from._isResident;
    _filenames    = from._filenames;
    _pathFilename = from._pathFilename;

    setWindowSystem( from.getWindowSystem( ));
    setRenderMode( from.getRenderMode( ));
    if( from.useGLSL( ))
        enableGLSL();
    if( from.useInvertedFaces( ))
        enableInvertedFaces();
    if( !from.showLogo( ))
        disableLogo();
    if( !from.useROI( ))
        disableROI();

    return *this;
}
Beispiel #2
0
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 );
    }
}
Beispiel #3
0
void LocalInitData::parseArguments( const int argc, char** argv )
{
    std::string wsHelp = "Window System API ( one of: ";
#ifdef AGL
    wsHelp += "AGL ";
#endif
#ifdef GLX
    wsHelp += "GLX ";
#endif
#ifdef WGL
    wsHelp += "WGL ";
#endif
#ifdef EQUALIZER_USE_QT5WIDGETS
    wsHelp += "Qt ";
#endif
    wsHelp += ")";

    bool showHelp( false );
    std::vector<std::string> userDefinedModelPath;
    bool userDefinedBlackWhiteMode( false );
    std::string userDefinedWindowSystem("");
    std::string userDefinedRenderMode("");
    bool userDefinedUseGLSL( false );
    bool userDefinedInvertFaces( false );
    bool userDefinedDisableLogo( false );
    bool userDefinedDisableROI( false );

    const std::string& desc = EqPly::getHelp();
    po::options_description options( desc + " Version " +
                                     eq::Version::getString(),
                                     lunchbox::term::getSize().first );
    options.add_options()
        ( "help,h", po::bool_switch(&showHelp)->default_value( false ),
          "produce help message" )
        ( "model,m",
          po::value<std::vector<std::string> >( &userDefinedModelPath ),
          "ply model file names or directories" )
        ( "blackAndWhite,b",
          po::bool_switch(&userDefinedBlackWhiteMode)->default_value( false ),
          "Don't use colors from ply file" )
        ( "resident,r", po::bool_switch(&_isResident)->default_value( false ),
          "Keep client resident (see resident mode documentation on website)" )
        ( "numFrames,n",
          po::value<uint32_t>(&_maxFrames)->default_value(0xffffffffu),
          "Maximum number of rendered frames")
        ( "windowSystem,w", po::value<std::string>( &userDefinedWindowSystem ),
          wsHelp.c_str() )
        ( "renderMode,c", po::value<std::string>( &userDefinedRenderMode ),
          "Rendering Mode (immediate|displayList|VBO)" )
        ( "glsl,g",
          po::bool_switch(&userDefinedUseGLSL)->default_value( false ),
          "Enable GLSL shaders" )
        ( "invertFaces,i"
          , po::bool_switch(&userDefinedInvertFaces)->default_value( false ),
          "Invert faces (valid during binary file creation)" )
        ( "cameraPath,a", po::value<std::string>(&_pathFilename),
          "File containing camera path animation" )
        ( "noOverlay,o",
          po::bool_switch(&userDefinedDisableLogo)->default_value( false ),
          "Disable overlay logo" )
        ( "disableROI,d",
          po::bool_switch(&userDefinedDisableROI)->default_value( false ),
          "Disable region of interest (ROI)" );

    po::variables_map variableMap;

    try
    {
        // parse program options, ignore all non related options
        po::store( po::command_line_parser( argc, argv ).options(
                       options ).allow_unregistered().run(),
                   variableMap );
        po::notify( variableMap );
    }
    catch( std::exception& exception )
    {
        LBERROR << "Error parsing command line: " << exception.what()
                << std::endl;
        eq::exit(); // cppcheck-suppress unreachableCode
        ::exit( EXIT_FAILURE );
    }


    // Evaluate parsed command line options
    if( showHelp )
    {
        std::cout << options << std::endl
                  << eq::getHelp() << eq::Client::getHelp() << std::endl;
        eq::exit(); // cppcheck-suppress unreachableCode
        ::exit( EXIT_SUCCESS );
    }

    if( variableMap.count("model") > 0 )
    {
        _filenames.clear();
        _filenames = userDefinedModelPath;
    }

    _color = !userDefinedBlackWhiteMode;

    if( variableMap.count("windowSystem") > 0 )
        setWindowSystem( userDefinedWindowSystem );

    if( variableMap.count("renderMode") > 0 )
    {
        std::transform( userDefinedRenderMode.begin(),
                        userDefinedRenderMode.end(),
                        userDefinedRenderMode.begin(),
                        (int(*)(int))std::tolower );

        if( userDefinedRenderMode == "immediate" )
            setRenderMode( triply::RENDER_MODE_IMMEDIATE );
        else if( userDefinedRenderMode == "displaylist" )
            setRenderMode( triply::RENDER_MODE_DISPLAY_LIST );
        else if( userDefinedRenderMode == "vbo" )
            setRenderMode( triply::RENDER_MODE_BUFFER_OBJECT );
    }

    if( userDefinedUseGLSL )
        enableGLSL();

    if( userDefinedInvertFaces)
        enableInvertedFaces();

    if( userDefinedDisableLogo )
        disableLogo();

    if( userDefinedDisableROI )
        disableROI();
}