2 Commits 06d489e0fe ... d225234640

Autor SHA1 Nachricht Datum
  Nicolás A. Ortega Froysa d225234640 Removing unused functions. vor 5 Jahren
  Nicolás A. Ortega Froysa f770d0e973 Adding OBJ versions of the model. vor 5 Jahren

+ 12 - 0
assets/models/board.mtl

@@ -0,0 +1,12 @@
+# Blender MTL File: 'board.blend'
+# Material Count: 1
+
+newmtl Material
+Ns 96.078431
+Ka 1.000000 1.000000 1.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2

+ 236 - 0
assets/models/board.obj

@@ -0,0 +1,236 @@
+# Blender v2.79 (sub 0) OBJ File: 'board.blend'
+# www.blender.org
+mtllib board.mtl
+o Cube
+v 4.000000 -0.200000 -4.000000
+v 4.000000 -0.200000 4.000000
+v -4.000000 -0.200000 3.999999
+v -3.999998 -0.200000 -4.000001
+v 4.000001 0.200000 -3.999998
+v 3.999997 0.200000 4.000002
+v -4.000001 0.200000 3.999998
+v -4.000000 0.200000 -4.000000
+v 4.000000 0.200000 -1.333331
+v 3.999999 0.200000 1.333336
+v 1.333334 0.200000 -3.999998
+v -1.333332 0.200000 -3.999999
+v 1.333331 0.200000 4.000000
+v -1.333335 0.200000 4.000000
+v -4.000000 0.200000 1.333332
+v -4.000000 0.200000 -1.333334
+v 3.999999 0.200000 1.466669
+v -4.000000 0.200000 1.466666
+v 3.999999 0.200000 1.200002
+v -4.000000 0.200000 1.199999
+v -4.000000 0.200000 -1.206667
+v 4.000000 0.200000 -1.206664
+v -4.000000 0.200000 -1.466667
+v 4.000000 0.200000 -1.466664
+v -1.466666 0.200000 -3.999999
+v -1.466668 0.200000 4.000000
+v -1.466667 0.200000 1.466667
+v -1.466667 0.200000 1.200000
+v -1.466667 0.200000 -1.206666
+v -1.466667 0.200000 -1.466666
+v -1.199999 0.200000 -3.999999
+v -1.200002 0.200000 4.000000
+v -1.200001 0.200000 1.466667
+v -1.200001 0.200000 1.200000
+v -1.200000 0.200000 -1.206666
+v -1.200000 0.200000 -1.466666
+v 1.206665 0.200000 1.466668
+v 1.206665 0.200000 1.200001
+v 1.206666 0.200000 -1.206665
+v 1.206666 0.200000 -1.466665
+v 1.206668 0.200000 -3.999998
+v 1.206664 0.200000 4.000000
+v 1.466668 0.200000 -3.999998
+v 1.466664 0.200000 4.000000
+v 1.466665 0.200000 1.466668
+v 1.466665 0.200000 1.200001
+v 1.466667 0.200000 -1.206665
+v 1.466667 0.200000 -1.466665
+v 4.000000 0.350000 -1.466664
+v 4.000000 0.450000 -1.333331
+v 3.999999 0.350000 1.200002
+v 3.999999 0.450000 1.333336
+v 1.466668 0.350000 -3.999998
+v 1.333334 0.450000 -3.999998
+v -1.199999 0.350000 -3.999999
+v -1.333332 0.450000 -3.999999
+v 1.466664 0.350000 4.000000
+v 1.333331 0.450000 4.000000
+v -1.200002 0.350000 4.000000
+v -1.333335 0.450000 4.000000
+v -4.000000 0.350000 1.466666
+v -4.000000 0.450000 1.333332
+v -4.000000 0.350000 -1.206667
+v -4.000000 0.450000 -1.333334
+v 1.333332 0.450000 1.466668
+v 1.333333 0.450000 -1.466665
+v 1.333333 0.450000 -1.333332
+v 1.333332 0.450000 1.200001
+v 1.333332 0.450000 1.333334
+v -1.333334 0.450000 1.466667
+v -1.333333 0.450000 -1.466666
+v -1.333333 0.450000 -1.333333
+v -1.333334 0.450000 1.200000
+v -1.333334 0.450000 1.333333
+v 1.466667 0.450000 -1.333332
+v 1.466665 0.450000 1.333334
+v 1.206666 0.450000 -1.333332
+v 1.206665 0.450000 1.333334
+v -1.466667 0.450000 -1.333333
+v -1.466667 0.450000 1.333333
+v 3.999999 0.350000 1.466669
+v 1.206665 0.350000 1.466668
+v 1.466665 0.350000 1.466668
+v -1.466667 0.350000 1.466667
+v -4.000000 0.350000 1.199999
+v 1.333333 0.450000 -1.206665
+v -1.333333 0.450000 -1.206666
+v -1.466667 0.350000 1.200000
+v 1.206665 0.350000 1.200001
+v 1.466665 0.350000 1.200001
+v 4.000000 0.350000 -1.206664
+v 1.466667 0.350000 -1.206665
+v 1.206666 0.350000 -1.206665
+v -1.466667 0.350000 -1.206666
+v -4.000000 0.350000 -1.466667
+v -1.466667 0.350000 -1.466666
+v 1.206666 0.350000 -1.466665
+v 1.466667 0.350000 -1.466665
+v -1.466666 0.350000 -3.999999
+v -1.466668 0.350000 4.000000
+v -1.200000 0.450000 -1.333333
+v -1.200001 0.450000 1.333333
+v -1.200001 0.350000 1.466667
+v -1.200001 0.350000 1.200000
+v -1.200000 0.350000 -1.206666
+v -1.200000 0.350000 -1.466666
+v 1.206668 0.350000 -3.999998
+v 1.206664 0.350000 4.000000
+vn 0.0000 -1.0000 -0.0000
+vn 0.0000 1.0000 0.0000
+vn 1.0000 0.0000 0.0000
+vn -0.0000 -0.0000 1.0000
+vn -1.0000 -0.0000 -0.0000
+vn 0.0000 0.0000 -1.0000
+vn 0.6000 0.8000 0.0000
+vn 0.0000 0.8000 -0.6000
+vn -0.0000 0.8000 0.6000
+vn -0.0000 0.7849 0.6196
+vn -0.6000 0.8000 -0.0000
+vn -0.6196 0.7849 -0.0000
+usemtl Material
+s off
+f 1//1 2//1 3//1 4//1
+f 27//2 18//2 7//2 26//2
+f 1//3 5//3 24//3 9//3 22//3 19//3 10//3 17//3 6//3 2//3
+f 2//4 6//4 44//4 13//4 42//4 32//4 14//4 26//4 7//4 3//4
+f 3//5 7//5 18//5 15//5 20//5 21//5 16//5 23//5 8//5 4//5
+f 5//6 1//6 4//6 8//6 25//6 12//6 31//6 41//6 11//6 43//6
+f 44//3 45//3 83//3 57//3
+f 33//4 37//4 82//4 103//4
+f 28//6 20//6 85//6 88//6
+f 18//4 27//4 84//4 61//4
+f 45//4 17//4 81//4 83//4
+f 41//5 40//5 97//5 107//5
+f 47//4 22//4 91//4 92//4
+f 32//3 33//3 103//3 59//3
+f 39//5 38//5 89//5 93//5
+f 46//3 47//3 92//3 90//3
+f 26//4 14//4 60//4 100//4
+f 29//2 21//2 20//2 28//2
+f 27//5 26//5 100//5 84//5
+f 22//3 9//3 50//3 91//3
+f 12//6 25//6 99//6 56//6
+f 48//3 43//3 53//3 98//3
+f 16//5 21//5 63//5 64//5
+f 25//2 8//2 23//2 30//2
+f 24//6 48//6 98//6 49//6
+f 17//3 10//3 52//3 81//3
+f 19//6 46//6 90//6 51//6
+f 15//5 18//5 61//5 62//5
+f 34//3 35//3 105//3 104//3
+f 37//5 42//5 108//5 82//5
+f 14//4 32//4 59//4 60//4
+f 42//4 13//4 58//4 108//4
+f 29//5 28//5 88//5 94//5
+f 41//2 31//2 36//2 40//2
+f 36//3 31//3 55//3 106//3
+f 39//2 35//2 34//2 38//2
+f 13//4 44//4 57//4 58//4
+f 11//6 41//6 107//6 54//6
+f 31//6 12//6 56//6 55//6
+f 37//2 33//2 32//2 42//2
+f 40//6 36//6 106//6 97//6
+f 25//5 30//5 96//5 99//5
+f 43//6 11//6 54//6 53//6
+f 35//4 39//4 93//4 105//4
+f 30//6 23//6 95//6 96//6
+f 20//5 15//5 62//5 85//5
+f 10//3 19//3 51//3 52//3
+f 5//2 43//2 48//2 24//2
+f 23//5 16//5 64//5 95//5
+f 22//2 47//2 46//2 19//2
+f 38//6 34//6 104//6 89//6
+f 21//4 29//4 94//4 63//4
+f 9//3 24//3 49//3 50//3
+f 17//2 45//2 44//2 6//2
+f 83//7 65//7 58//7 57//7
+f 103//7 70//7 60//7 59//7
+f 98//7 66//7 67//7
+f 90//7 68//7 69//7
+f 106//7 71//7 72//7
+f 104//7 73//7 74//7
+f 96//8 95//8 64//8 79//8
+f 88//8 85//8 62//8 80//8
+f 74//7 70//7 103//7
+f 69//7 65//7 83//7
+f 80//9 62//9 61//9 84//9
+f 105//7 87//7 73//7 104//7
+f 92//7 86//7 68//7 90//7
+f 67//7 86//7 92//7
+f 72//7 87//7 105//7
+f 79//10 64//10 63//10 94//10
+f 55//7 56//7 71//7 106//7
+f 53//7 54//7 66//7 98//7
+f 56//11 99//11 96//11 71//11
+f 72//10 79//10 94//10
+f 87//11 94//11 88//11 73//11
+f 74//9 80//9 84//9
+f 88//8 80//8 74//8
+f 96//8 79//8 72//8
+f 70//11 84//11 100//11 60//11
+f 77//10 101//10 105//10 93//10
+f 78//9 102//9 103//9 82//9
+f 89//8 104//8 102//8 78//8
+f 97//8 106//8 101//8 77//8
+f 65//12 82//12 108//12 58//12
+f 97//8 77//8 67//8
+f 89//8 78//8 69//8
+f 69//9 78//9 82//9
+f 86//12 93//12 89//12 68//12
+f 67//10 77//10 93//10
+f 54//12 107//12 97//12 66//12
+f 50//10 75//10 92//10 91//10
+f 52//9 76//9 83//9 81//9
+f 51//8 90//8 76//8 52//8
+f 49//8 98//8 75//8 50//8
+f 75//8 98//8 67//8
+f 66//12 97//12 67//12
+f 86//12 67//12 93//12
+f 75//10 67//10 92//10
+f 101//8 106//8 72//8
+f 71//11 96//11 72//11
+f 87//11 72//11 94//11
+f 101//10 72//10 105//10
+f 70//11 74//11 84//11
+f 73//11 88//11 74//11
+f 102//9 74//9 103//9
+f 102//8 104//8 74//8
+f 65//12 69//12 82//12
+f 76//8 90//8 69//8
+f 68//12 89//12 69//12
+f 76//9 69//9 83//9

+ 12 - 0
assets/models/cube.mtl

@@ -0,0 +1,12 @@
+# Blender MTL File: 'cube.blend'
+# Material Count: 1
+
+newmtl Material
+Ns 96.078431
+Ka 1.000000 1.000000 1.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2

+ 26 - 0
assets/models/cube.obj

@@ -0,0 +1,26 @@
+# Blender v2.79 (sub 0) OBJ File: 'cube.blend'
+# www.blender.org
+mtllib cube.mtl
+o Cube
+v 0.500000 -0.500000 -0.500000
+v 0.500000 -0.500000 0.500000
+v -0.500000 -0.500000 0.500000
+v -0.500000 -0.500000 -0.500000
+v 0.500000 0.500000 -0.500000
+v 0.500000 0.500000 0.500000
+v -0.500000 0.500000 0.500000
+v -0.500000 0.500000 -0.500000
+vn 0.0000 -1.0000 0.0000
+vn 0.0000 1.0000 0.0000
+vn 1.0000 0.0000 0.0000
+vn -0.0000 -0.0000 1.0000
+vn -1.0000 -0.0000 -0.0000
+vn 0.0000 0.0000 -1.0000
+usemtl Material
+s off
+f 1//1 2//1 3//1 4//1
+f 5//2 8//2 7//2 6//2
+f 1//3 5//3 6//3 2//3
+f 2//4 6//4 7//4 3//4
+f 3//5 7//5 8//5 4//5
+f 5//6 1//6 4//6 8//6

+ 10 - 0
assets/models/sphere.mtl

@@ -0,0 +1,10 @@
+# Blender MTL File: 'sphere.blend'
+# Material Count: 1
+
+newmtl None
+Ns 0
+Ka 0.000000 0.000000 0.000000
+Kd 0.8 0.8 0.8
+Ks 0.8 0.8 0.8
+d 1
+illum 2

Datei-Diff unterdrückt, da er zu groß ist
+ 1512 - 0
assets/models/sphere.obj


+ 0 - 69
src/AssetManager.cpp

@@ -30,75 +30,6 @@
 #include <assimp/scene.h>
 #include <assimp/postprocess.h>
 
-/*void AssetManager::loadOBJ(const std::string &path,
-		const std::string &name)
-{
-	std::vector<unsigned int> vertexIndices,
-		uvIndices, normalIndices;
-	std::vector<glm::vec3> temp_vertices;
-	std::vector<glm::vec2> temp_uvs;
-	std::vector<glm::vec3> temp_normals;
-
-	FILE *file = fopen(path.c_str(), "r");
-	if(not file)
-	{
-		System::logger->writeError("Failed to open file.");
-		return;
-	}
-
-	while(true)
-	{
-		char lineHeader[128];
-		int res = fscanf(file, "%s", lineHeader);
-		if(res == EOF)
-			break;
-
-		if(strcmp(lineHeader, "v") == 0)
-		{
-			glm::vec3 vertex;
-			fscanf(file, "%f %f %f\n",
-					&vertex.x, &vertex.y, &vertex.z);
-			temp_vertices.push_back(vertex);
-		}
-		else if(strcmp(lineHeader, "vt") == 0)
-		{
-			glm::vec2 uv;
-			fscanf(file, "%f %f\n", &uv.x, &uv.y);
-			temp_uvs.push_back(uv);
-		}
-		else if(strcmp(lineHeader, "vn") == 0)
-		{
-			glm::vec3 normal;
-			fscanf(file, "%f %f %f\n",
-					&normal.x, &normal.y, &normal.z);
-			temp_normals.push_back(normal);
-		}
-		else if(strcmp(lineHeader, "f") == 0)
-		{
-			std::string v1, v2, v3;
-			unsigned int vIndex[3], uvIndex[3], normIndex[3];
-			int matches = fscanf(file,
-					"%d/%d/%d %d/%d/%d %d/%d/%d\n",
-					&vIndex[0], &uvIndex[0], &normIndex[0],
-					&vIndex[1], &uvIndex[1], &normIndex[1],
-					&vIndex[2], &uvIndex[2], &normIndex[2]);
-			if(matches not_eq 9)
-			{
-				System::logger->writeError(
-						"OBJ file is too complicated.");
-				return;
-			}
-
-			for(auto &i : vIndex)
-				vertexIndices.push_back(i);
-			for(auto &i : uvIndex)
-				uvIndices.push_back(i);
-			for(auto &i : normIndex)
-				normalIndices.push_back(i);
-		}
-	}
-}*/
-
 void AssetManager::loadModel(const std::string &path,
 		const std::string &name)
 {

+ 0 - 3
src/AssetManager.hpp

@@ -26,13 +26,10 @@
 class AssetManager {
 public:
 
-	/*void loadOBJ(const std::string &path,
-			const std::string &name);*/
 	void loadModel(const std::string &path,
 			const std::string &name);
 	std::shared_ptr<Model> getModel(const std::string &name);
 	void unloadModel(const std::string &name);
-	//void unloadOBJ(const std::string &name);
 private:
 	std::map<std::string, std::shared_ptr<Model>> models;
 };

+ 3 - 3
src/System.cpp

@@ -75,13 +75,13 @@ System::System() : running(true) {
 			shaders.at("default").getId(),
 			"mvp");
 	asset_mngr.loadModel(
-			"../assets/models/board.dae",
+			"../assets/models/board.obj",
 			"board");
 	asset_mngr.loadModel(
-			"../assets/models/cube.dae",
+			"../assets/models/cube.obj",
 			"cube");
 	asset_mngr.loadModel(
-			"../assets/models/sphere.dae",
+			"../assets/models/sphere.obj",
 			"sphere");
 }