本文整理汇总了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();
}
示例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);
}
}
示例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);
}
示例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: 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);
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
示例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: 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();
}
示例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: 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);
}