summaryrefslogtreecommitdiff
path: root/gfx/models/mesh.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-13 14:52:03 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-13 14:52:03 +0000
commitd2b167f2d1ca15e42a177b65cdf34f35592452f7 (patch)
treeacdd75da65e879412934fb024274a6849b823439 /gfx/models/mesh.h
parentFlip texture images to match OpenGL expectations (diff)
downloadilt-d2b167f2d1ca15e42a177b65cdf34f35592452f7.tar.bz2
ilt-d2b167f2d1ca15e42a177b65cdf34f35592452f7.tar.xz
ilt-d2b167f2d1ca15e42a177b65cdf34f35592452f7.zip
New .obj parser, packer, mesher
Diffstat (limited to 'gfx/models/mesh.h')
-rw-r--r--gfx/models/mesh.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/gfx/models/mesh.h b/gfx/models/mesh.h
index ebd300b..4982145 100644
--- a/gfx/models/mesh.h
+++ b/gfx/models/mesh.h
@@ -4,19 +4,22 @@
#include <GL/glew.h>
#include <array>
#include <cstddef>
+#include <filesystem>
+#include <gfx/models/vertex.hpp>
#include <span>
#include <special_members.hpp>
-#include <string>
+#include <utility>
+#include <vector>
-class IndexedModel;
-class Vertex;
+class ObjParser;
enum MeshBufferPositions { POSITION_VB, TEXCOORD_VB, NORMAL_VB, INDEX_VB };
class Mesh {
public:
- explicit Mesh(const std::string & fileName);
- explicit Mesh(const IndexedModel & model);
+ using Data = std::pair<std::vector<Vertex>, std::vector<unsigned int>>;
+ explicit Mesh(const std::filesystem::path & fileName);
+ explicit Mesh(const ObjParser & obj);
Mesh(std::span<Vertex> vertices, std::span<unsigned int> indices, GLenum = GL_TRIANGLES);
virtual ~Mesh();
@@ -26,6 +29,10 @@ public:
void Draw() const;
private:
+ explicit Mesh(Data && vandi, GLenum = GL_TRIANGLES);
+
+ static Data packObjParser(const ObjParser &);
+
static constexpr unsigned int NUM_BUFFERS {4};
GLuint m_vertexArrayObject;