Work on assignment 4
[opengl.git] / model.hpp
diff --git a/model.hpp b/model.hpp
new file mode 100644 (file)
index 0000000..0339538
--- /dev/null
+++ b/model.hpp
@@ -0,0 +1,32 @@
+#include <vector>
+#ifdef __APPLE__
+#include <GL/glew.h>
+#else
+#include <OpenGL/glew.h>
+#endif
+#include <glm/glm.hpp>
+#include <assimp/scene.h>
+
+class Model {
+       public:
+               Model(const std::string &path, GLuint progId): progId(progId) {
+                       loadModel(path);
+               }
+               void draw();
+       private:
+               const GLuint progId;
+
+               struct Mesh {
+                       Mesh(const aiMesh *aiMesh, GLuint progId);
+                       
+                       GLuint vao, vertexVbo, normalVbo, indicesVbo;
+
+                       std::vector<glm::vec3> vertices;
+                       std::vector<glm::vec3> normals;
+                       std::vector<glm::vec2> texCoords;
+                       std::vector<GLuint> indices;
+               };
+               
+               std::vector<Mesh> meshes;
+               void loadModel(const std::string &path);
+};