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


C++ sf::RenderTexture类代码示例

本文整理汇总了C++中sf::RenderTexture的典型用法代码示例。如果您正苦于以下问题:C++ RenderTexture类的具体用法?C++ RenderTexture怎么用?C++ RenderTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: filterBright

void BloomEffect::filterBright(const sf::RenderTexture& input, sf::RenderTexture& output)
{
	sf::Shader& brightness = mShaders.get(Shaders::BrightnessPass);
	brightness.setParameter("source", input.getTexture());
	applyShader(brightness, output);
	output.display();
}
开发者ID:lovesonw,项目名称:plane,代码行数:7,代码来源:BloomEffect.cpp

示例2: renderString

void renderString(sf::RenderTexture& tex, sf::Font& font, const wstring& str, int x, int y, int fitInto = 0) {
    if (fitInto) {
        sf::Text text;
        text.setFont(font);
        text.setString(str);

        int s = 100;
        text.setCharacterSize(s);
        while (text.getLocalBounds().height > fitInto)
            text.setCharacterSize(--s);

        text.setString(sf::String(str));
        text.setColor(sf::Color::White);
        text.setPosition(x, y);
        tex.draw(text);
    }
    else {
        sf::Text text;
        text.setFont(font);
        text.setString(sf::String(str));
        text.setCharacterSize(100);
        text.setColor(sf::Color::White);
        text.setPosition(x, y);
        tex.draw(text);
    }
}
开发者ID:LehdaRi,项目名称:LaystakeSofta,代码行数:26,代码来源:main.cpp

示例3: add

void BloomEffect::add(const sf::RenderTexture& source, const sf::RenderTexture& bloom, sf::RenderTarget& output)
{
	sf::Shader& adder = mShaders.get(Shaders::AddPass);
	adder.setParameter("source", source.getTexture());
	adder.setParameter("bloom", bloom.getTexture());
	applyShader(adder, output);
}
开发者ID:lovesonw,项目名称:plane,代码行数:7,代码来源:BloomEffect.cpp

示例4: downsample

void BloomEffect::downsample(const sf::RenderTexture& input, sf::RenderTexture& output)
{
	sf::Shader& downSampler = mShaders.get(Shaders::DownSamplePass);
	downSampler.setParameter("source", input.getTexture());
	downSampler.setParameter("sourceSize", sf::Vector2f(input.getSize()));
	applyShader(downSampler, output);
	output.display();
}
开发者ID:lovesonw,项目名称:plane,代码行数:8,代码来源:BloomEffect.cpp

示例5: blur

void BloomEffect::blur(const sf::RenderTexture& input, sf::RenderTexture& output, sf::Vector2f offsetFactor)
{
	sf::Shader& gaussianBlur = mShaders.get(Shaders::GaussianBlurPass);
	gaussianBlur.setParameter("source", input.getTexture());
	gaussianBlur.setParameter("offsetFactor", offsetFactor);
	applyShader(gaussianBlur, output);
	output.display();
}
开发者ID:lovesonw,项目名称:plane,代码行数:8,代码来源:BloomEffect.cpp

示例6: add

void PostBloom::add(const sf::RenderTexture& src, const sf::RenderTexture& bloom, sf::RenderTarget& dst)
{
    auto& shader = m_shaderResource.get(Shader::AdditiveBlend);

    shader.setUniform("u_sourceTexture", src.getTexture());
    shader.setUniform("u_bloomTexture", bloom.getTexture());
    applyShader(shader, dst);
}
开发者ID:JonnyPtn,项目名称:xygine,代码行数:8,代码来源:PostBloom.cpp

示例7: filterBright

void PostBloom::filterBright(const sf::RenderTexture& src, sf::RenderTexture& dst)
{
    auto& shader = m_shaderResource.get(Shader::BrightnessExtract);

    shader.setUniform("u_sourceTexture", src.getTexture());
    applyShader(shader, dst);
    dst.display();
}
开发者ID:JonnyPtn,项目名称:xygine,代码行数:8,代码来源:PostBloom.cpp

示例8: apply

//public
void PostChromeAb::apply(const sf::RenderTexture& src, sf::RenderTarget& dst)
{
    float windowRatio = static_cast<float>(dst.getSize().y) / static_cast<float>(src.getSize().y);

    m_shader.setUniform("u_sourceTexture", src.getTexture());
    m_shader.setUniform("u_time", accumulatedTime * (10.f * windowRatio));
    m_shader.setUniform("u_lineCount", windowRatio  * scanlineCount);

    applyShader(m_shader, dst);
}
开发者ID:JonnyPtn,项目名称:xygine,代码行数:11,代码来源:PostChromeAb.cpp

示例9: blur

void PostBloom::blur(const sf::RenderTexture& src, sf::RenderTexture& dst, const sf::Vector2f& offset)
{
    auto& shader = m_shaderResource.get(Shader::GaussianBlur);

    shader.setUniform("u_sourceTexture", src.getTexture());
    shader.setUniform("u_offset", offset);

    applyShader(shader, dst);
    dst.display();
}
开发者ID:JonnyPtn,项目名称:xygine,代码行数:10,代码来源:PostBloom.cpp

示例10: downSample

void PostBloom::downSample(const sf::RenderTexture& src, sf::RenderTexture& dst)
{
    auto& shader = m_shaderResource.get(Shader::DownSample);

    shader.setUniform("u_sourceTexture", src.getTexture());
    shader.setUniform("u_sourceSize", sf::Vector2f(src.getSize()));

    applyShader(shader, dst);
    dst.display();
}
开发者ID:JonnyPtn,项目名称:xygine,代码行数:10,代码来源:PostBloom.cpp

示例11: render

bool AppState::render(sf::RenderTexture& texture, int frame)
{
  texture.clear();

  if (m_preDesktopRenderFunctor) m_preDesktopRenderFunctor(texture, frame);
  the_desktop.render(texture, frame);
  if (m_postDesktopRenderFunctor) m_postDesktopRenderFunctor(texture, frame);

  texture.display();
  return true;
}
开发者ID:glindsey,项目名称:MetaHack,代码行数:11,代码来源:AppState.cpp

示例12: apply

//public
void PostChromeAb::apply(const sf::RenderTexture& src, sf::RenderTarget& dst)
{
    float windowRatio = static_cast<float>(dst.getSize().y) / static_cast<float>(src.getSize().y);

    auto& shader = m_shaderResource.get(Shader::Type::PostChromeAb);
    shader.setParameter("u_sourceTexture", src.getTexture());
    shader.setParameter("u_time", accumulatedTime * (10.f * windowRatio));
    shader.setParameter("u_lineCount", windowRatio  * scanlineCount);

    applyShader(shader, dst);
}
开发者ID:JonnyPtn,项目名称:pseuthe,代码行数:12,代码来源:PostChromeAb.cpp

示例13: MakeTexture

void Layer::MakeTexture(sf::RenderTexture& textureImage) const {
	if (WidthPixels == textureImage.getSize().x && HeightPixels == textureImage.getSize().y) { //layer is big enough to support creating a textured background from... if not, the texture will be left fully black
		VertexVector vertices[NUMBEROFTILESETTEXTURES]; //don't reuse Layer::Vertices, in case this layer needs to get drawn soon

		for (int x = 0; x < Width; ++x)
			for (int y = 0; y < Height; ++y)
				DrawTileToVertexArrays(vertices, x,y);

		for (int i = 0; i < NUMBEROFTILESETTEXTURES; ++i)
			if (!vertices[i].empty())
				textureImage.draw(vertices[i].data(), vertices[i].size(), OpenGLPrimitive, LevelPtr->TilesetPtr->TileImages[i]);
	}
	textureImage.display();
}
开发者ID:Violet-CLM,项目名称:Bunny-Game,代码行数:14,代码来源:Layer.cpp

示例14: record

//writes frames to file 
//directory must already exist
void record(sf::RenderTexture& in, int frameskip, std::string directory) {

	static int frame = 0;

	if(frameskip > 0 && frame % frameskip == 0) {
		in.display();
		sf::Texture outTx = in.getTexture();
		sf::Image outImg = outTx.copyToImage();
		std::stringstream ugh;
		ugh << directory << "/" << frame << ".png";
		outImg.saveToFile(ugh.str());
	}
	frame++;
}
开发者ID:huseinz,项目名称:polargrapher,代码行数:16,代码来源:polargrapher.cpp

示例15: draw

void Champion::draw(sf::RenderTexture &texture)
{
    sf::CircleShape championShape(10);
    championShape.setPosition(_location.x - 10, _location.y - 10);
    championShape.setFillColor(sf::Color(99, 184, 255));
    texture.draw(championShape);
}
开发者ID:Invincibloobles,项目名称:League,代码行数:7,代码来源:Champion.cpp


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