void CullSettings::readCommandLine(ArgumentParser& arguments) { // report the usage options. if (arguments.getApplicationUsage()) { arguments.getApplicationUsage()->addCommandLineOption("--COMPUTE_NEAR_FAR_MODE <mode>","DO_NOT_COMPUTE_NEAR_FAR | COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES | COMPUTE_NEAR_FAR_USING_PRIMITIVES"); arguments.getApplicationUsage()->addCommandLineOption("--NEAR_FAR_RATIO <float>","Set the ratio between near and far planes - must greater than 0.0 but less than 1.0."); } std::string str; while(arguments.read("--COMPUTE_NEAR_FAR_MODE",str)) { if (str=="DO_NOT_COMPUTE_NEAR_FAR") _computeNearFar = DO_NOT_COMPUTE_NEAR_FAR; else if (str=="COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES") _computeNearFar = COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES; else if (str=="COMPUTE_NEAR_FAR_USING_PRIMITIVES") _computeNearFar = COMPUTE_NEAR_FAR_USING_PRIMITIVES; OSG_NOTIFY(osg::INFO)<<"Set compute near far mode to "<<_computeNearFar<<std::endl; } double value; while(arguments.read("--NEAR_FAR_RATIO",value)) { _nearFarRatio = value; OSG_NOTIFY(osg::INFO)<<"Set near/far ratio to "<<_nearFarRatio<<std::endl; } }
void DisplaySettings::readCommandLine(ArgumentParser& arguments) { if (_application.empty()) _application = arguments[0]; // report the usage options. if (arguments.getApplicationUsage()) { arguments.getApplicationUsage()->addCommandLineOption("--display <type>","MONITOR | POWERWALL | REALITY_CENTER | HEAD_MOUNTED_DISPLAY"); arguments.getApplicationUsage()->addCommandLineOption("--stereo","Use default stereo mode which is ANAGLYPHIC if not overriden by environmental variable"); arguments.getApplicationUsage()->addCommandLineOption("--stereo <mode>","ANAGLYPHIC | QUAD_BUFFER | HORIZONTAL_SPLIT | VERTICAL_SPLIT | LEFT_EYE | RIGHT_EYE | HORIZONTAL_INTERLACE | VERTICAL_INTERLACE | CHECKERBOARD | ON | OFF "); arguments.getApplicationUsage()->addCommandLineOption("--rgba","Request a RGBA color buffer visual"); arguments.getApplicationUsage()->addCommandLineOption("--stencil","Request a stencil buffer visual"); arguments.getApplicationUsage()->addCommandLineOption("--accum-rgb","Request a rgb accumulator buffer visual"); arguments.getApplicationUsage()->addCommandLineOption("--accum-rgba","Request a rgb accumulator buffer visual"); arguments.getApplicationUsage()->addCommandLineOption("--samples <num>","Request a multisample visual"); arguments.getApplicationUsage()->addCommandLineOption("--cc","Request use of compile contexts and threads"); arguments.getApplicationUsage()->addCommandLineOption("--serialize-draw <mode>","OFF | ON - set the serialization of draw dispatch"); arguments.getApplicationUsage()->addCommandLineOption("--implicit-buffer-attachment-render-mask","OFF | DEFAULT | [~]COLOR | [~]DEPTH | [~]STENCIL. Substitute missing buffer attachments for render FBO"); arguments.getApplicationUsage()->addCommandLineOption("--implicit-buffer-attachment-resolve-mask","OFF | DEFAULT | [~]COLOR | [~]DEPTH | [~]STENCIL. Substitute missing buffer attachments for resolve FBO"); arguments.getApplicationUsage()->addCommandLineOption("--gl-version <major.minor>","Set the hint of which GL version to use when creating graphics contexts."); arguments.getApplicationUsage()->addCommandLineOption("--gl-flags <mask>","Set the hint of which GL flags projfile mask to use when creating graphics contexts."); arguments.getApplicationUsage()->addCommandLineOption("--gl-profile-mask <mask>","Set the hint of which GL context profile mask to use when creating graphics contexts."); arguments.getApplicationUsage()->addCommandLineOption("--swap-method <method>","DEFAULT | EXCHANGE | COPY | UNDEFINED. Select preferred swap method."); } std::string str; while(arguments.read("--display",str)) { if (str=="MONITOR") _displayType = MONITOR; else if (str=="POWERWALL") _displayType = POWERWALL; else if (str=="REALITY_CENTER") _displayType = REALITY_CENTER; else if (str=="HEAD_MOUNTED_DISPLAY") _displayType = HEAD_MOUNTED_DISPLAY; } int pos; while ((pos=arguments.find("--stereo"))>0) { if (arguments.match(pos+1,"ANAGLYPHIC")) { arguments.remove(pos,2); _stereo = true;_stereoMode = ANAGLYPHIC; } else if (arguments.match(pos+1,"QUAD_BUFFER")) { arguments.remove(pos,2); _stereo = true;_stereoMode = QUAD_BUFFER; } else if (arguments.match(pos+1,"HORIZONTAL_SPLIT")) { arguments.remove(pos,2); _stereo = true;_stereoMode = HORIZONTAL_SPLIT; } else if (arguments.match(pos+1,"VERTICAL_SPLIT")) { arguments.remove(pos,2); _stereo = true;_stereoMode = VERTICAL_SPLIT; } else if (arguments.match(pos+1,"HORIZONTAL_INTERLACE")) { arguments.remove(pos,2); _stereo = true;_stereoMode = HORIZONTAL_INTERLACE; } else if (arguments.match(pos+1,"VERTICAL_INTERLACE")) { arguments.remove(pos,2); _stereo = true;_stereoMode = VERTICAL_INTERLACE; } else if (arguments.match(pos+1,"CHECKERBOARD")) { arguments.remove(pos,2); _stereo = true;_stereoMode = CHECKERBOARD; } else if (arguments.match(pos+1,"LEFT_EYE")) { arguments.remove(pos,2); _stereo = true;_stereoMode = LEFT_EYE; } else if (arguments.match(pos+1,"RIGHT_EYE")) { arguments.remove(pos,2); _stereo = true;_stereoMode = RIGHT_EYE; } else if (arguments.match(pos+1,"ON")) { arguments.remove(pos,2); _stereo = true; } else if (arguments.match(pos+1,"OFF")) { arguments.remove(pos,2); _stereo = false; } else { arguments.remove(pos); _stereo = true; } } while (arguments.read("--rgba")) { _RGB = true; _minimumNumberAlphaBits = 1; } while (arguments.read("--stencil")) { _minimumNumberStencilBits = 1; } while (arguments.read("--accum-rgb")) { setMinimumNumAccumBits(8,8,8,0); } while (arguments.read("--accum-rgba")) { setMinimumNumAccumBits(8,8,8,8); } while(arguments.read("--samples",str)) { _numMultiSamples = atoi(str.c_str()); } while(arguments.read("--cc")) { _compileContextsHint = true; } while(arguments.read("--serialize-draw",str)) { if (str=="ON") _serializeDrawDispatch = true; else if (str=="OFF") _serializeDrawDispatch = false; } while(arguments.read("--num-db-threads",_numDatabaseThreadsHint)) {} while(arguments.read("--num-http-threads",_numHttpDatabaseThreadsHint)) {} while(arguments.read("--texture-pool-size",_maxTexturePoolSize)) {} while(arguments.read("--buffer-object-pool-size",_maxBufferObjectPoolSize)) {} { // Read implicit buffer attachments combinations for both render and resolve mask const char* option[] = { "--implicit-buffer-attachment-render-mask", "--implicit-buffer-attachment-resolve-mask", }; int * mask[] = { &_implicitBufferAttachmentRenderMask, &_implicitBufferAttachmentResolveMask, }; for( unsigned int n = 0; n < sizeof( option ) / sizeof( option[0]); n++ ) { while(arguments.read( option[n],str)) { if(str.find("OFF")!=std::string::npos) *mask[n] = 0; if(str.find("~DEFAULT")!=std::string::npos) *mask[n] ^= DEFAULT_IMPLICIT_BUFFER_ATTACHMENT; else if(str.find("DEFAULT")!=std::string::npos) *mask[n] |= DEFAULT_IMPLICIT_BUFFER_ATTACHMENT; if(str.find("~COLOR")!=std::string::npos) *mask[n] ^= IMPLICIT_COLOR_BUFFER_ATTACHMENT; else if(str.find("COLOR")!=std::string::npos) *mask[n] |= IMPLICIT_COLOR_BUFFER_ATTACHMENT; if(str.find("~DEPTH")!=std::string::npos) *mask[n] ^= IMPLICIT_DEPTH_BUFFER_ATTACHMENT; else if(str.find("DEPTH")!=std::string::npos) *mask[n] |= IMPLICIT_DEPTH_BUFFER_ATTACHMENT; if(str.find("~STENCIL")!=std::string::npos) *mask[n] ^= IMPLICIT_STENCIL_BUFFER_ATTACHMENT; else if(str.find("STENCIL")!=std::string::npos) *mask[n] |= IMPLICIT_STENCIL_BUFFER_ATTACHMENT; } } } while (arguments.read("--gl-version", _glContextVersion)) {} while (arguments.read("--gl-flags", _glContextFlags)) {} while (arguments.read("--gl-profile-mask", _glContextProfileMask)) {} while(arguments.read("--swap-method",str)) { if (str=="DEFAULT") _swapMethod = SWAP_DEFAULT; else if (str=="EXCHANGE") _swapMethod = SWAP_EXCHANGE; else if (str=="COPY") _swapMethod = SWAP_COPY; else if (str=="UNDEFINED") _swapMethod = SWAP_UNDEFINED; } }