diff --git a/specter/include/specter/View.hpp b/specter/include/specter/View.hpp index eee603430..0412dec71 100644 --- a/specter/include/specter/View.hpp +++ b/specter/include/specter/View.hpp @@ -111,20 +111,15 @@ public: void load(const VertStruct* data, size_t count) { if (m_vertsBuf) { - VertStruct* out = m_vertsBuf.access(); - for (size_t i = 0; i < count; ++i) - out[i] = data[i]; + VertStruct* const out = m_vertsBuf.access(); + std::copy(data, data + count, out); } } template void load(const VertArray data) { - static_assert(std::is_same, VertStruct>::value, "mismatched type"); - if (m_vertsBuf) { - constexpr size_t count = sizeof(VertArray) / sizeof(VertStruct); - VertStruct* out = m_vertsBuf.access(); - for (size_t i = 0; i < count; ++i) - out[i] = data[i]; - } + static_assert(std::is_same_v, VertStruct>, "mismatched type"); + constexpr size_t count = sizeof(VertArray) / sizeof(VertStruct); + load(data, count); } operator const boo::ObjToken&() { return m_shaderBinding; }