// 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 #include #include #include namespace Nz { template SparsePtr VertexMapper::GetComponentPtr(VertexComponent component) { // On récupère la déclaration depuis le buffer const VertexDeclaration* declaration = m_mapper.GetBuffer()->GetVertexDeclaration(); // Ensuite le composant qui nous intéresse bool enabled; ComponentType type; std::size_t offset; declaration->GetComponent(component, &enabled, &type, &offset); if (enabled && GetComponentTypeOf() == type) return SparsePtr(static_cast(m_mapper.GetPointer()) + offset, declaration->GetStride()); else return SparsePtr(); } inline const VertexBuffer* VertexMapper::GetVertexBuffer() const { return m_mapper.GetBuffer(); } inline UInt32 VertexMapper::GetVertexCount() const { return GetVertexBuffer()->GetVertexCount(); } template bool VertexMapper::HasComponentOfType(VertexComponent component) const { return m_mapper.GetBuffer()->GetVertexDeclaration()->HasComponentOfType(component); } } #include