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


C++ Directory::Filename方法代码示例

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


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

示例1: SetTextureData

void Image::SetTextureData(ImageData *ImgInfo, bool Reassign)
{
    if (Reassign) Destroy();

    CreateTexture(); // Make sure our texture exists.
    Bind();

    if (ImgInfo->Data == nullptr && !Reassign)
    {
        return;
    }

    if (!TextureAssigned || Reassign) // We haven't set any data to this texture yet, or we want to regenerate storage
    {
        TextureAssigned = true;
        Directory Dir = ImgInfo->Filename;
        Dir = Dir.Filename();

        glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
        if (!Configuration::TextureParameterExists(Dir, "gen-mipmap") || Configuration::GetTextureParameter(Dir, "gen-mipmap") == "true")
            glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);

        GLint param;
        switch (ImgInfo->WrapMode)
        {
        case ImageData::WM_CLAMP_TO_EDGE:
            param = GL_CLAMP_TO_EDGE;
            break;
        case ImageData::WM_REPEAT:
            param = GL_REPEAT;
            break;
        default:
            param = GL_CLAMP_TO_EDGE;
        }

        GLint wrapS = param, wrapT = param;
        if (Configuration::GetTextureParameter(Dir, "wrap-s") == "clamp-edge")
            wrapS = GL_CLAMP_TO_EDGE;
        else if (Configuration::GetTextureParameter(Dir, "wrap-s") == "repeat")
            wrapS = GL_REPEAT;
        else if (Configuration::GetTextureParameter(Dir, "wrap-s") == "clamp-border")
            wrapS = GL_CLAMP_TO_BORDER;
        else if (Configuration::GetTextureParameter(Dir, "wrap-s") == "repeat-mirrored")
            wrapS = GL_MIRRORED_REPEAT;

        if (Configuration::GetTextureParameter(Dir, "wrap-t") == "clamp-edge")
            wrapT = GL_CLAMP_TO_EDGE;
        else if (Configuration::GetTextureParameter(Dir, "wrap-t") == "repeat")
            wrapT = GL_REPEAT;
        else if (Configuration::GetTextureParameter(Dir, "wrap-t") == "clamp-border")
            wrapT = GL_CLAMP_TO_BORDER;
        else if (Configuration::GetTextureParameter(Dir, "wrap-t") == "repeat-mirrored")
            wrapT = GL_MIRRORED_REPEAT;

        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapS);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapT);

        GLint minparam;
        switch (ImgInfo->ScalingMode)
        {
        case ImageData::SM_LINEAR:
            minparam = GL_LINEAR;
            param = GL_LINEAR;
            break;
        case ImageData::SM_MIPMAP:
            minparam = GL_LINEAR_MIPMAP_LINEAR;
            param = GL_LINEAR;
            break;
        case ImageData::SM_NEAREST:
            minparam = GL_NEAREST;
            param = GL_NEAREST;
            break;
        default:
            minparam = GL_LINEAR_MIPMAP_LINEAR;
            param = GL_LINEAR;
        }

        GLint minp = minparam, maxp = param;
        if (Configuration::GetTextureParameter(Dir, "minfilter") == "linear")
            minp = GL_LINEAR;
        else if (Configuration::GetTextureParameter(Dir, "minfilter") == "nearest")
            minp = GL_NEAREST;
        else if (Configuration::GetTextureParameter(Dir, "minfilter") == "linear-mipmap-linear")
            minp = GL_LINEAR_MIPMAP_LINEAR;
        else if (Configuration::GetTextureParameter(Dir, "minfilter") == "linear-mipmap-nearest")
            minp = GL_LINEAR_MIPMAP_NEAREST;
        else if (Configuration::GetTextureParameter(Dir, "minfilter") == "nearest-mipmap-nearest")
            minp = GL_NEAREST_MIPMAP_NEAREST;
        else if (Configuration::GetTextureParameter(Dir, "minfilter") == "nearest-mipmap-linear")
            minp = GL_NEAREST_MIPMAP_LINEAR;

        if (Configuration::GetTextureParameter(Dir, "maxfilter") == "linear")
            maxp = GL_LINEAR;
        else if (Configuration::GetTextureParameter(Dir, "maxfilter") == "nearest")
            maxp = GL_NEAREST;
        else if (Configuration::GetTextureParameter(Dir, "maxfilter") == "linear-mipmap-linear")
            maxp = GL_LINEAR_MIPMAP_LINEAR;
        else if (Configuration::GetTextureParameter(Dir, "maxfilter") == "linear-mipmap-nearest")
            maxp = GL_LINEAR_MIPMAP_NEAREST;
        else if (Configuration::GetTextureParameter(Dir, "maxfilter") == "nearest-mipmap-nearest")
//.........这里部分代码省略.........
开发者ID:mechacrash,项目名称:raindrop,代码行数:101,代码来源:ImageLoader.cpp


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