Drawable Renderer (#1570), Rebase on main, squash trivial commits

This commit is contained in:
Tim Sylvester
2023-04-19 15:49:36 -07:00
committed by Bart Louwers
parent a646cbf938
commit f76fb98745
7 changed files with 41 additions and 40 deletions

View File

@@ -33,7 +33,9 @@ public:
using int3 = std::array<std::int32_t, 3>;
using int4 = std::array<std::int32_t, 4>;
using ElementType = std::variant<std::int32_t, int2, int3, int4, float, float2, float3, matf2, matf4>;
using ElementType = std::variant<std::int32_t, int2, int3, int4,
float, float2, float3, float4,
matf3, matf4>;
// Can only be created by VertexAttributeArray implementations
protected:
@@ -75,7 +77,7 @@ public:
protected:
VertexAttribute& operator=(const VertexAttribute&) = default;
VertexAttribute& operator=(const VertexAttribute&& other) {
VertexAttribute& operator=(VertexAttribute&& other) {
index = other.index;
size = other.size;
dataType = other.dataType;
@@ -101,7 +103,8 @@ public:
VertexAttributeArray(int initCapacity = 10);
VertexAttributeArray(VertexAttributeArray &&);
VertexAttributeArray(const VertexAttributeArray&);
// Would need to use the virtual assignment operator
VertexAttributeArray(const VertexAttributeArray&) = delete;
virtual ~VertexAttributeArray() = default;
std::size_t size() const { return attrs.size(); }
@@ -123,10 +126,11 @@ public:
// Set a value if the element is present
template <typename T>
const VertexAttribute::ElementType& set(const std::string& name, std::size_t i, T value) {
bool set(const std::string& name, std::size_t i, T value) {
if (auto *item = get(name)) {
item->set(i, value);
return item->set(i, value);
}
return false;
}
/// Indicates whether any values have changed

View File

@@ -13,15 +13,15 @@ class VertexAttributeGL final : public gfx::VertexAttribute {
private:
friend VertexAttributeArrayGL;
VertexAttributeGL(int index_, gfx::AttributeDataType dataType_, int size_, std::size_t count_)
: VertexAttribute(index_, dataType_, size_, count_) {
: VertexAttribute(index_, dataType_, size_, count_) {
}
VertexAttributeGL(const VertexAttributeGL& other)
: VertexAttribute(other),
glType(other.glType) {
: VertexAttribute(other),
glType(other.glType) {
}
VertexAttributeGL(VertexAttributeGL&& other)
: VertexAttribute(std::move(other)),
glType(other.glType) {
: VertexAttribute(std::move(other)),
glType(other.glType) {
}
public:
@@ -46,7 +46,7 @@ class VertexAttributeArrayGL final : public gfx::VertexAttributeArray {
public:
VertexAttributeArrayGL(int initCapacity = 10) : VertexAttributeArray(initCapacity) { }
VertexAttributeArrayGL(VertexAttributeArrayGL &&other) : VertexAttributeArray(std::move(other)) { }
VertexAttributeArrayGL(const VertexAttributeArrayGL& other) : VertexAttributeArray(other) { }
VertexAttributeArrayGL(const VertexAttributeArrayGL&) = delete;
~VertexAttributeArrayGL() = default;
VertexAttributeArrayGL& operator=(VertexAttributeArrayGL &&other) {