本文整理汇总了C++中CmdLineParser::addSwitch方法的典型用法代码示例。如果您正苦于以下问题:C++ CmdLineParser::addSwitch方法的具体用法?C++ CmdLineParser::addSwitch怎么用?C++ CmdLineParser::addSwitch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmdLineParser
的用法示例。
在下文中一共展示了CmdLineParser::addSwitch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[]) {
int ctThreads = tbb::task_scheduler_init::default_num_threads();
tbb::task_scheduler_init init(ctThreads);
cout << "started tbb with " << ctThreads << " threads." << endl;
//parser
g_parser.addSwitch("--disjoint", "-d", "converts splitted part to disjoint meshes", "0");
g_parser.addSwitch("--ringscalpel", "-r", "If the switch presents then the ring scalpel will be used");
g_parser.addSwitch("--verbose", "-v", "prints detailed description.");
g_parser.addSwitch("--input", "-i", "[filepath] set input file in vega format", "internal");
//g_parser.addSwitch("--example", "-e", "[one, two, cube, eggshell] set an internal example", "two");
//g_parser.addSwitch("--gizmo", "-g", "loads a file to set gizmo location and orientation", "gizmo.ini");
if(g_parser.parse(argc, argv) < 0)
exit(0);
//file path
g_strIniFilePath = AnsiStr(g_parser.value("input").c_str());
if(FileExists(g_strIniFilePath))
vloginfo("input file: %s.", g_strIniFilePath.cptr());
else {
vlogerror("Unable to find input filepath: [%s]", g_strIniFilePath.cptr());
exit(1);
}
//GLFW LIB
g_lpWindow = NULL;
glfwSetErrorCallback(error_callback);
if (!glfwInit()) {
vlogerror("Failed to init glfw");
exit(EXIT_FAILURE);
}
/*
glfwWindowHint(GLFW_SAMPLES, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
*/
g_lpWindow = glfwCreateWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, "tetcutter - Pourya Shirazian", NULL, NULL);
if (!g_lpWindow)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(g_lpWindow);
glfwSwapInterval(1);
glfwSetKeyCallback(g_lpWindow, key_callback);
glfwSetCursorPosCallback(g_lpWindow, mouse_motion_callback);
glfwSetMouseButtonCallback(g_lpWindow, mouse_button_callback);
glfwSetScrollCallback(g_lpWindow, scroll_callback);
//init gl
def_initgl();
//Build Shaders for drawing the mesh
IniFile ini(g_strIniFilePath, IniFile::fmRead);
AnsiStr strRoot = ini.readString("system", "data");
AnsiStr strShaderRoot = strRoot + "shaders/";
AnsiStr strTextureRoot = strRoot + "textures/";
AnsiStr strFontsRoot = strRoot + "fonts/";
//convert mesh
// AnsiStr strNodesFP = strRoot + AnsiStr("data/meshes/matlab/nodes.txt");
// AnsiStr strFacesFP = strRoot + AnsiStr("data/meshes/matlab/faces.txt");
// AnsiStr strCellsFP = strRoot + AnsiStr("data/meshes/matlab/cells.txt");
// VolMeshIO::convertMatlabTextToVega(strNodesFP, strFacesFP, strCellsFP);
//Load Shaders
TheShaderManager::Instance().addFromFolder(strShaderRoot.cptr());
//Load Textures
TheTexManager::Instance().add(strTextureRoot + "wood.png");
TheTexManager::Instance().add(strTextureRoot + "spin.png");
TheTexManager::Instance().add(strTextureRoot + "icefloor.png");
// TheTexManager::Instance().add(strTextureRoot + "rendermask.png");
// TheTexManager::Instance().add(strTextureRoot + "maskalpha.png");
// TheTexManager::Instance().add(strTextureRoot + "maskalphafilled.png");
vloginfo("Floor show is set to: [%d]", ini.readBool("visible", "floor"));
//Ground and Room
SGQuad* floor = new SGQuad(16.0f, 16.0f, TheTexManager::Instance().get("icefloor"));
floor->setName("floor");
floor->transform()->translate(vec3f(0, -0.1f, 0));
floor->transform()->rotate(vec3f(1.0f, 0.0f, 0.0f), 90.0f);
floor->setVisible(ini.readBool("visible", "floor"));
TheEngine::Instance().add(floor);
//Create Scalpel
g_lpScalpel = new AvatarScalpel();
g_lpScalpel->setVisible(false);
g_lpRing = new AvatarRing(TheTexManager::Instance().get("spin"));
//.........这里部分代码省略.........