From 2c6257a4460de7b0c75723aebf96cf265e078530 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 24 Feb 2023 19:29:27 +0000 Subject: Support for model colours mixed with textures --- gfx/models/mesh.cpp | 2 +- gfx/models/vertex.hpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'gfx/models') diff --git a/gfx/models/mesh.cpp b/gfx/models/mesh.cpp index 85be84c..3db1ad5 100644 --- a/gfx/models/mesh.cpp +++ b/gfx/models/mesh.cpp @@ -7,7 +7,7 @@ Mesh::Mesh(const std::span vertices, const std::span indices, GLenum m) : m_numIndices {static_cast(indices.size())}, mode {m} { - VertexArrayObject::configure<&Vertex::pos, &Vertex::texCoord, &Vertex::normal>( + VertexArrayObject::configure<&Vertex::pos, &Vertex::texCoord, &Vertex::normal, &Vertex::colour>( m_vertexArrayObject, m_vertexArrayBuffers[0], m_vertexArrayBuffers[1], vertices, indices); } diff --git a/gfx/models/vertex.hpp b/gfx/models/vertex.hpp index 095c82f..325aab1 100644 --- a/gfx/models/vertex.hpp +++ b/gfx/models/vertex.hpp @@ -4,12 +4,13 @@ class Vertex { public: - constexpr Vertex(glm::vec3 pos, glm::vec2 texCoord, glm::vec3 normal) : - pos {std::move(pos)}, texCoord {std::move(texCoord)}, normal {std::move(normal)} + constexpr Vertex(glm::vec3 pos, glm::vec2 texCoord, glm::vec3 normal, glm::vec4 colour = {}) : + pos {std::move(pos)}, texCoord {std::move(texCoord)}, normal {std::move(normal)}, colour {std::move(colour)} { } glm::vec3 pos; glm::vec2 texCoord; glm::vec3 normal; + glm::vec4 colour; }; -- cgit v1.2.3