本文整理汇总了C++中sf::RenderTexture::getTexture方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderTexture::getTexture方法的具体用法?C++ RenderTexture::getTexture怎么用?C++ RenderTexture::getTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::RenderTexture
的用法示例。
在下文中一共展示了RenderTexture::getTexture方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
void PostBloom::add(const sf::RenderTexture& src, const sf::RenderTexture& bloom, sf::RenderTarget& dst)
{
auto& shader = m_shaderResource.get(Shader::Type::PostAdditiveBlend);
shader.setParameter("u_sourceTexture", src.getTexture());
shader.setParameter("u_bloomTexture", bloom.getTexture());
applyShader(shader, dst);
}
示例2: 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);
}
示例3: 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();
}
示例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();
}
示例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();
}
示例6: 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();
}
示例7: 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);
}
示例8: 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();
}
示例9: 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();
}
示例10: vertices
void draw (sf::RenderTarget & target, sf::RenderStates states = sf::RenderStates::Default) const
{
lightBuffer.clear();
texture.display();
states.texture = &texture.getTexture();
for (const auto & light : lights)
{
light.draw(lightBuffer, getView(), states);
}
sf::Vector2f dimensions = sf::Vector2f(texture.getSize());
sf::VertexArray vertices(sf::Quads, 4);
vertices[0] = sf::Vertex(sf::Vector2f(0.f, 0.f), sf::Color(255, 255, 255, minAlpha), sf::Vector2f(0.f, 0.f));
vertices[1] = sf::Vertex(sf::Vector2f(dimensions.x, 0.f), sf::Color(255, 255, 255, minAlpha), sf::Vector2f(dimensions.x, 0.f));
vertices[2] = sf::Vertex(dimensions, sf::Color(255, 255, 255, minAlpha), dimensions);
vertices[3] = sf::Vertex(sf::Vector2f(0.f, dimensions.y), sf::Color(255, 255, 255, minAlpha), sf::Vector2f(0.f, dimensions.y));
lightBuffer.draw(vertices, states);
lightBuffer.display();
target.draw(sf::Sprite(lightBuffer.getTexture()));
}
示例11: draw
void ShaderManager::draw(sf::RenderTexture &rt, sf::RenderTarget &target)
{
sf::Sprite sprite(rt.getTexture());
sf::RenderTexture tempRenderTexture;
tempRenderTexture.create(WIDTH, HEIGHT);
if (mWorking)
{
mShader.setParameter("texture", rt.getTexture());
tempRenderTexture.draw(sprite, &mVingette);
sf::Sprite tempSpr(tempRenderTexture.getTexture());
target.draw(tempSpr, &mShader);
}
else
{
mVingette.setParameter("texture", rt.getTexture());
target.draw(sprite, &mVingette);
}
}
示例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);
}
示例13: drawRenderTexture
void GuiElement::drawRenderTexture(sf::RenderTexture& texture, sf::RenderTarget& window, sf::Color color, const sf::RenderStates& states)
{
texture.display();
sf::Sprite sprite(texture.getTexture());
sprite.setTextureRect(sf::IntRect(0, 0, texture.getSize().x * texture.getView().getViewport().width, texture.getSize().y * texture.getView().getViewport().height));
sprite.setColor(color);
sprite.setPosition(rect.left, rect.top);
sprite.setScale(rect.width / float(texture.getSize().x * texture.getView().getViewport().width), rect.height / float(texture.getSize().y * texture.getView().getViewport().height));
window.draw(sprite, states);
}
示例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++;
}
示例15:
Application() :
m_window(sf::VideoMode(300, 300), "Flashlight!"),
m_layer(),
m_rect(sf::Vector2f(100.f, 100.f)),
m_pos(0.f, 0.f)
{
m_window.setFramerateLimit(60);
m_window.setMouseCursorVisible(false);
m_layer.create(300, 300);
m_flashlightTexture.create(60, 60);
// We want to have semi-transparent edges.
generateSpot();
m_flashlight.setTexture(m_flashlightTexture.getTexture(), true);
m_flashlight.setPosition(150.f, 150.f);
m_flashlight.setOrigin(30.f, 30.f);
m_rect.setFillColor(sf::Color::Red);
m_rect.setPosition(100.f, 100.f);
m_sprite.setTexture(m_layer.getTexture());
}