// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // 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, std::size_t componentIndex) { // On récupère la déclaration depuis le buffer const std::shared_ptr& declaration = m_mapper.GetBuffer()->GetVertexDeclaration(); if (const auto* componentData = declaration->GetComponentByType(component, componentIndex)) return SparsePtr(static_cast(m_mapper.GetPointer()) + componentData->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