From 685aafd45fc7c30a2e9b6e05415e95f34df0d6b5 Mon Sep 17 00:00:00 2001 From: Warwick Date: Fri, 29 Apr 2022 16:28:16 +0100 Subject: [PATCH] Fixed being stuck in an infinite loop whilst loading model indecies --- src/Model.cpp | 4 ++-- src/main.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Model.cpp b/src/Model.cpp index 312296d..36cb186 100644 --- a/src/Model.cpp +++ b/src/Model.cpp @@ -71,7 +71,7 @@ Mesh Model::processMesh(aiMesh *mesh, const aiScene *scene) { } // Handle indeces // Loop through the meshes faces to get the correct order - for (unsigned int i = 0; mesh->mNumFaces; i++) { + for (unsigned int i = 0; i < mesh->mNumFaces; i++) { aiFace face = mesh->mFaces[i]; // loop through and add each face's indecies for (unsigned int faceIndicie = 0; faceIndicie < face.mNumIndices; @@ -79,7 +79,7 @@ Mesh Model::processMesh(aiMesh *mesh, const aiScene *scene) { indecies.push_back(face.mIndices[faceIndicie]); } } - // TODO Handle Assimps material format + // Handle Assimps material format if (mesh->mMaterialIndex >= 0) { aiMaterial *material = scene->mMaterials[mesh->mMaterialIndex]; std::vector diffuseMaps = loadMaterialTextures( diff --git a/src/main.cpp b/src/main.cpp index 5b34f80..fd72d52 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -186,7 +186,7 @@ int main(int argc, char **argv) { model.translate(glm::vec3(1.0f, 0.0f, 0.0f)); - Model backpack(ROOT_DIR "data/models/backpack/backpack.mtl"); + Model backpack(ROOT_DIR "data/models/backpack/backpack.obj"); // Mess with perspective // Projection matrix : 45° Field of View, 4:3 ratio, display range : 0.1