summaryrefslogtreecommitdiff
path: root/gfx/gl/instanceVertices.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-06 20:48:33 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-07 01:02:02 +0000
commit2f8d7643d03f39fa848576692264d0fe3a37ed91 (patch)
treef4578e2ce3020c04a206f9eb0bc02587de5b3d6a /gfx/gl/instanceVertices.h
parentDon't request a specific OpenGL version, just check we get something sufficie... (diff)
downloadilt-2f8d7643d03f39fa848576692264d0fe3a37ed91.tar.bz2
ilt-2f8d7643d03f39fa848576692264d0fe3a37ed91.tar.xz
ilt-2f8d7643d03f39fa848576692264d0fe3a37ed91.zip
Reformat with new clang-format
Diffstat (limited to 'gfx/gl/instanceVertices.h')
-rw-r--r--gfx/gl/instanceVertices.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/gfx/gl/instanceVertices.h b/gfx/gl/instanceVertices.h
index 7b0341b..a89aa78 100644
--- a/gfx/gl/instanceVertices.h
+++ b/gfx/gl/instanceVertices.h
@@ -13,9 +13,11 @@ public:
class [[nodiscard]] InstanceProxy {
public:
InstanceProxy(InstanceVertices * iv, std::size_t idx) : instances {iv}, index {idx} { }
+
InstanceProxy(InstanceProxy && other) : instances {std::exchange(other.instances, nullptr)}, index {other.index}
{
}
+
NO_COPY(InstanceProxy);
~InstanceProxy()
@@ -35,6 +37,7 @@ public:
index = other.index;
return *this;
}
+
template<typename U>
T &
operator=(U && v)
@@ -42,40 +45,46 @@ public:
return instances->lookup(index) = std::forward<U>(v);
}
- [[nodiscard]]
- operator T &()
+ [[nodiscard]] operator T &()
{
return instances->lookup(index);
}
+
[[nodiscard]] operator const T &() const
{
return instances->lookup(index);
}
+
[[nodiscard]] T *
get()
{
return &instances->lookup(index);
}
+
[[nodiscard]] const T *
get() const
{
return &instances->lookup(index);
}
+
[[nodiscard]] T *
operator->()
{
return get();
}
+
[[nodiscard]] const T *
operator->() const
{
return get();
}
+
[[nodiscard]] T &
operator*()
{
return instances->lookup(index);
}
+
[[nodiscard]] const T &
operator*() const
{