|
|
@@ -3,6 +3,11 @@
|
|
|
#include "renderManager.h"
|
|
|
#include "inputManager.h"
|
|
|
#include <stdio.h>
|
|
|
+#include <fstream>
|
|
|
+#include <sstream>
|
|
|
+#include <string>
|
|
|
+#include "vector3.h"
|
|
|
+#include "mesh.h"
|
|
|
|
|
|
Engine::Engine(){
|
|
|
|
|
|
@@ -61,3 +66,36 @@ void Engine::mainLoop(){
|
|
|
printf("Loop Iteration N:%d\n",count);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+void Engine::loadModels(){
|
|
|
+ printf("loading models");
|
|
|
+ std::fstream file;
|
|
|
+ std::string line, path, v, x ,y ,z;
|
|
|
+
|
|
|
+ Mesh cube;
|
|
|
+
|
|
|
+ path = "../models/cube.obj";
|
|
|
+ file.open(path.c_str());
|
|
|
+
|
|
|
+ //Get vertices into mesh
|
|
|
+ while(!file.eof()){
|
|
|
+
|
|
|
+ std::getline(file,line);
|
|
|
+ std::istringstream iss(line);
|
|
|
+ if(line[0] == 'v'){
|
|
|
+ iss >> v >> x >> y >> z;
|
|
|
+ Vector3 vertex(x,y,z);
|
|
|
+ cube.vertices.push_back(vertex);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ file.close();
|
|
|
+ int meshSize = cube.vertices.size();
|
|
|
+ printf("Meshsize is: %d \n", meshSize);
|
|
|
+ for(int i = 0; i < meshSize; ++i){
|
|
|
+ Vector3 vertex = cube.vertices[i];
|
|
|
+ printf("Vertex %2.1d: %f, %f, %f \n",i,vertex.x, vertex.y, vertex.z);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|