当前位置: 首页>>代码示例>>C++>>正文


C++ AnsiStr::c_str方法代码示例

本文整理汇总了C++中AnsiStr::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ AnsiStr::c_str方法的具体用法?C++ AnsiStr::c_str怎么用?C++ AnsiStr::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnsiStr的用法示例。


在下文中一共展示了AnsiStr::c_str方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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");
}
开发者ID:GraphicsEmpire,项目名称:tetcutter,代码行数:81,代码来源:main.cpp


注:本文中的AnsiStr::c_str方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。