Added TriangleIterator::Unmap()

Former-commit-id: 8ef858c5374c6701c087d0f4b1644bb6704e1131
This commit is contained in:
Lynix 2013-01-04 16:32:14 +01:00
parent be7afed144
commit 5eac4de406
3 changed files with 15 additions and 5 deletions

View File

@ -34,6 +34,8 @@ class NAZARA_API NzTriangleIterator
void SetTangent(unsigned int i, const NzVector3f& tangent);
void SetTexCoords(unsigned int i, const NzVector2f& texCoords);
void Unmap();
private:
nzPrimitiveType m_primitiveType;
nzUInt32 m_triangleIndices[3];

View File

@ -29,9 +29,7 @@ bool NzTriangleIterator::Advance()
{
if (m_currentIndex >= m_indexCount)
{
///FIXME: Que faire si Advance() est appelé deux fois
m_indexMapper.Unmap();
m_vertexMapper.Unmap();
Unmap();
return false;
}
@ -164,3 +162,10 @@ void NzTriangleIterator::SetTexCoords(unsigned int i, const NzVector2f& texCoord
m_vertexMapper.SetTexCoords(m_triangleIndices[i], texCoords);
}
void NzTriangleIterator::Unmap()
{
// Peut très bien être appellé plusieurs fois de suite, seul le premier appel sera pris en compte
m_indexMapper.Unmap();
m_vertexMapper.Unmap();
}

View File

@ -326,6 +326,9 @@ void NzVertexMapper::SetTexCoords(unsigned int i, const NzVector2f& texCoords)
void NzVertexMapper::Unmap()
{
if (m_impl)
{
delete m_impl;
m_impl = nullptr;
}
}