本文整理汇总了C++中sf::RenderTexture类的典型用法代码示例。如果您正苦于以下问题:C++ RenderTexture类的具体用法?C++ RenderTexture怎么用?C++ RenderTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderTexture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: render
void Light::render( sf::RenderTexture& target )
{
if (mOnOff == true)
{
if(mDirection == RIGHT)
mSprite.setTextureRect(sf::IntRect (mRect.width*(int)mAnimationTimer, mAnimationPicY * mRect.height,mRect.width,mRect.height));
else if(mDirection == LEFT)
mSprite.setTextureRect(sf::IntRect(mRect.width*((int)mAnimationTimer+1),mAnimationPicY * mRect.height,-mRect.width,mRect.height));
if(mAddBlend)
{
target.draw( mSprite, sf::BlendAdd );
}
else
{
target.draw( mSprite );
}
}
}
开发者ID:Sebbish,项目名称:Lucid,代码行数:19,代码来源:Light.cpp
示例17: sprite
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);
}
}
开发者ID:TideSofDarK,项目名称:LudumDare27,代码行数:20,代码来源:ShaderManager.cpp
示例18: apply
void BloomEffect::apply(const sf::RenderTexture& input, sf::RenderTarget& output)
{
prepareTextures(input.getSize());
filterBright(input, mBrightnessTexture);
downsample(mBrightnessTexture, mFirstPassTextures[0]);
blurMultipass(mFirstPassTextures);
downsample(mFirstPassTextures[0], mSecondPassTextures[0]);
blurMultipass(mSecondPassTextures);
add(mFirstPassTextures[0], mSecondPassTextures[0], mFirstPassTextures[1]);
mFirstPassTextures[1].display();
add(input, mFirstPassTextures[1], output);
}
开发者ID:lovesonw,项目名称:plane,代码行数:12,代码来源:BloomEffect.cpp
示例19: adjustRenderTexture
void GuiElement::adjustRenderTexture(sf::RenderTexture& texture)
{
P<WindowManager> window_manager = engine->getObject("windowManager");
//Hack the rectangle for this element so it sits perfectly on pixel boundaries.
sf::Vector2f half_pixel = (window_manager->mapPixelToCoords(sf::Vector2i(1, 1)) - window_manager->mapPixelToCoords(sf::Vector2i(0, 0))) / 2.0f;
sf::Vector2f top_left = window_manager->mapPixelToCoords(window_manager->mapCoordsToPixel(sf::Vector2f(rect.left, rect.top) + half_pixel));
sf::Vector2f bottom_right = window_manager->mapPixelToCoords(window_manager->mapCoordsToPixel(sf::Vector2f(rect.left + rect.width, rect.top + rect.height) + half_pixel));
rect.left = top_left.x;
rect.top = top_left.y;
rect.width = bottom_right.x - top_left.x;
rect.height = bottom_right.y - top_left.y;
sf::Vector2i texture_size = window_manager->mapCoordsToPixel(sf::Vector2f(rect.width, rect.height) + half_pixel) - window_manager->mapCoordsToPixel(sf::Vector2f(0, 0));
unsigned int sx = powerOfTwo(texture_size.x);
unsigned int sy = powerOfTwo(texture_size.y);
if (texture.getSize().x != sx && texture.getSize().y != sy)
{
texture.create(sx, sy, false);
}
//Set the view so it covers this elements normal rect. So we can draw exactly the same on this texture as no the normal screen.
sf::View view(rect);
view.setViewport(sf::FloatRect(0, 0, float(texture_size.x) / float(sx), float(texture_size.y) / float(sy)));
texture.setView(view);
}
开发者ID:InterestingJohn,项目名称:EmptyEpsilon,代码行数:24,代码来源:gui2_element.cpp
示例20: Apply
void BloomEffect::Apply( const sf::RenderTexture& input, sf::RenderTarget& output )
{
pImpl->PrepareTextures( input.getSize() );
pImpl->FilterBright( input, pImpl->mBrightnessTexture );
pImpl->Downsample( pImpl->mBrightnessTexture, pImpl->mFirstPassTextures[ 0 ] );
pImpl->BlurMultipass( pImpl->mFirstPassTextures );
pImpl->Downsample( pImpl->mFirstPassTextures[ 0 ], pImpl->mSecondPassTextures[ 0 ] );
pImpl->BlurMultipass( pImpl->mSecondPassTextures );
pImpl->Add( pImpl->mFirstPassTextures[ 0 ], pImpl->mSecondPassTextures[ 0 ], pImpl->mFirstPassTextures[ 1 ] );
pImpl->mFirstPassTextures[ 1 ].display();
pImpl->Add( input, pImpl->mFirstPassTextures[ 1 ], output );
}
开发者ID:chehob,项目名称:SFMLDev,代码行数:16,代码来源:BloomEffect.cpp
注:本文中的sf::RenderTexture类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论