X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=model.cpp;h=a11a0745dd9d4b8d41da1c8a3809fa34384e1037;hp=f68db4b6407f2096c4313794e1bb3d1c00e569f1;hb=b75b26b3081207cd4169f2ac50875e35d19b8a14;hpb=b65e36b22384a138e04ac9a49cbce9878e5e3366 diff --git a/model.cpp b/model.cpp index f68db4b..a11a074 100644 --- a/model.cpp +++ b/model.cpp @@ -1,16 +1,8 @@ #include "model.hpp" #include -#include #include #include -glm::mat4 aiMatrixToMat4(aiMatrix4x4 from) { - glm::mat4 to; - for (int i = 0; i < 4; i++) - for (int j = 0; j < 4; j++) - to[i][j] = from[j][i]; - return to; -} Model::Mesh::Mesh(const aiMesh *aiMesh, GLuint progId) { @@ -300,16 +292,9 @@ void Model::Node::draw( const std::vector &meshes, for (Node *child: children) child->draw(meshes, materials, skybox, tick, m, boneTransforms); } -Model::Model(const std::string &path, Program p): program(p) { +Model::Model(const aiScene *scene, Program p): program(p) { glUseProgram(p.progId); - const aiScene *scene = importer.ReadFile(path, - aiProcess_Triangulate | aiProcess_CalcTangentSpace | aiProcess_GenNormals | aiProcess_FlipUVs); - if (!scene) { - std::cerr << importer.GetErrorString() << std::endl; - exit(1); - } - for (int i = 0; i < scene->mNumMeshes; i++) { const aiMesh *mesh = scene->mMeshes[i]; meshes.push_back(Mesh(mesh, p.progId));