diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-05 00:30:13 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-05 00:30:13 +0000 |
commit | c1ea14d1c96de18448c0c3779d30b7e1e4451f61 (patch) | |
tree | b97edc04e70495caf49545dc30ed9936d1986d07 /gfx/models/mesh.cpp | |
parent | Create terrain as collection of meshes (diff) | |
download | ilt-c1ea14d1c96de18448c0c3779d30b7e1e4451f61.tar.bz2 ilt-c1ea14d1c96de18448c0c3779d30b7e1e4451f61.tar.xz ilt-c1ea14d1c96de18448c0c3779d30b7e1e4451f61.zip |
Initial commit generating some basic rail network
Diffstat (limited to 'gfx/models/mesh.cpp')
-rw-r--r-- | gfx/models/mesh.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gfx/models/mesh.cpp b/gfx/models/mesh.cpp index 90de8db..4a3d9d4 100644 --- a/gfx/models/mesh.cpp +++ b/gfx/models/mesh.cpp @@ -7,7 +7,7 @@ Mesh::Mesh(const std::string & fileName) : Mesh(OBJModel(fileName).ToIndexedModel()) { }
Mesh::Mesh(const IndexedModel & model) :
- m_vertexArrayObject {}, m_vertexArrayBuffers {}, m_numIndices {model.indices.size()}
+ m_vertexArrayObject {}, m_vertexArrayBuffers {}, m_numIndices {model.indices.size()}, mode {GL_TRIANGLES}
{
glGenVertexArrays(1, &m_vertexArrayObject);
glBindVertexArray(m_vertexArrayObject);
@@ -38,8 +38,8 @@ Mesh::Mesh(const IndexedModel & model) : glBindVertexArray(0);
}
-Mesh::Mesh(std::span<Vertex> vertices, std::span<unsigned int> indices) :
- m_vertexArrayObject {}, m_vertexArrayBuffers {}, m_numIndices {indices.size()}
+Mesh::Mesh(std::span<Vertex> vertices, std::span<unsigned int> indices, GLenum m) :
+ m_vertexArrayObject {}, m_vertexArrayBuffers {}, m_numIndices {indices.size()}, mode {m}
{
glGenVertexArrays(1, &m_vertexArrayObject);
glBindVertexArray(m_vertexArrayObject);
@@ -75,7 +75,7 @@ Mesh::Draw() const {
glBindVertexArray(m_vertexArrayObject);
- glDrawElementsBaseVertex(GL_TRIANGLES, m_numIndices, GL_UNSIGNED_INT, nullptr, 0);
+ glDrawElementsBaseVertex(mode, m_numIndices, GL_UNSIGNED_INT, nullptr, 0);
glBindVertexArray(0);
}
|