Refactor material system (#382)

This commit is contained in:
Jérôme Leclercq
2022-10-31 19:53:41 +01:00
committed by GitHub
parent 0a8048809c
commit dc6ce8427c
156 changed files with 3633 additions and 4569 deletions

View File

@@ -8,11 +8,11 @@
namespace Nz
{
std::size_t MaterialPassRegistry::GetPassIndex(const std::string& passName) const
std::size_t MaterialPassRegistry::GetPassIndex(std::string_view passName) const
{
auto it = m_passIndex.find(passName);
if (it == m_passIndex.end())
throw std::runtime_error("pass " + passName + " must be registered before being used");
throw std::runtime_error("pass " + std::string(passName) + " must be registered before being used");
return it->second;
}
@@ -22,8 +22,10 @@ namespace Nz
if (m_passIndex.find(passName) != m_passIndex.end())
throw std::runtime_error("pass " + passName + " is already registered");
m_passNames.push_back(std::move(passName));
std::size_t passIndex = m_passIndex.size();
m_passIndex.emplace(std::move(passName), passIndex);
m_passIndex.emplace(m_passNames.back(), passIndex);
return passIndex;
}