Vertex declaration changes (#135)
* Add type to ComponentType conversion * Change type to ComponentType conversion * Change assert to condition, add check on particle mapper. * Change particle life type * Changes as requested * Fix Travis try 1 * Changes as requested * move IsSuitableForComponent to inl
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// Copyright (C) 2017 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Utility/VertexDeclaration.hpp>
|
||||
#include <Nazara/Utility/Debug.hpp>
|
||||
#include <Nazara/Utility/Algorithm.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
@@ -19,7 +20,7 @@ namespace Nz
|
||||
std::size_t offset;
|
||||
declaration->GetComponent(component, &enabled, &type, &offset);
|
||||
|
||||
if (enabled)
|
||||
if (enabled && GetComponentTypeOf<T>() == type)
|
||||
{
|
||||
///TODO: Vérifier le rapport entre le type de l'attribut et le type template ?
|
||||
return SparsePtr<T>(static_cast<UInt8*>(m_mapper.GetPointer()) + offset, declaration->GetStride());
|
||||
@@ -30,6 +31,12 @@ namespace Nz
|
||||
return SparsePtr<T>();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool VertexMapper::HasComponentOfType(VertexComponent component) const
|
||||
{
|
||||
return m_mapper.GetBuffer()->GetVertexDeclaration()->HasComponentOfType<T>(component);
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Utility/DebugOff.hpp>
|
||||
|
||||
Reference in New Issue
Block a user