Add basics of materials
[opengl.git] / model.hpp
index 98c630e83306e36c72053760629eba52d52970e4..a39c70a0651eb8043cd14bbb9ea4e0567bba85d9 100644 (file)
--- a/model.hpp
+++ b/model.hpp
@@ -7,13 +7,14 @@
 #include <glm/glm.hpp>
 #include <assimp/scene.h>
 #include <assimp/Importer.hpp>
+#include "material.hpp"
 
 class Model {
 
        struct Mesh {
                Mesh(const aiMesh *aiMesh, GLuint progId);
-               GLuint vao;
-               GLuint numIndices;
+               GLuint progId, vao, numIndices;
+               unsigned int materialIndex;
        };
        
        public:
@@ -23,7 +24,7 @@ class Model {
                class Node {
                        public:
                                Node(const aiNode &aiNode, GLuint progId);
-                               void draw(const std::vector<Mesh> &meshes, glm::mat4 parentModel) const;
+                               void draw(const std::vector<Mesh> &meshes, const std::vector<Material> &materials, glm::mat4 parentModel) const;
                                const std::vector<Node*> &getChildren() const { return children; }
                                Node* findNode(const aiNode &aiNode);
                                glm::mat4 model = glm::mat4(1);
@@ -43,6 +44,9 @@ class Model {
                
                std::vector<Mesh> meshes;
                Node *root;
+
+               std::vector<Material> materials;
+
                void loadModel(const std::string &path);
 
                Assimp::Importer importer;