wsparcie dla visual studio, lekkie uprzątnięcie kodu
This commit is contained in:
16
loadOBJ.cpp
16
loadOBJ.cpp
@@ -1,13 +1,4 @@
|
||||
#include "loadOBJ.h"
|
||||
#include <string>
|
||||
//#include <vector>
|
||||
#include <windows.h>
|
||||
//#include <gl\gl.h>
|
||||
//#include <gl\glu.h>
|
||||
//#include <cstdio>
|
||||
//#include <glm\glm.hpp>
|
||||
|
||||
// using namespace glm;
|
||||
|
||||
bool loadOBJ(const char* path, std::vector <glm::vec3>& out_vertices, std::vector <glm::vec2>& out_uvs, std::vector <glm::vec3>& out_normals){
|
||||
|
||||
@@ -16,11 +7,11 @@ bool loadOBJ(const char* path, std::vector <glm::vec3>& out_vertices, std::vecto
|
||||
std::vector <glm::vec2> temp_uvs;
|
||||
std::vector <glm::vec3> temp_normals;
|
||||
|
||||
printf("Ladowanie pliku %s...\n", path);
|
||||
printf("(loadOBJ.cpp) Ladowanie pliku ze sciezki: %s...\n", path);
|
||||
|
||||
FILE* file = fopen(path, "r");
|
||||
if (file == NULL) {
|
||||
printf("Impossible to open the file!\n");
|
||||
printf("(loadOBJ.cpp) Nie udalo sie odtworzyc pliku. Czy na pewno jest on we wskazanym katalogu?\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,7 +45,6 @@ bool loadOBJ(const char* path, std::vector <glm::vec3>& out_vertices, std::vecto
|
||||
|
||||
} else if (strcmp(lineHeader, "f") == 0) {
|
||||
|
||||
std::string vertex1, vertex2, vertex3;
|
||||
unsigned int vertexIndex[3], uvIndex[3], normalIndex[3];
|
||||
int matches = fscanf(file, "%d/%d/%d %d/%d/%d %d/%d/%d\n", &vertexIndex[0], &uvIndex[0], &normalIndex[0], &vertexIndex[1], &uvIndex[1], &normalIndex[1], &vertexIndex[2], &uvIndex[2], &normalIndex[2]);
|
||||
|
||||
@@ -93,5 +83,5 @@ bool loadOBJ(const char* path, std::vector <glm::vec3>& out_vertices, std::vecto
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user