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


C++ FilePath::str方法代码示例

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


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

示例1: storeFramebuffer

inline void storeFramebuffer(int resultIndex,
                             const FilePath& pngDir,
                             const FilePath& exrDir,
                             const FilePath& baseName,
                             float gamma,
                             const Framebuffer& framebuffer) {
    // Create output directories in case they don't exist
    createDirectory(pngDir.str());
    createDirectory(exrDir.str());

    // Path of primary output image files
    FilePath pngFile = pngDir + baseName.addExt(".png");
    FilePath exrFile = exrDir + baseName.addExt(".exr");

    // Make a copy of the image
    Image copy = framebuffer.getChannel(0);
    // Store the EXR image "as is"
    storeEXRImage(exrFile.str(), copy);

    // Post-process copy of image and store PNG file
    copy.flipY();
    copy.divideByAlpha();
    copy.applyGamma(gamma);
    storeImage(pngFile.str(), copy);

    // Store complete framebuffer as a single EXR multi layer image
    auto exrFramebufferFilePath = exrDir + baseName.addExt(".bnzframebuffer.exr");
    storeEXRFramebuffer(exrFramebufferFilePath.str(), framebuffer);

    // Store complete framebuffer as PNG indivual files in a dediacted subdirectory
    auto pngFramebufferDirPath = pngDir + "framebuffers/";
    createDirectory(pngFramebufferDirPath.str());
    if(resultIndex >= 0) {
        pngFramebufferDirPath = pngFramebufferDirPath + toString3(resultIndex); // Split different results of the same batch in different subdirectories
    }
    createDirectory(pngFramebufferDirPath.str());

    // Store each channel of the framebuffer
    for(auto i = 0u; i < framebuffer.getChannelCount(); ++i) {
        auto name = framebuffer.getChannelName(i);
        // Prefix by the index of the channel
        FilePath pngFile = pngFramebufferDirPath + FilePath(toString3(i)).addExt("_" + name + ".png");

        auto copy = framebuffer.getChannel(i);

        copy.flipY();
        copy.divideByAlpha();

        copy.applyGamma(gamma);
        storeImage(pngFile.str(), copy);
    }
}
开发者ID:Celeborn2BeAlive,项目名称:pg2015-code,代码行数:52,代码来源:PG15RendererManager.hpp

示例2: save

void AnimInfo::save(const FilePath& path) {
    FILE* file = fopen(path.str(), "w");
    if (!file) {
        printf("cannot open for write \"%s\"\n", path.str());
        return;
    }
    fprintf(file, "%s", _tex_name.c_str());
    for (int i = 0; i < _frames.size(); i++) {
        Frame& frame = _frames[i];
        fprintf(file, "\n%d %d %d %d %d %d", frame.x(), frame.y(), frame.w(), frame.h(), frame.dx(), frame.dy());
    }
    fclose(file);
}
开发者ID:Kracav4ik,项目名称:jnb-sfml,代码行数:13,代码来源:frame_animation.cpp

示例3: initResultDir

    PG15RendererManager(const Scene& scene, const Sensor& sensor,
                        Vec2u framebufferSize, const FilePath& referenceImagePath,
                        const FilePath& resultPath,
                        tinyxml2::XMLDocument& configDoc,
                        tinyxml2::XMLDocument& sceneDoc,
                        float gamma,
                        std::size_t renderTimeMsOrIterationCount,
                        std::size_t maxPathDepth,
                        std::size_t resamplingPathCount,
                        const PG15ICBPTSettings& icBPTSettings,
                        const std::vector<PG15SkelBPTSettings>& skelBPTSettings,
                        bool equalTime):
        m_ResultPath(resultPath),
        m_Params(scene, sensor, framebufferSize, maxPathDepth, resamplingPathCount),
        m_SharedData(framebufferSize.x * framebufferSize.y, m_Params.m_nMaxDepth - 1u),
        m_pReferenceImage(loadEXRImage(referenceImagePath.str())),
        m_ICBPTRenderer(m_Params, m_SharedData, icBPTSettings),
        m_RenderStatistics(2 + skelBPTSettings.size()),
        m_fGamma(gamma),
        m_nRenderTimeMsOrIterationCount(renderTimeMsOrIterationCount),
        m_bEqualTime(equalTime) {

        for(const auto& settings: skelBPTSettings) {
            m_SkelBPTRenderers.emplace_back(m_Params, m_SharedData, settings);
        }

        m_Rng.init(getSystemThreadCount(), m_nSeed);

        m_SharedData.m_LightSampler.initFrame(scene);

        initResultDir(configDoc, sceneDoc);
    }
开发者ID:Celeborn2BeAlive,项目名称:pg2015-code,代码行数:32,代码来源:PG15RendererManager.hpp

示例4: loadProgramShader

// Load source code from files and build a GLSL program
Program loadProgramShader(const FilePath& vsFile, const FilePath& fsFile) {
	Shader vs = loadShader(GL_VERTEX_SHADER, vsFile);
	Shader fs = loadShader(GL_FRAGMENT_SHADER, fsFile);
	
	if(!vs.compile()) {
		throw std::runtime_error("Compilation error for vertex shader (from file " + std::string(vsFile) + "): " + vs.getInfoLog());
	}

	if(!fs.compile()) {
		throw std::runtime_error("Compilation error for fragment shader (from file " + std::string(fsFile) + "): " + fs.getInfoLog());
	}

	Program program;
	program.attachShader(vs);
	program.attachShader(fs);

	if(!program.link()) {
        throw std::runtime_error("Link error (for files " + vsFile.str() + " and " + fsFile.str() + "): " + program.getInfoLog());
	}

	return program;
}
开发者ID:quentinCo,项目名称:Bay-1,代码行数:23,代码来源:Program.cpp

示例5: loadShader

Shader loadShader(GLenum type, const FilePath& filepath) {
    std::ifstream input(filepath.c_str());
    if(!input) {
        throw std::runtime_error("Unable to load the file " + filepath.str());
    }

    std::stringstream buffer;
    buffer << input.rdbuf();

    Shader shader(type);
    shader.setSource(buffer.str().c_str());

    return shader;
}
开发者ID:Hisuuu,项目名称:musicraft,代码行数:14,代码来源:Shader.cpp

示例6: load

void AnimInfo::load(const FilePath& path) {
    TextFile file(path);
    if (!file.open()) {
        printf("cannot open for read \"%s\"\n", path.str());
        return;
    }
    clear();

    _tex_name = strip(file.read_line());
    std::string current_frame = file.read_line();

    while (!current_frame.empty()) {
        std::string result;
        std::vector<int> results;
        for (int i = 0; i < current_frame.size(); i++) {
            char c = current_frame[i];
            if (c == ' ' || c == '\n') {
                results.push_back(atoi(result.c_str()));
                result = "";
                continue;
            }
            result.push_back(c);
        }
        if (!result.empty()) {
            results.push_back(atoi(result.c_str()));
        }
        int xx = results[0];
        int yy = results[1];
        int w = results[2];
        int h = results[3];
        int dx = results[4];
        int dy = results[5];
        _frames.push_back(Frame(xx, yy, w, h, dx, dy));
        current_frame = file.read_line();
    }
}
开发者ID:Kracav4ik,项目名称:jnb-sfml,代码行数:36,代码来源:frame_animation.cpp


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