Drawable Renderer (#1570), warnings

This commit is contained in:
Tim Sylvester
2023-05-15 15:36:04 -07:00
committed by Bart Louwers
parent 49a23db0cb
commit 857cba59ee
3 changed files with 17 additions and 9 deletions

View File

@@ -137,7 +137,7 @@ public:
VertexAttributeArray(int initCapacity = 10);
VertexAttributeArray(VertexAttributeArray&&);
// Would need to use the virtual assignment operator
VertexAttributeArray(const VertexAttributeArray&);
VertexAttributeArray(const VertexAttributeArray&) = delete;
virtual ~VertexAttributeArray() = default;
/// Number of elements
@@ -214,7 +214,9 @@ public:
VertexAttributeArray& operator=(const VertexAttributeArray&);
virtual std::unique_ptr<VertexAttributeArray> clone() const {
return std::make_unique<VertexAttributeArray>(*this);
auto newAttrs = std::make_unique<VertexAttributeArray>();
newAttrs->copy(*this);
return newAttrs;
}
protected:
@@ -234,6 +236,15 @@ protected:
std::size_t count) const {
return std::make_unique<VertexAttribute>(index, dataType, size, count, size * count);
}
virtual void copy(const VertexAttributeArray& other) {
for (const auto& kv : other.attrs) {
if (kv.second) {
attrs.insert(std::make_pair(kv.first, copy(*kv.second)));
}
}
}
virtual std::unique_ptr<VertexAttribute> copy(const gfx::VertexAttribute& attr) const {
return std::make_unique<VertexAttribute>(attr);
}

View File

@@ -51,8 +51,6 @@ public:
: VertexAttributeArray(initCapacity) {}
VertexAttributeArrayGL(VertexAttributeArrayGL&& other)
: VertexAttributeArray(std::move(other)) {}
VertexAttributeArrayGL(const VertexAttributeArrayGL& other)
: VertexAttributeArray(other) {}
VertexAttributeArrayGL& operator=(VertexAttributeArrayGL&& other) {
VertexAttributeArray::operator=(std::move(other));
@@ -64,7 +62,9 @@ public:
}
std::unique_ptr<VertexAttributeArray> clone() const override {
return std::make_unique<VertexAttributeArrayGL>(*this);
auto newAttrs = std::make_unique<VertexAttributeArrayGL>();
newAttrs->copy(*this);
return newAttrs;
}
private:
@@ -74,6 +74,7 @@ private:
std::size_t count) const override {
return std::unique_ptr<gfx::VertexAttribute>(new VertexAttributeGL(index, dataType, size, count));
}
using gfx::VertexAttributeArray::copy;
std::unique_ptr<gfx::VertexAttribute> copy(const gfx::VertexAttribute& attr) const override {
return std::unique_ptr<gfx::VertexAttribute>(
new VertexAttributeGL(static_cast<const VertexAttributeGL&>(attr)));

View File

@@ -12,10 +12,6 @@ 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)) {}