X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=model.cpp;h=3fbe17a997ad1abe492c554ef2faefe4317fe1e4;hp=c9ecdc16d01e6d1ca72ba6016f42695759cccc41;hb=a03f2bc751bbd7f91cbc2f52d2f0f6e753d6f776;hpb=8abaf8f77191e1c660def0832d8036a8b4639ba8 diff --git a/model.cpp b/model.cpp index c9ecdc1..3fbe17a 100644 --- a/model.cpp +++ b/model.cpp @@ -1,5 +1,4 @@ #include "model.hpp" -#include "error.hpp" #include #include #include @@ -18,7 +17,8 @@ Model::Mesh::Mesh(const aiMesh *aiMesh, GLuint progId) { aiVector3D v = aiMesh->mNormals[i]; normals.push_back(glm::vec3(v.x, v.y, v.z)); } else { - normals.push_back(glm::vec3(0)); + std::cerr << "Missing normals" << std::endl; + exit(1); } if (aiMesh->HasTangentsAndBitangents()) { aiVector3D t = aiMesh->mTangents[i]; @@ -78,17 +78,17 @@ Model::Mesh::Mesh(const aiMesh *aiMesh, GLuint progId) { glEnableVertexAttribArray(texCoordLoc); glVertexAttribPointer(texCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, 0); - GLuint tangentLoc = glGetAttribLocation(progId, "tangent"); - glBindBuffer(GL_ARRAY_BUFFER, tangentVbo); - glBufferData(GL_ARRAY_BUFFER, tangents.size() * sizeof(glm::vec3), &tangents[0], GL_STATIC_DRAW); - glEnableVertexAttribArray(tangentLoc); - glVertexAttribPointer(tangentLoc, 3, GL_FLOAT, GL_FALSE, 0, 0); + /* GLuint tangentLoc = glGetAttribLocation(progId, "tangent"); */ + /* glBindBuffer(GL_ARRAY_BUFFER, tangentVbo); */ + /* glBufferData(GL_ARRAY_BUFFER, tangents.size() * sizeof(glm::vec3), &tangents[0], GL_STATIC_DRAW); */ + /* glEnableVertexAttribArray(tangentLoc); */ + /* glVertexAttribPointer(tangentLoc, 3, GL_FLOAT, GL_FALSE, 0, 0); */ - GLuint bitangentLoc = glGetAttribLocation(progId, "bitangent"); - glBindBuffer(GL_ARRAY_BUFFER, bitangentVbo); - glBufferData(GL_ARRAY_BUFFER, bitangents.size() * sizeof(glm::vec3), &bitangents[0], GL_STATIC_DRAW); - glEnableVertexAttribArray(bitangentLoc); - glVertexAttribPointer(bitangentLoc, 3, GL_FLOAT, GL_FALSE, 0, 0); + /* GLuint bitangentLoc = glGetAttribLocation(progId, "bitangent"); */ + /* glBindBuffer(GL_ARRAY_BUFFER, bitangentVbo); */ + /* glBufferData(GL_ARRAY_BUFFER, bitangents.size() * sizeof(glm::vec3), &bitangents[0], GL_STATIC_DRAW); */ + /* glEnableVertexAttribArray(bitangentLoc); */ + /* glVertexAttribPointer(bitangentLoc, 3, GL_FLOAT, GL_FALSE, 0, 0); */ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indicesVbo); glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(GLuint), &indices[0], GL_STATIC_DRAW); @@ -127,10 +127,6 @@ void Model::Node::draw( const std::vector &meshes, Material material = materials[mesh.materialIndex]; material.bind(); - glUniform1i(glGetUniformLocation(progId, "skybox"), 5); - glActiveTexture(GL_TEXTURE5); - glBindTexture(GL_TEXTURE_CUBE_MAP, skybox.getTexture()); - glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(m)); glDrawElements(GL_TRIANGLES, mesh.numIndices, GL_UNSIGNED_INT, 0);