iwa/source/util/vertex_layout.cpp
2024-04-06 14:11:26 +02:00

30 lines
814 B
C++

#include "iwa/util/vertex_layout.hpp"
namespace iwa
{
mijin::Optional<VertexAttribute&> VertexLayout::findAttribute(VertexAttributeSemantic semantic, unsigned semanticIdx) noexcept
{
for (VertexAttribute& attribute : attributes)
{
if (attribute.semantic == semantic && attribute.semanticIdx == semanticIdx)
{
return attribute;
}
}
return mijin::NULL_OPTIONAL;
}
mijin::Optional<const VertexAttribute&> VertexLayout::findAttribute(VertexAttributeSemantic semantic, unsigned semanticIdx) const noexcept
{
for (const VertexAttribute& attribute : attributes)
{
if (attribute.semantic == semantic && attribute.semanticIdx == semanticIdx)
{
return attribute;
}
}
return mijin::NULL_OPTIONAL;
}
} // namespace iwa