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


C++ LineSplitter::get_tokens方法代码示例

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


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

示例1: UnsupportedChunk_Ascii

// ------------------------------------------------------------------------------------------------
void COBImporter::ReadMat1_Ascii(Scene& out, LineSplitter& splitter, const ChunkInfo& nfo)
{
    if(nfo.version > 8) {
        return UnsupportedChunk_Ascii(splitter,nfo,"Mat1");
    }

    ++splitter;
    if (!splitter.match_start("mat# ")) {
        ASSIMP_LOG_WARN_F( "Expected `mat#` line in `Mat1` chunk ", nfo.id );
        return;
    }

    out.materials.push_back(Material());
    Material& mat = out.materials.back();
    mat = nfo;

    mat.matnum = strtoul10(splitter[1]);
    ++splitter;

    if (!splitter.match_start("shader: ")) {
        ASSIMP_LOG_WARN_F( "Expected `mat#` line in `Mat1` chunk ", nfo.id);
        return;
    }
    std::string shader = std::string(splitter[1]);
    shader = shader.substr(0,shader.find_first_of(" \t"));

    if (shader == "metal") {
        mat.shader = Material::METAL;
    }
    else if (shader == "phong") {
        mat.shader = Material::PHONG;
    }
    else if (shader != "flat") {
        ASSIMP_LOG_WARN_F( "Unknown value for `shader` in `Mat1` chunk ", nfo.id );
    }

    ++splitter;
    if (!splitter.match_start("rgb ")) {
        ASSIMP_LOG_WARN_F( "Expected `rgb` line in `Mat1` chunk ", nfo.id);
    }

    const char* rgb = splitter[1];
    ReadFloat3Tuple_Ascii(mat.rgb,&rgb);

    ++splitter;
    if (!splitter.match_start("alpha ")) {
        ASSIMP_LOG_WARN_F( "Expected `alpha` line in `Mat1` chunk ", nfo.id);
    }

    const char* tokens[10];
    splitter.get_tokens(tokens);

    mat.alpha   = fast_atof( tokens[1] );
    mat.ka      = fast_atof( tokens[3] );
    mat.ks      = fast_atof( tokens[5] );
    mat.exp     = fast_atof( tokens[7] );
    mat.ior     = fast_atof( tokens[9] );
}
开发者ID:H-EAL,项目名称:assimp,代码行数:59,代码来源:COBLoader.cpp

示例2: ReadChunkInfo_Ascii

// ------------------------------------------------------------------------------------------------
void COBImporter::ReadChunkInfo_Ascii(ChunkInfo& out, const LineSplitter& splitter)
{
    const char* all_tokens[8];
    splitter.get_tokens(all_tokens);

    out.version = (all_tokens[1][1]-'0')*100+(all_tokens[1][3]-'0')*10+(all_tokens[1][4]-'0');
    out.id  = strtoul10(all_tokens[3]);
    out.parent_id = strtoul10(all_tokens[5]);
    out.size = strtol10(all_tokens[7]);
}
开发者ID:mrcrr8614,项目名称:assimp,代码行数:11,代码来源:COBLoader.cpp


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