Fixed being stuck in an infinite loop whilst loading model indecies

This commit is contained in:
Warwick 2022-04-29 16:28:16 +01:00
parent 753ec9c857
commit 685aafd45f
2 changed files with 3 additions and 3 deletions

View file

@ -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<Texture> diffuseMaps = loadMaterialTextures(

View file

@ -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