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


C++ RenderTexture::getTexture方法代码示例

本文整理汇总了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);
}
开发者ID:JonnyPtn,项目名称:pseuthe,代码行数:8,代码来源:PostBloom.cpp

示例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);
}
开发者ID:mebobby2,项目名称:SFML_Game_Development,代码行数:8,代码来源:BloomEffect.cpp

示例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();
}
开发者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: 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

示例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);
}
开发者ID:JonnyPtn,项目名称:xygine,代码行数:11,代码来源:PostChromeAb.cpp

示例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();
}
开发者ID:JonnyPtn,项目名称:xygine,代码行数:10,代码来源:PostBloom.cpp

示例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();
}
开发者ID:JonnyPtn,项目名称:xygine,代码行数:10,代码来源:PostBloom.cpp

示例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()));
		}
开发者ID:DeMoully,项目名称:SFML_Extensions,代码行数:19,代码来源:LightMap.hpp

示例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);
	}
}
开发者ID:TideSofDarK,项目名称:LudumDare27,代码行数:20,代码来源:ShaderManager.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: 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);
}
开发者ID:InterestingJohn,项目名称:EmptyEpsilon,代码行数:11,代码来源:gui2_element.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:

	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());
	}
开发者ID:saurabh1907,项目名称:2D-RPG-Game,代码行数:24,代码来源:lights.cpp


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