diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-04-03 12:04:14 +0100 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-04-03 12:04:14 +0100 |
| commit | 4d04572e48950493ce85255d181be43967f362fd (patch) | |
| tree | f74d055f151472cda3fa3fc0f760eb6219dd9fad /gfx/gl/glVertexArray.h | |
| parent | Use std::chrono for worldTime (diff) | |
| parent | Fix direction of difference vector calculating railVehicle new position (diff) | |
| download | ilt-4d04572e48950493ce85255d181be43967f362fd.tar.bz2 ilt-4d04572e48950493ce85255d181be43967f362fd.tar.xz ilt-4d04572e48950493ce85255d181be43967f362fd.zip | |
Merge branch 'shared-locations'
Diffstat (limited to 'gfx/gl/glVertexArray.h')
| -rw-r--r-- | gfx/gl/glVertexArray.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/gfx/gl/glVertexArray.h b/gfx/gl/glVertexArray.h index 323303c..4e8113f 100644 --- a/gfx/gl/glVertexArray.h +++ b/gfx/gl/glVertexArray.h @@ -4,6 +4,7 @@ #include "glArrays.h" #include "glBuffer.h" #include "gl_traits.h" +#include "util.h" namespace Impl { class VertexArrayConfigurator { @@ -20,11 +21,8 @@ namespace Impl { } M T::* ptr; - using ValueType = M; }; - template<typename M, typename T> MP(M T::*) -> MP<M, T>; - explicit VertexArrayConfigurator(GLuint name) : name {name} { } VertexArrayConfigurator & @@ -52,7 +50,7 @@ namespace Impl { return addAttribsFor<VertexT>(divisor); } - template<typename VertexT, MP... Attribs> + template<typename VertexT, auto... Attribs> VertexArrayConfigurator & addAttribs(const GLuint divisor) { @@ -60,7 +58,7 @@ namespace Impl { return *this; } - template<typename VertexT, MP... Attribs> + template<typename VertexT, auto... Attribs> VertexArrayConfigurator & addAttribs(const GLuint divisor, const glBuffer & buffer) { @@ -68,7 +66,7 @@ namespace Impl { return addAttribs<VertexT, Attribs...>(divisor); } - template<typename VertexT, MP... Attribs> + template<typename VertexT, auto... Attribs> VertexArrayConfigurator & addAttribs(const GLuint divisor, glBuffer & buffer, const SequentialCollection<VertexT> auto & data) { @@ -93,14 +91,15 @@ namespace Impl { setPointerMeta(attrib + gl_traits<T>::vertexArrayAttribFormat(name, attrib, offset)); } - template<MP Attrib> + template<typename VertexT, auto Attrib> void setPointer() { - setPointer<typename decltype(Attrib)::ValueType>(Attrib); + using Mbr = MemberValueType<Attrib>; + setPointer<Mbr>(MP<Mbr, VertexT> {Attrib}); } - template<typename VertexT, MP... Attribs> + template<typename VertexT, auto... Attribs> void configureAttribs(const GLuint divisor) { @@ -108,7 +107,7 @@ namespace Impl { setPointer<VertexT>(0); } else { - ((setPointer<Attribs>()), ...); + ((setPointer<VertexT, Attribs>()), ...); } glVertexArrayBindingDivisor(name, binding++, divisor); } |
