From e0bdd352802289acf58a5ec9bd523f50dcd9e7ae Mon Sep 17 00:00:00 2001 From: Lynix Date: Thu, 19 Oct 2017 21:01:07 +0200 Subject: [PATCH] VertexMapper: GetComponentPtr no longer trigger an error/assert --- ChangeLog.md | 7 ++----- include/Nazara/Utility/VertexMapper.inl | 9 +-------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index e6cc81862..37b8811de 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,10 +1,7 @@ # Upcoming version: -Additions/Changes: -- - -Fixes: -- +Nazara Engine: +- VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned. # 0.4: diff --git a/include/Nazara/Utility/VertexMapper.inl b/include/Nazara/Utility/VertexMapper.inl index 93cc8c2d2..f3861541c 100644 --- a/include/Nazara/Utility/VertexMapper.inl +++ b/include/Nazara/Utility/VertexMapper.inl @@ -21,17 +21,10 @@ namespace Nz std::size_t offset; declaration->GetComponent(component, &enabled, &type, &offset); - if (enabled) - { - NazaraAssert(GetComponentTypeOf() == type, "Attribute type does not match template type"); - + if (enabled && GetComponentTypeOf() == type) return SparsePtr(static_cast(m_mapper.GetPointer()) + offset, declaration->GetStride()); - } else - { - NazaraError("Attribute 0x" + String::Number(component, 16) + " is not enabled"); return SparsePtr(); - } } inline const VertexBuffer* VertexMapper::GetVertexBuffer() const