VertexMapper: GetComponentPtr no longer trigger an error/assert
This commit is contained in:
parent
302a65a8aa
commit
e0bdd35280
|
|
@ -1,10 +1,7 @@
|
||||||
# Upcoming version:
|
# Upcoming version:
|
||||||
|
|
||||||
Additions/Changes:
|
Nazara Engine:
|
||||||
-
|
- VertexMapper:GetComponentPtr no longer throw an error if component is disabled or incompatible with template type, instead a null pointer is returned.
|
||||||
|
|
||||||
Fixes:
|
|
||||||
-
|
|
||||||
|
|
||||||
# 0.4:
|
# 0.4:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,17 +21,10 @@ namespace Nz
|
||||||
std::size_t offset;
|
std::size_t offset;
|
||||||
declaration->GetComponent(component, &enabled, &type, &offset);
|
declaration->GetComponent(component, &enabled, &type, &offset);
|
||||||
|
|
||||||
if (enabled)
|
if (enabled && GetComponentTypeOf<T>() == type)
|
||||||
{
|
|
||||||
NazaraAssert(GetComponentTypeOf<T>() == type, "Attribute type does not match template type");
|
|
||||||
|
|
||||||
return SparsePtr<T>(static_cast<UInt8*>(m_mapper.GetPointer()) + offset, declaration->GetStride());
|
return SparsePtr<T>(static_cast<UInt8*>(m_mapper.GetPointer()) + offset, declaration->GetStride());
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
NazaraError("Attribute 0x" + String::Number(component, 16) + " is not enabled");
|
|
||||||
return SparsePtr<T>();
|
return SparsePtr<T>();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const VertexBuffer* VertexMapper::GetVertexBuffer() const
|
inline const VertexBuffer* VertexMapper::GetVertexBuffer() const
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue