Remove Utility module and move its content to Core and TextRenderer modules

This commit is contained in:
SirLynix
2024-02-10 22:46:53 +01:00
committed by Jérôme Leclercq
parent 965a00182c
commit e64c2b036e
364 changed files with 2336 additions and 2516 deletions

View File

@@ -0,0 +1,39 @@
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Core module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Core/VertexDeclaration.hpp>
#include <Nazara/Core/Debug.hpp>
namespace Nz
{
template <typename T>
SparsePtr<T> VertexMapper::GetComponentPtr(VertexComponent component, std::size_t componentIndex)
{
// On récupère la déclaration depuis le buffer
const std::shared_ptr<const VertexDeclaration>& declaration = m_mapper.GetBuffer()->GetVertexDeclaration();
if (const auto* componentData = declaration->GetComponentByType<T>(component, componentIndex))
return SparsePtr<T>(static_cast<UInt8*>(m_mapper.GetPointer()) + componentData->offset, declaration->GetStride());
else
return SparsePtr<T>();
}
inline const VertexBuffer* VertexMapper::GetVertexBuffer() const
{
return m_mapper.GetBuffer();
}
inline UInt32 VertexMapper::GetVertexCount() const
{
return GetVertexBuffer()->GetVertexCount();
}
template<typename T>
bool VertexMapper::HasComponentOfType(VertexComponent component) const
{
return m_mapper.GetBuffer()->GetVertexDeclaration()->HasComponentOfType<T>(component);
}
}
#include <Nazara/Core/DebugOff.hpp>