From a0915a5548b939485af5253cefe072caf6687dbc Mon Sep 17 00:00:00 2001 From: Woohyung Choi <201421062@sce212.ajou.ac.kr> Date: Wed, 11 Dec 2019 16:51:47 +0900 Subject: [PATCH] Revert "fix parenthess bug" This reverts commit 07a9493122a02da7ac83e9480a25a8723322da3e. --- LearnOpenGL/ResourceLoader.cpp | 54 +++++++++++++--------------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/LearnOpenGL/ResourceLoader.cpp b/LearnOpenGL/ResourceLoader.cpp index 36c0b4c..8a3dc45 100644 --- a/LearnOpenGL/ResourceLoader.cpp +++ b/LearnOpenGL/ResourceLoader.cpp @@ -106,19 +106,6 @@ bool openObj(const std::string fileName, std::vector<glm::vec3> &vertices, std:: sscanf_s(line.substr(0, charPos).c_str(), "%d%*[-//]%d", &vIndex, &vnIndex); line.erase(0, charPos + 1); } - - if (vIndex >= 1) - { - faceVertexIndicies.push_back(vIndex - 1); - } - if (uvIndex >= 1) - { - faceVertexTexCoordIndicies.push_back(uvIndex - 1); - } - if (vnIndex >= 1) - { - faceVertexNormalIndicies.push_back(vnIndex - 1); - } } if (line.size() > 0) @@ -219,31 +206,30 @@ bool openObj(const std::string fileName, std::vector<glm::vec3> &vertices, std:: log_warn(infoLog, fileName + " : " + "faceVertexNormalIndices.size() : " + std::to_string(faceVertexNormalIndicies.size())); } } - } - - ifs.close(); - return true; -} + ifs.close(); -Image *load_Image(std::string fileName, int *width, int *height, int *nrChannels) -{ - fileName = "../Images/" + fileName; - stbi_set_flip_vertically_on_load(true); + return true; + } - unsigned char *data = stbi_load(fileName.c_str(), width, height, nrChannels, 0); - if (data == NULL) + Image *load_Image(std::string fileName, int *width, int *height, int *nrChannels) { - std::cout << "Failed to load texture : " + fileName << std::endl; - } + fileName = "../Images/" + fileName; + stbi_set_flip_vertically_on_load(true); - Image *img = new Image(*width, *height, *nrChannels, data); + unsigned char *data = stbi_load(fileName.c_str(), width, height, nrChannels, 0); + if (data == NULL) + { + std::cout << "Failed to load texture : " + fileName << std::endl; + } - return img; -} + Image *img = new Image(*width, *height, *nrChannels, data); -void free_image(Image *img) -{ - stbi_image_free(img->getData()); - free(img); -} \ No newline at end of file + return img; + } + + void free_image(Image *img) + { + stbi_image_free(img->getData()); + free(img); + } \ No newline at end of file -- GitLab