mirror of https://github.com/AxioDL/metaforce.git
View: Implement load() in terms of the other
Same thing, but with less code duplication.
This commit is contained in:
parent
33a6e07e7a
commit
b2e45e28fa
|
@ -111,20 +111,15 @@ public:
|
||||||
|
|
||||||
void load(const VertStruct* data, size_t count) {
|
void load(const VertStruct* data, size_t count) {
|
||||||
if (m_vertsBuf) {
|
if (m_vertsBuf) {
|
||||||
VertStruct* out = m_vertsBuf.access();
|
VertStruct* const out = m_vertsBuf.access();
|
||||||
for (size_t i = 0; i < count; ++i)
|
std::copy(data, data + count, out);
|
||||||
out[i] = data[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template <typename VertArray>
|
template <typename VertArray>
|
||||||
void load(const VertArray data) {
|
void load(const VertArray data) {
|
||||||
static_assert(std::is_same<std::remove_all_extents_t<VertArray>, VertStruct>::value, "mismatched type");
|
static_assert(std::is_same_v<std::remove_all_extents_t<VertArray>, VertStruct>, "mismatched type");
|
||||||
if (m_vertsBuf) {
|
constexpr size_t count = sizeof(VertArray) / sizeof(VertStruct);
|
||||||
constexpr size_t count = sizeof(VertArray) / sizeof(VertStruct);
|
load(data, count);
|
||||||
VertStruct* out = m_vertsBuf.access();
|
|
||||||
for (size_t i = 0; i < count; ++i)
|
|
||||||
out[i] = data[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
operator const boo::ObjToken<boo::IShaderDataBinding>&() { return m_shaderBinding; }
|
operator const boo::ObjToken<boo::IShaderDataBinding>&() { return m_shaderBinding; }
|
||||||
|
|
Loading…
Reference in New Issue