本文整理汇总了C++中CmdLineParser::value_to_int方法的典型用法代码示例。如果您正苦于以下问题:C++ CmdLineParser::value_to_int方法的具体用法?C++ CmdLineParser::value_to_int怎么用?C++ CmdLineParser::value_to_int使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmdLineParser
的用法示例。
在下文中一共展示了CmdLineParser::value_to_int方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cutFinished
void cutFinished() {
if(!g_parser.value_to_int("disjoint"))
return;
vector<CuttableMesh*> vMeshes;
g_lpTissue->convertDisjointPartsToMeshes(vMeshes);
if(vMeshes.size() == 0)
return;
U32 ctMaxCells = 0;
U32 idxMaxCell = 0;
for(U32 i=0; i < vMeshes.size(); i++) {
vMeshes[i]->computeAABB();
vMeshes[i]->setElemToShow(0);
TheEngine::Instance().add(vMeshes[i]);
if(vMeshes[i]->countCells() > ctMaxCells) {
ctMaxCells = vMeshes[i]->countCells();
idxMaxCell = i;
}
}
g_lpTissue = vMeshes[idxMaxCell];
g_lpTissue->setElemToShow();
if(g_lpAvatar)
g_lpAvatar->setTissue(g_lpTissue);
}
示例2: main
//.........这里部分代码省略.........
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"));
g_lpRing->setVisible(false);
TheEngine::Instance().add(g_lpScalpel);
TheEngine::Instance().add(g_lpRing);
if(g_parser.value_to_int("ringscalpel") == 1) {
g_lpAvatar = g_lpRing;
g_lpRing->setVisible(true);
}
else {
g_lpAvatar = g_lpScalpel;
g_lpScalpel->setVisible(true);
}
g_lpAvatar->setTissue(g_lpTissue);
g_lpAvatar->setOnCutFinishedEventHandler(cutFinished);
TheGizmoManager::Instance().setFocusedNode(g_lpAvatar);
TheGizmoManager::Instance().readConfig(g_strIniFilePath);
//setup engine
TheEngine::Instance().readConfig(g_strIniFilePath);
TheEngine::Instance().headers()->addHeaderLine("cell", "info");
TheEngine::Instance().print();
//reset cuttable mesh
resetMesh();
//mainloop
while (!glfwWindowShouldClose(g_lpWindow))
{
//setup projection matrix
int width = DEFAULT_WIDTH;
int height = DEFAULT_HEIGHT;
glfwGetFramebufferSize(g_lpWindow, &width, &height);
def_resize(width, height);
//draw frame
draw();
timestep();
glfwSwapBuffers(g_lpWindow);
glfwPollEvents();
}
//destroy window
glfwDestroyWindow(g_lpWindow);
glfwTerminate();
exit(EXIT_SUCCESS);
return 0;
}
示例3: resetMesh
bool resetMesh() {
//remove it from scenegraph
TheEngine::Instance().remove(g_lpTissue);
SAFE_DELETE(g_lpTissue);
if(!FileExists(g_strIniFilePath)) {
vlogerror("ini file not exists! [%s]", g_strIniFilePath.c_str());
return false;
}
vloginfo("reading model config from ini file: [%s]", g_strIniFilePath.c_str());
IniFile ini(g_strIniFilePath, IniFile::fmRead);
AnsiStr mdl_type = ini.readString("model", "type");
AnsiStr mdl_name = ini.readString("model", "name");
VolMesh* temp = NULL;
//loading internal model
if(mdl_type == "internal") {
int pos = -1;
if(mdl_name == "one")
temp = VolMeshSamples::CreateOneTetra();
else if(mdl_name == "two")
temp = VolMeshSamples::CreateTwoTetra();
else if(mdl_name.lfindstr(AnsiStr("cube"), pos)) {
U32 nx, ny, nz = 0;
sscanf(mdl_name.cptr(), "cube_%u_%u_%u", &nx, &ny, &nz);
temp = VolMeshSamples::CreateTruthCube(nx, ny, nz, 0.2);
}
else if(mdl_name.lfindstr(AnsiStr("eggshell"), pos)) {
U32 nx, ny;
//float radius, thickness;
sscanf(mdl_name.cptr(), "eggshell_%u_%u", &nx, &ny);
temp = VolMeshSamples::CreateEggShell(nx, ny);
}
else
temp = VolMeshSamples::CreateOneTetra();
}
else if(mdl_type == "file") {
temp = new VolMesh();
temp->setFlagFilterOutFlatCells(false);
temp->setVerbose(g_parser.value_to_int("verbose"));
if(!FileExists(mdl_name)) {
AnsiStr data_root_path = ini.readString("system", "data");
mdl_name = data_root_path + "meshes/veg/" + mdl_name;
vloginfo("resolved model name to [%s]", mdl_name.cptr());
}
vloginfo("Begin to read vega file from: %s", mdl_name.cptr());
bool res = VolMeshIO::readVega(temp, mdl_name);
if(!res)
vlogerror("Unable to load mesh from: %s", mdl_name.cptr());
}
vloginfo("Loaded mesh to temp");
g_lpTissue = new CuttableMesh(*temp);
g_lpTissue->setFlagSplitMeshAfterCut(true);
g_lpTissue->setFlagDrawNodes(true);
g_lpTissue->setFlagDrawWireFrame(false);
g_lpTissue->setFlagDrawSweepSurf(ini.readBool("visible", "sweepsurf"));
g_lpTissue->setColor(Color::skin());
g_lpTissue->setVerbose(g_parser.value_to_int("verbose") != 0);
g_lpTissue->syncRender();
SAFE_DELETE(temp);
TheEngine::Instance().add(g_lpTissue);
if(g_parser.value_to_int("ringscalpel") == 1)
g_lpRing->setTissue(g_lpTissue);
else
g_lpScalpel->setTissue(g_lpTissue);
//print stats
VolMeshStats::printAllStats(g_lpTissue);
vloginfo("mesh load completed");
}