X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=model.hpp;h=de8e27f8639f8c422de78127faa300ec15b4fd45;hp=98c630e83306e36c72053760629eba52d52970e4;hb=c44e69ec78367fb2957324026894aef970f2481a;hpb=ba5e08bf25de722d907748ce55b27a45b2b270bf diff --git a/model.hpp b/model.hpp index 98c630e..de8e27f 100644 --- a/model.hpp +++ b/model.hpp @@ -7,23 +7,25 @@ #include #include #include +#include "material.hpp" +#include "program.hpp" class Model { struct Mesh { Mesh(const aiMesh *aiMesh, GLuint progId); - GLuint vao; - GLuint numIndices; + GLuint progId, vao, numIndices; + unsigned int materialIndex; }; public: - Model(const std::string &path, GLuint progId); + Model(const std::string &path, Program p); void draw() const; class Node { public: Node(const aiNode &aiNode, GLuint progId); - void draw(const std::vector &meshes, glm::mat4 parentModel) const; + void draw(const std::vector &meshes, const std::vector &materials, glm::mat4 parentModel) const; const std::vector &getChildren() const { return children; } Node* findNode(const aiNode &aiNode); glm::mat4 model = glm::mat4(1); @@ -39,10 +41,13 @@ class Model { Node* find(const std::string &name); private: - const GLuint progId; + const Program program; std::vector meshes; Node *root; + + std::vector materials; + void loadModel(const std::string &path); Assimp::Importer importer;