diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-11 01:36:17 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-03-11 01:36:17 +0000 |
| commit | c6cff2f1e823327129ed7d044cec6c05fa7525a1 (patch) | |
| tree | 87025e984f4d7fba2338bb585190b2107cc8573b /gfx | |
| parent | Replace hacky m4 shader preprocessing with proper glslang version (diff) | |
| download | ilt-c6cff2f1e823327129ed7d044cec6c05fa7525a1.tar.bz2 ilt-c6cff2f1e823327129ed7d044cec6c05fa7525a1.tar.xz ilt-c6cff2f1e823327129ed7d044cec6c05fa7525a1.zip | |
Split addAttribsFor away from requiring a buffer to bind
Diffstat (limited to 'gfx')
| -rw-r--r-- | gfx/gl/glVertexArray.h | 10 | ||||
| -rw-r--r-- | gfx/models/mesh.h | 3 | ||||
| -rw-r--r-- | gfx/models/vertex.cpp | 4 |
3 files changed, 12 insertions, 5 deletions
diff --git a/gfx/gl/glVertexArray.h b/gfx/gl/glVertexArray.h index dbe930f..6630b70 100644 --- a/gfx/gl/glVertexArray.h +++ b/gfx/gl/glVertexArray.h @@ -40,7 +40,15 @@ namespace Impl { } // Customisation point - template<typename VertexT> VertexArrayConfigurator & addAttribsFor(GLuint divisor, const glBuffer & buffer); + template<typename VertexT> VertexArrayConfigurator & addAttribsFor(GLuint divisor); + + template<typename VertexT> + VertexArrayConfigurator & + addAttribsFor(GLuint divisor, const glBuffer & buffer) + { + glVertexArrayVertexBuffer(name, binding, buffer, 0, sizeof(VertexT)); + return addAttribsFor<VertexT>(divisor); + } template<typename VertexT, MP... Attribs> VertexArrayConfigurator & diff --git a/gfx/models/mesh.h b/gfx/models/mesh.h index f578625..d4dbd68 100644 --- a/gfx/models/mesh.h +++ b/gfx/models/mesh.h @@ -2,14 +2,13 @@ #include "config/types.h" #include "gfx/gl/glBuffer.h" +#include "gfx/models/vertex.h" #include <gfx/gl/glVertexArray.h> #include <glad/gl.h> #include <ranges> #include <span> #include <stdTypeDefs.h> -class Vertex; - class MeshBase { public: class Dimensions { diff --git a/gfx/models/vertex.cpp b/gfx/models/vertex.cpp index dc32f72..4b5ce54 100644 --- a/gfx/models/vertex.cpp +++ b/gfx/models/vertex.cpp @@ -3,8 +3,8 @@ template<> Impl::VertexArrayConfigurator & -Impl::VertexArrayConfigurator::addAttribsFor<Vertex>(const GLuint divisor, const glBuffer & buffer) +Impl::VertexArrayConfigurator::addAttribsFor<Vertex>(const GLuint divisor) { return addAttribs<Vertex, &Vertex::pos, &Vertex::texCoord, &Vertex::normal, &Vertex::colour, &Vertex::material>( - divisor, buffer); + divisor); } |
