Drawable Renderer (#1570), rework attributes for fill drawables

This commit is contained in:
Tim Sylvester
2023-05-15 15:02:41 -07:00
committed by Bart Louwers
parent cec22b8572
commit fffbfcfbb5
12 changed files with 198 additions and 45 deletions

View File

@@ -12,6 +12,10 @@ std::unique_ptr<VertexAttribute> VertexAttributeArray::nullref = nullptr;
VertexAttributeArray::VertexAttributeArray(int initCapacity)
: attrs(initCapacity) {}
VertexAttributeArray::VertexAttributeArray(const VertexAttributeArray& other) {
operator=(other);
}
VertexAttributeArray::VertexAttributeArray(VertexAttributeArray&& other)
: attrs(std::move(other.attrs)) {}
@@ -23,7 +27,9 @@ VertexAttributeArray& VertexAttributeArray::operator=(VertexAttributeArray&& oth
VertexAttributeArray& VertexAttributeArray::operator=(const VertexAttributeArray& other) {
attrs.clear();
for (const auto& kv : other.attrs) {
add(kv.first, copy(*kv.second));
if (kv.second) {
add(kv.first, copy(*kv.second));
}
}
return *this;
}
@@ -69,6 +75,10 @@ std::size_t VertexAttributeArray::getMaxCount() const {
});
}
void VertexAttributeArray::clear() {
attrs.clear();
}
void VertexAttributeArray::resolve(const VertexAttributeArray& overrides, ResolveDelegate delegate) const {
for (auto& kv : attrs) {
delegate(kv.first, *kv.second, overrides.get(kv.first));