rendered paste bodydouble getArray(char *filename){fstream myfile (filename); vector < vector<double> > verts; vector <double> coords; vector <int> index; string i1, i2, i3, i4; int size, found; size = vertexCount(); string str, x, y, z; if (myfile.is_open()) { while (! myfile.eof() ) { getline (myfile, str); if ((str[0] == 'v') && (str[1] == ' ')) { // Vertex coords to array found = str.find_first_of("-0123456789."); x = str.substr((found),9); y = str.substr((found+9),9); z = str.substr((found+(9*2)),9); coords.push_back(atof(x.c_str())); coords.push_back(atof(y.c_str())); coords.push_back(atof(z.c_str())); verts.push_back(coords); coords.clear(); } if (str[0] == 'f') { int target = 0; found = str.find_first_of(" ", target); i1 = str.at(found+1); target = (found+1); found = str.find_first_of(" ", target); i2 = str.at(found+1); target = (found+1); found = str.find_first_of(" ", target); i3 = str.at(found+1); target = (found+1); found = str.find_first_of(" ", target); i4 = str.at(found+1); cout << i1 << i2 << i3 << i4 << endl; index.push_back(atoi(i1.c_str())); index.push_back(atoi(i2.c_str())); index.push_back(atoi(i3.c_str())); index.push_back(atoi(i4.c_str())); } } } else cout << "pistäs kuule oikea tiedosto mikä edes saattaa löytyä!" << endl;int iSize, vSize;iSize = index.size();vSize = verts.size();double vertexArray[iSize];for (int i = 0; i < (iSize-1);i++) { int n = index[i]; vertexArray[i] = verts[(n-1)][0]; vertexArray[i] = verts[(n-1)][1]; vertexArray[i] = verts[(n-1)][2]; } }