Пример #1
0
void Material::textureDidStartLoading(Texture::Pointer t)
{
	ET_ASSERT(t.valid());
	
#if (ET_DEBUG)
	bool pendingTextureFound = false;
	
	for (uint32_t i = 0; i < MaterialParameter_max; ++i)
	{
		if ((_defaultTextureParameters[i].value == t) && (_texturesToLoad.count(i) > 0))
		{
			pendingTextureFound = true;
			break;
		}
	}
	

	for (const auto& p : _customTextureParameters)
	{
		if ((p.second == t) && (_texturesToLoad.count(p.first) > 0))
		{
			pendingTextureFound = true;
			break;
		}
	}
	
	ET_ASSERT(pendingTextureFound);
#endif
}
Пример #2
0
void Material::textureDidLoad(Texture::Pointer t)
{
	ET_ASSERT(t.valid());
	
	uint32_t invalidParameter = static_cast<uint32_t>(-1);
	uint32_t param = invalidParameter;
	
	for (uint32_t i = 0; i < MaterialParameter_max; ++i)
	{
		if ((_defaultTextureParameters[i].value == t) && (_texturesToLoad.count(i) > 0))
		{
			param = i;
			break;
		}
	}
	
	if (param == invalidParameter)
	{
		for (const auto& p : _customTextureParameters)
		{
			if ((p.second == t) && (_texturesToLoad.count(p.first) > 0))
			{
				param = p.first;
				break;
			}
		}
	}
	
	ET_ASSERT(param != invalidParameter);
	
	_texturesToLoad.erase(param);
	
	if (_texturesToLoad.size() == 0)
		loaded.invokeInMainRunLoop(this);
}
Пример #3
0
void RenderState::bindTexture(uint32_t unit, const Texture::Pointer& texture, bool force)
{
#if !defined(ET_CONSOLE_APPLICATION)
	if (texture.valid())
		bindTexture(unit, static_cast<uint32_t>(texture->apiHandle()), texture->target(), force);
	else
		bindTexture(unit, 0, TextureTarget::Texture_2D, force);
#endif
}
Пример #4
0
void Framebuffer::setCurrentRenderTarget(const Texture::Pointer& texture)
{
	ET_ASSERT(texture.valid());
	attachTexture(texture, GL_COLOR_ATTACHMENT0);
}