Renderer/RenderTexture: Fix Detach() not removing color targets

Former-commit-id: 058d95e1952f2316333be380cb6418c121db4a32
This commit is contained in:
Lynix 2015-07-05 23:25:12 +02:00
parent c0ee9d04b5
commit 5556c38901
1 changed files with 9 additions and 6 deletions

View File

@ -154,9 +154,6 @@ bool NzRenderTexture::AttachBuffer(nzAttachmentPoint attachmentPoint, nzUInt8 in
InvalidateSize();
InvalidateTargets();
if (attachmentPoint == nzAttachmentPoint_Color && !m_impl->userDefinedTargets)
m_impl->colorTargets.push_back(index);
return true;
}
@ -291,9 +288,6 @@ bool NzRenderTexture::AttachTexture(nzAttachmentPoint attachmentPoint, nzUInt8 i
InvalidateSize();
InvalidateTargets();
if (attachmentPoint == nzAttachmentPoint_Color && !m_impl->userDefinedTargets)
m_impl->colorTargets.push_back(index);
return true;
}
@ -828,6 +822,15 @@ void NzRenderTexture::UpdateSize() const
void NzRenderTexture::UpdateTargets() const
{
if (!m_impl->userDefinedTargets)
{
m_impl->colorTargets.clear();
unsigned int colorIndex = 0;
for (unsigned int index = attachmentIndex[nzAttachmentPoint_Color]; index < m_impl->attachments.size(); ++index)
m_impl->colorTargets.push_back(colorIndex++);
}
if (m_impl->colorTargets.empty())
{
m_impl->drawBuffers.resize(1);